/* Mistral Pro Reno Cost Calculator CSS - Version 2.0 */
/* Corrigé pour éviter la superposition des colonnes */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f0f0;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

/* HEADER */
header {
    background: #f5f5f0;
    padding: 25px 40px;
    border-bottom: 3px solid #ddd;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.header-content .logo {
    height: 120px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.header-text {
    flex: 1;
}

.header-content h1 {
    font-family: Georgia, serif;
    color: #333;
    font-size: 2.5em;
    margin-bottom: 5px;
    font-weight: bold;
}

.header-content p {
    color: #666;
    font-size: 1.2em;
}

/* CONTENT */
.content {
    padding: 0 40px 120px 40px;
    position: relative;
}

/* CLIENT FORM HEADER - CORRIGÉ */
.client-form-header {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.1);
}

.client-form-header h3 {
    color: #333;
    font-size: 1.3em;
    margin-bottom: 20px;
    font-weight: bold;
}

/* CORRECTION: Grid layout properly defined */
.form-row-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.form-group-header {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent overflow */
}

.form-group-header label {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group-header input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group-header input:focus {
    outline: none;
    border-color: #4a90e2;
    background-color: #fafbff;
}

.form-group-header input::placeholder {
    color: #999;
    font-style: italic;
}

/* TABS */
.tabs-container {
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    padding: 20px 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 30px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tab-button {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-button:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.tab-button.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
    font-weight: bold;
}

/* TAB CONTENT */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content h2 {
    color: #333;
    font-size: 1.8em;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4a90e2;
}

/* FORM ITEMS */
.form-item {
    margin-bottom: 30px;
}

.form-item label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 15px;
}

/* RANGE INPUTS */
input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #357abd;
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #357abd;
    transform: scale(1.2);
}

/* NUMBER INPUTS */
input[type="number"] {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-left: 15px;
}

input[type="number"]:focus {
    outline: none;
    border-color: #4a90e2;
}

/* SELECT INPUTS */
select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

select:focus {
    outline: none;
    border-color: #4a90e2;
}

/* CHECKBOX GROUP */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* SUMMARY SECTION */
.summary {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 3px solid #4a90e2;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 20px;
}

.summary-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-item span {
    color: #666;
    font-size: 15px;
}

.summary-item strong {
    color: #333;
    font-size: 18px;
}

.summary-item.total strong {
    color: #4a90e2;
    font-size: 24px;
}

/* ACTION BUTTONS */
.summary-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.summary-actions button {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download {
    background: #28a745;
    color: white;
}

.btn-download:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-preview {
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
    color: white;
}

.btn-preview:hover {
    background: linear-gradient(135deg, #5a32a3 0%, #4a2588 100%);
    transform: translateY(-2px);
}

.btn-generate {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
}

.btn-generate:hover {
    background: linear-gradient(135deg, #357abd 0%, #2968a8 100%);
    transform: translateY(-2px);
}

.btn-print {
    background: #4a90e2;
    color: white;
}

.btn-print:hover {
    background: #357abd;
    transform: translateY(-2px);
}

.btn-reset {
    background: #dc3545;
    color: white;
}

.btn-reset:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
}

.close-modal {
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s;
}

.close-modal:hover {
    transform: scale(1.2);
}

#clientForm {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4a90e2;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn-cancel {
    padding: 12px 24px;
    background-color: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    flex: 1;
}

.btn-cancel:hover {
    background-color: #d0d0d0;
}

.btn-email {
    padding: 12px 24px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    flex: 1;
}

.btn-email:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

/* PREVIEW MODAL */
.modal-preview {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow-y: auto;
}

.modal-preview-content {
    background-color: white;
    margin: 30px auto;
    padding: 0;
    border-radius: 8px;
    width: 95%;
    max-width: 900px;
    height: 85vh;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease;
}

.modal-preview-header {
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-preview-header h2 {
    margin: 0;
    font-size: 22px;
}

.modal-preview-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f5f5f5;
}

.modal-preview-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
}

.modal-preview-footer {
    background: white;
    padding: 20px 30px;
    border-top: 2px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.close-preview {
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s;
}

.close-preview:hover {
    transform: scale(1.2);
}

.btn-download-from-preview {
    padding: 12px 24px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-download-from-preview:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-close-preview {
    padding: 12px 24px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-close-preview:hover {
    background: #d0d0d0;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }

    .header-content .logo {
        height: 80px;
    }

    .summary-content {
        flex-direction: column;
        align-items: stretch;
    }

    .summary-item {
        justify-content: space-between;
    }

    .summary-actions {
        justify-content: center;
        width: 100%;
    }

    .form-row-header {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .content {
        padding: 0 20px 140px 20px;
    }

    header {
        padding: 15px 20px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .header-content .logo {
        height: 80px;
    }

    .header-content h1 {
        font-size: 1.8em;
    }

    .header-content p {
        font-size: 1em;
    }

    .client-form-header {
        padding: 20px;
    }

    .form-row-header {
        grid-template-columns: 1fr;
    }

    .tab-button {
        font-size: 12px;
        padding: 8px 12px;
    }

    .tab-content h2 {
        font-size: 1.4em;
    }

    input[type="number"] {
        width: 80px;
    }

    .summary {
        padding: 15px;
    }

    .summary-actions button {
        width: 100%;
        padding: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column;
    }

    .btn-cancel,
    .btn-generate,
    .btn-email {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .form-row-header {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .modal-preview-content {
        width: 98%;
        height: 90vh;
        margin: 20px auto;
    }
}

/* PRINT STYLES */
@media print {
    body {
        background: white;
        padding: 0;
    }

    header {
        padding: 20px;
        border-bottom: 2px solid #333;
    }

    .header-content .logo {
        height: 70px;
    }

    .tabs-container,
    .summary,
    .summary-actions {
        display: none !important;
    }

    .content {
        padding: 20px;
    }

    .tab-content {
        display: block !important;
        page-break-inside: avoid;
    }
}