/* =====================================================
   Chiffrage - Styles specifiques au wizard
   ===================================================== */

/* Main content pour sous-pages */
.main-content {
    flex: 1;
    padding: 3rem 0;
    background: var(--background-alt);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =====================================================
   Wizard Container
   ===================================================== */
.wizard-container {
    max-width: 900px;
    margin: 0 auto;
}

/* =====================================================
   Cards (surcharge Bootstrap)
   ===================================================== */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--background-alt);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-header h4,
.card-header h5 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.card-header.bg-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    color: var(--white);
    border-bottom: none;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--background-alt);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
}

/* =====================================================
   Wizard Steps
   ===================================================== */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0;
    list-style: none;
    position: relative;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50px;
    right: 50px;
    height: 3px;
    background: var(--border);
    z-index: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.wizard-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.wizard-step.active .wizard-step-number {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.wizard-step.completed .wizard-step-number {
    background: var(--success);
    color: white;
}

.wizard-step-label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
}

.wizard-step.active .wizard-step-label {
    color: var(--primary);
    font-weight: 600;
}

/* =====================================================
   Wizard Panels
   ===================================================== */
.wizard-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.wizard-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wizard-panel h5 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* =====================================================
   Selection Cards
   ===================================================== */
.selection-card {
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border) !important;
    height: 100%;
    border-radius: var(--radius) !important;
    position: relative;
}

.selection-card:hover {
    border-color: var(--primary) !important;
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.selection-card.selected {
    border-color: var(--primary) !important;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
}

.selection-card .card-body {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
}

.selection-card .card-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.selection-card .price-tag {
    font-size: 1.25rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: auto;
    margin-bottom: 0;
}

.selection-card .text-primary {
    color: var(--primary) !important;
}

/* Icône d'aide sur les types de développement */
.dev-type-help {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: help;
    z-index: 10;
    transition: var(--transition);
}

.dev-type-help:hover {
    color: var(--primary);
}

/* =====================================================
   Options
   ===================================================== */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    transition: var(--transition);
    cursor: pointer;
    background: var(--white);
}

.option-item:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.02);
}

.option-item.selected,
.option-item:has(input:checked) {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
}

.option-item .form-check-input {
    margin-right: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
}

.option-item .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.option-item .option-price {
    font-weight: 600;
    color: var(--primary);
}

/* =====================================================
   Summary Card
   ===================================================== */
.summary-card {
    position: sticky;
    top: 6rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item.total {
    font-size: 1.125rem;
    font-weight: bold;
    border-top: 2px solid var(--primary);
    margin-top: 0.5rem;
    padding-top: 1rem;
    color: var(--text-dark);
}

.summary-item.total.text-success {
    color: var(--success) !important;
}

.summary-item.recurring {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* =====================================================
   Price Animation
   ===================================================== */
.price-animate {
    transition: var(--transition);
}

.price-animate.updating {
    transform: scale(1.05);
    color: var(--success);
}

/* =====================================================
   Wizard Navigation
   ===================================================== */
.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* =====================================================
   Buttons (surcharges Bootstrap)
   ===================================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%) !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-outline-secondary {
    border: 2px solid var(--border) !important;
    color: var(--text) !important;
}

.btn-outline-secondary:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: rgba(59, 130, 246, 0.05) !important;
}

.btn-outline-primary {
    border: 2px solid var(--primary) !important;
    color: var(--primary) !important;
}

.btn-outline-primary:hover {
    background: var(--primary) !important;
    color: var(--white) !important;
}

/* =====================================================
   Forms (surcharges Bootstrap)
   ===================================================== */
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    background: var(--background-alt);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--white);
}

/* =====================================================
   Modal (surcharges Bootstrap)
   ===================================================== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-header.bg-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%) !important;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* =====================================================
   Loading Overlay
   ===================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.spinner-border {
    color: var(--primary) !important;
}

/* =====================================================
   Admin Layout - Compensation navbar fixe
   ===================================================== */
.container-fluid:has(.admin-sidebar) {
    padding-top: 80px;
}

/* Fallback pour navigateurs sans :has() */
body:has(.admin-sidebar) main.col-md-9,
body:has(.admin-sidebar) .container-fluid {
    padding-top: 80px;
}

/* =====================================================
   Admin Sidebar
   ===================================================== */
.admin-sidebar {
    position: fixed;
    top: 80px;
    left: 0;
    width: 16.666667%; /* col-lg-2 */
    height: calc(100vh - 80px);
    background: linear-gradient(180deg, var(--secondary) 0%, #1e293b 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    z-index: 100;
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .admin-sidebar {
        width: 25%; /* col-md-3 */
    }
}

@media (max-width: 767.98px) {
    .admin-sidebar {
        position: relative;
        top: 0;
        width: 100%;
        height: auto;
        min-height: auto;
    }

    .container-fluid:has(.admin-sidebar) {
        padding-top: 80px;
    }
}

.admin-sidebar .position-sticky {
    position: relative !important;
    top: 0 !important;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.875rem 1.25rem;
    border-left: 3px solid transparent;
    transition: var(--transition);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.admin-sidebar .nav-link i {
    font-size: 1.1rem;
}

.admin-sidebar .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: rgba(59, 130, 246, 0.5);
}

.admin-sidebar .nav-link.active {
    color: white;
    background: rgba(59, 130, 246, 0.15);
    border-left-color: var(--primary);
    font-weight: 500;
}

/* =====================================================
   Admin Main Content
   ===================================================== */
.admin-sidebar ~ main,
main.col-md-9.ms-sm-auto {
    margin-left: 16.666667% !important;
    padding: 0 1.5rem 2rem !important;
    min-height: calc(100vh - 80px);
    background: var(--background-alt);
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .admin-sidebar ~ main,
    main.col-md-9.ms-sm-auto {
        margin-left: 25% !important;
    }
}

@media (max-width: 767.98px) {
    .admin-sidebar ~ main,
    main.col-md-9.ms-sm-auto {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Admin page header */
main .border-bottom {
    border-color: var(--border) !important;
    padding-bottom: 1rem !important;
    margin-bottom: 1.5rem !important;
}

main .border-bottom .h2,
main .border-bottom h1.h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

/* =====================================================
   Admin Stats Cards
   ===================================================== */
.row.g-4.mb-4 .card {
    border: none;
    border-radius: var(--radius);
    overflow: hidden;
}

.row.g-4.mb-4 .card.bg-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
}

.row.g-4.mb-4 .card.bg-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%) !important;
}

.row.g-4.mb-4 .card.bg-info {
    background: linear-gradient(135deg, var(--accent) 0%, #0891b2 100%) !important;
}

.row.g-4.mb-4 .card.bg-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%) !important;
}

.row.g-4.mb-4 .card .card-body {
    padding: 1.25rem;
}

.row.g-4.mb-4 .card h6 {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.row.g-4.mb-4 .card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.row.g-4.mb-4 .card i.fs-1 {
    font-size: 2.5rem !important;
}

/* =====================================================
   Tables (surcharges Bootstrap)
   ===================================================== */
.table {
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0;
}

.table thead th {
    background: var(--background-alt);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-color: var(--border);
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.04);
}

/* =====================================================
   Admin Cards & Accordions
   ===================================================== */
.accordion-item {
    border: 1px solid var(--border);
    margin-bottom: 0.75rem;
    border-radius: var(--radius) !important;
    overflow: hidden;
}

.accordion-button {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
    background: var(--white);
    padding: 1rem 1.25rem;
}

.accordion-button:not(.collapsed) {
    background: var(--background-alt);
    color: var(--primary);
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: var(--primary);
}

.accordion-body {
    padding: 0;
}

/* Admin forms in tables */
.table .input-group-sm .form-control {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
}

.table .btn-sm {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

.table code {
    background: var(--background-alt);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--primary-dark);
}

/* Form switches in admin */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-switch .form-check-input {
    width: 2.5rem;
    height: 1.25rem;
}

/* Alert improvements */
.alert {
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Modal improvements */
.modal-header {
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: var(--background-alt);
}

/* =====================================================
   Status Badges
   ===================================================== */
.badge {
    padding: 0.5em 0.75em;
    font-weight: 500;
    border-radius: 50px;
}

/* Statuts en français */
.status-brouillon { background-color: var(--text-light) !important; color: white !important; }
.status-envoyé { background-color: var(--accent) !important; color: white !important; }
.status-accepté { background-color: var(--success) !important; color: white !important; }
.status-rejeté { background-color: var(--danger) !important; color: white !important; }

/* Fallback statuts anglais */
.status-draft { background-color: var(--text-light) !important; color: white !important; }
.status-sent { background-color: var(--accent) !important; color: white !important; }
.status-accepted { background-color: var(--success) !important; color: white !important; }
.status-rejected { background-color: var(--danger) !important; color: white !important; }

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 992px) {
    .summary-card {
        position: static;
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    .wizard-steps {
        flex-wrap: wrap;
    }

    .wizard-steps::before {
        display: none;
    }

    .wizard-step {
        flex: 0 0 33.333%;
        margin-bottom: 1rem;
    }

    .wizard-step-label {
        font-size: 0.7rem;
    }

    .main-content {
        padding: 2rem 0;
    }
}

@media (max-width: 480px) {
    .wizard-step {
        flex: 0 0 50%;
    }

    .card-body {
        padding: 1rem;
    }
}

/* =====================================================
   Admin Footer adjustment
   ===================================================== */
body:has(.admin-sidebar) footer,
.container-fluid:has(.admin-sidebar) ~ footer {
    margin-left: 16.666667%;
}

@media (min-width: 768px) and (max-width: 991.98px) {
    body:has(.admin-sidebar) footer {
        margin-left: 25%;
    }
}

@media (max-width: 767.98px) {
    body:has(.admin-sidebar) footer {
        margin-left: 0;
    }
}

/* =====================================================
   Print Styles
   ===================================================== */
@media print {
    .wizard-nav,
    .no-print,
    .admin-sidebar {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .summary-card {
        position: static;
        box-shadow: none;
        border: 1px solid #000;
    }

    main.col-md-9.ms-sm-auto {
        margin-left: 0 !important;
        width: 100% !important;
    }
}
