/*
 * Custom Plan Plugin - Frontend Styles
 * Based on Tombuild Theme Form Styles
 */

/* CSS Variables from Tombuild Theme */
:root {
    --e-global-color-tombuild_accent: #EE0D08;
    --e-global-color-tombuild_primary: #022047;
    --e-global-color-tombuild_text: #858585;
    --e-global-color-tombuild_border: #E7E7E7;
    --e-global-color-tombuild_light: #F8F8F9;
    --e-global-color-tombuild_accent_2: #092357;
    --font-heading: 'Chivo', sans-serif;
    --font-body: 'Roboto', sans-serif;
}

/* Custom Plan Wrapper */
.custom-plan-wrapper {
    font-family: var(--font-body);
    color: var(--e-global-color-tombuild_text);
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.custom-plan-wrapper .wrap {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
    align-items: start;
}

/* Header Styles */
.custom-plan-wrapper header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--e-global-color-tombuild_border);
}

.custom-plan-wrapper .logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--e-global-color-tombuild_primary), var(--e-global-color-tombuild_accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    border-radius: 8px;
    font-family: var(--font-heading);
}

.custom-plan-wrapper h1 {
    font-family: var(--font-heading);
    color: var(--e-global-color-tombuild_primary);
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.custom-plan-wrapper .hint {
    color: var(--e-global-color-tombuild_text);
    font-size: 14px;
    margin-top: 5px;
}

/* Panel Styles */
.custom-plan-wrapper .panel {
    background: white;
    border: 1px solid var(--e-global-color-tombuild_border);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.custom-plan-wrapper .aside {
    position: sticky;
    top: 20px;
}

/* Section Titles */
.custom-plan-wrapper .section-title {
    margin-bottom: 20px;
}

.custom-plan-wrapper .section-title h2 {
    font-family: var(--font-heading);
    color: var(--e-global-color-tombuild_primary);
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 600;
}

.custom-plan-wrapper .section-title .hint {
    font-size: 12px;
    color: var(--e-global-color-tombuild_text);
    margin: 0;
}

/* Form Styles - Based on Tombuild Theme */
.custom-plan-wrapper form {
    margin: 0;
}

.custom-plan-wrapper .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.custom-plan-wrapper .form-row > div {
    display: flex;
    flex-direction: column;
}

/* Label Styles */
.custom-plan-wrapper label {
    font-weight: 500;
    color: var(--e-global-color-tombuild_primary);
    margin-bottom: 8px;
    font-size: 14px;
    display: block;
}

/* Input Styles - Based on Tombuild Theme */
.custom-plan-wrapper input[type="text"],
.custom-plan-wrapper input[type="email"],
.custom-plan-wrapper input[type="tel"],
.custom-plan-wrapper input[type="number"],
.custom-plan-wrapper select,
.custom-plan-wrapper textarea {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 2;
    padding: 15px 20px;
    border: 1px solid var(--e-global-color-tombuild_border);
    background-color: var(--e-global-color-tombuild_light);
    color: var(--e-global-color-tombuild_text);
    margin-bottom: 10px;
    text-shadow: none;
    border-radius: 4px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

/* Select Styles */
.custom-plan-wrapper select {
    padding: 15px 20px;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-color: var(--e-global-color-tombuild_border);
    background: var(--e-global-color-tombuild_light) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23858585'><polygon points='0,0 100,0 50,50'/></svg>") no-repeat;
    background-size: 10px;
    background-position: calc(100% - 20px) calc(50% + 3px);
    cursor: pointer;
}

/* Focus States */
.custom-plan-wrapper input[type="text"]:focus,
.custom-plan-wrapper input[type="email"]:focus,
.custom-plan-wrapper input[type="tel"]:focus,
.custom-plan-wrapper input[type="number"]:focus,
.custom-plan-wrapper select:focus,
.custom-plan-wrapper textarea:focus {
    outline: 0;
    border-color: var(--e-global-color-tombuild_accent);
    box-shadow: 0 0 0 2px rgba(238, 13, 8, 0.1);
    background-color: white;
}

/* Button Styles - Based on Tombuild Theme */
.custom-plan-wrapper .button,
.custom-plan-wrapper button,
.custom-plan-wrapper input[type="button"],
.custom-plan-wrapper input[type="submit"] {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 60px;
    font-weight: 500;
    color: #fff;
    background-color: var(--e-global-color-tombuild_accent);
    padding: 0 30px;
    display: inline-block;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
    text-align: center;
    min-height: 60px;
    box-sizing: border-box;
}

/* Button Hover States */
.custom-plan-wrapper .button:hover,
.custom-plan-wrapper .button:focus,
.custom-plan-wrapper button:hover,
.custom-plan-wrapper input[type="button"]:hover,
.custom-plan-wrapper input[type="submit"]:hover,
.custom-plan-wrapper input[type="button"]:focus,
.custom-plan-wrapper input[type="submit"]:focus {
    outline: 0;
    background-color: var(--e-global-color-tombuild_primary);
    color: #fff;
    text-decoration: none;
}

/* Button Variants */
.custom-plan-wrapper .button.secondary,
.custom-plan-wrapper button.secondary {
    background-color: var(--e-global-color-tombuild_border);
    color: var(--e-global-color-tombuild_primary);
}

.custom-plan-wrapper .button.secondary:hover,
.custom-plan-wrapper button.secondary:hover {
    background-color: var(--e-global-color-tombuild_text);
    color: white;
}

.custom-plan-wrapper .button.primary,
.custom-plan-wrapper button.primary {
    background-color: var(--e-global-color-tombuild_accent);
    color: white;
}

.custom-plan-wrapper .button.primary:hover,
.custom-plan-wrapper button.primary:hover {
    background-color: var(--e-global-color-tombuild_primary);
}

/* Room Controls */
.custom-plan-wrapper .room-controls {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
    margin-bottom: 20px;
}

.custom-plan-wrapper .room-controls select,
.custom-plan-wrapper .room-controls input {
    margin-bottom: 0;
}

/* Chip List for Selected Rooms */
.custom-plan-wrapper .chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 40px;
    padding: 10px;
    border: 1px dashed var(--e-global-color-tombuild_border);
    border-radius: 4px;
    background-color: rgba(248, 248, 249, 0.5);
}

.custom-plan-wrapper .chip {
    background-color: var(--e-global-color-tombuild_primary);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-plan-wrapper .chip .remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.custom-plan-wrapper .chip .remove:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Drawing Options */
.custom-plan-wrapper .drawings {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.custom-plan-wrapper .drawing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--e-global-color-tombuild_border);
    border-radius: 4px;
    background-color: var(--e-global-color-tombuild_light);
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.custom-plan-wrapper .drawing:hover {
    border-color: var(--e-global-color-tombuild_accent);
    background-color: white;
}

.custom-plan-wrapper .drawing label {
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--e-global-color-tombuild_primary);
}

.custom-plan-wrapper .drawing input[type="checkbox"] {
    width: auto;
    margin: 0;
    transform: scale(1.2);
}

/* File Upload Area */
.custom-plan-wrapper .upload {
    border: 2px dashed var(--e-global-color-tombuild_border);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background-color: var(--e-global-color-tombuild_light);
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    margin-bottom: 20px;
}

.custom-plan-wrapper .upload:hover {
    border-color: var(--e-global-color-tombuild_accent);
    background-color: white;
}

.custom-plan-wrapper .upload.dragover {
    border-color: var(--e-global-color-tombuild_accent);
    background-color: rgba(238, 13, 8, 0.05);
}

/* File List */
.custom-plan-wrapper .file-list {
    margin-bottom: 20px;
}

.custom-plan-wrapper .file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--e-global-color-tombuild_light);
    border: 1px solid var(--e-global-color-tombuild_border);
    border-radius: 4px;
    margin-bottom: 10px;
}

.custom-plan-wrapper .file-item .file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-plan-wrapper .file-item .file-name {
    font-weight: 500;
    color: var(--e-global-color-tombuild_primary);
}

.custom-plan-wrapper .file-item .file-size {
    font-size: 12px;
    color: var(--e-global-color-tombuild_text);
}

.custom-plan-wrapper .file-item .remove-file {
    background: none;
    border: none;
    color: var(--e-global-color-tombuild_text);
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.custom-plan-wrapper .file-item .remove-file:hover {
    background-color: var(--e-global-color-tombuild_accent);
    color: white;
}

/* Calculator Panel */
.custom-plan-wrapper .calc-panel {
    position: sticky;
    top: 20px;
}

.custom-plan-wrapper .pkg {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--e-global-color-tombuild_border);
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.custom-plan-wrapper .pkg:hover,
.custom-plan-wrapper .pkg.active {
    border-color: var(--e-global-color-tombuild_accent);
    background-color: rgba(238, 13, 8, 0.05);
}

.custom-plan-wrapper .pkg div:first-child {
    font-weight: 500;
    color: var(--e-global-color-tombuild_primary);
}

.custom-plan-wrapper .pkg div:last-child {
    font-weight: 600;
    color: var(--e-global-color-tombuild_accent);
}

.custom-plan-wrapper .breakdown {
    margin: 20px 0;
    padding: 15px;
    background-color: var(--e-global-color-tombuild_light);
    border-radius: 4px;
}

.custom-plan-wrapper .breakdown .break-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.custom-plan-wrapper .breakdown .break-item:last-child {
    margin-bottom: 0;
    padding-top: 8px;
    border-top: 1px solid var(--e-global-color-tombuild_border);
    font-weight: 600;
}

.custom-plan-wrapper .grand {
    font-size: 24px;
    font-weight: 700;
    color: var(--e-global-color-tombuild_accent);
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    background-color: var(--e-global-color-tombuild_light);
    border-radius: 4px;
}

.custom-plan-wrapper .cta {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.custom-plan-wrapper .note {
    font-size: 12px;
    color: var(--e-global-color-tombuild_text);
    text-align: center;
    margin-top: 10px;
}

/* Modal Styles */
.custom-plan-wrapper #previewModal {
    position: fixed;
    inset: 0;
    background: rgba(2, 32, 71, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.custom-plan-wrapper #previewModal > div {
    width: 95%;
    max-width: 900px;
    background: white;
    border-radius: 12px;
    padding: 30px;
    color: var(--e-global-color-tombuild_primary);
    max-height: 90vh;
    overflow: auto;
}

.custom-plan-wrapper #previewModal h3 {
    margin-top: 0;
    font-family: var(--font-heading);
    color: var(--e-global-color-tombuild_primary);
}

.custom-plan-wrapper #previewModal .summary-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--e-global-color-tombuild_border);
}

.custom-plan-wrapper #previewModal .summary-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.custom-plan-wrapper #previewModal .summary-label {
    font-weight: 600;
    color: var(--e-global-color-tombuild_primary);
    margin-bottom: 5px;
}

.custom-plan-wrapper #previewModal .summary-value {
    color: var(--e-global-color-tombuild_text);
}

.custom-plan-wrapper #previewModal .modal-actions {
    text-align: right;
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Responsive Design */
@media (max-width: 768px) {
    .custom-plan-wrapper .wrap {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .custom-plan-wrapper .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .custom-plan-wrapper .room-controls {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .custom-plan-wrapper .cta {
        flex-direction: column;
    }
    
    .custom-plan-wrapper header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
}

/* Utility Classes */
.custom-plan-wrapper .text-center { text-align: center; }
.custom-plan-wrapper .text-left { text-align: left; }
.custom-plan-wrapper .text-right { text-align: right; }
.custom-plan-wrapper .mb-0 { margin-bottom: 0; }
.custom-plan-wrapper .mb-1 { margin-bottom: 10px; }
.custom-plan-wrapper .mb-2 { margin-bottom: 20px; }
.custom-plan-wrapper .mt-0 { margin-top: 0; }
.custom-plan-wrapper .mt-1 { margin-top: 10px; }
.custom-plan-wrapper .mt-2 { margin-top: 20px; }

/* Loading States */
.custom-plan-wrapper .loading {
    opacity: 0.6;
    pointer-events: none;
}

.custom-plan-wrapper .loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--e-global-color-tombuild_border);
    border-top-color: var(--e-global-color-tombuild_accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error States */
.custom-plan-wrapper .error {
    border-color: var(--e-global-color-tombuild_accent) !important;
    box-shadow: 0 0 0 2px rgba(238, 13, 8, 0.1) !important;
}

.custom-plan-wrapper .error-message {
    color: var(--e-global-color-tombuild_accent);
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Success States */
.custom-plan-wrapper .success {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.1) !important;
}

.custom-plan-wrapper .success-message {
    color: #28a745;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}
