/**
 * ========================================
 * PAYROLL APP - Styles CSS
 * Design moderne et professionnel
 * ========================================
 */

:root {
    --primary: #58a84a;
    --primary-dark: #4a8f3f;
    --success: #6dbd5a;
    --warning: #f59e0b;
    --error: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-900);
    background: var(--gray-50);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* ========================================
   EN-TÊTE
   ======================================== */

.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-ai {
    background: linear-gradient(135deg, #58a84a 0%, #4a8f3f 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(88, 168, 74, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 168, 74, 0.4);
}

.btn-ai:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   NAVIGATION
   ======================================== */

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: white;
    padding: 0.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.tab {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
}

.tab:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.tab.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* ========================================
   CONTENU
   ======================================== */

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

/* ========================================
   DASHBOARD
   ======================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.5rem;
}

/* ========================================
   TABLEAUX
   ======================================== */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gray-50);
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}

tbody tr:hover {
    background: var(--gray-50);
}

/* ========================================
   BOUTONS
   ======================================== */

.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-brouillon {
    background: var(--gray-200);
    color: var(--gray-700);
}

.badge-confirme {
    background: #d1fae5;
    color: #065f46;
}

/* ========================================
   MODALS
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.2s ease-out;
}

.modal-content.large {
    max-width: 900px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.close {
    font-size: 2rem;
    font-weight: 300;
    color: var(--gray-600);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: var(--gray-900);
}

.modal form {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ========================================
   FORMULAIRES
   ======================================== */

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

small {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* ========================================
   APERÇU CALCULS
   ======================================== */

.apercu-calculs {
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
}

.calculs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.calcul-value {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.anomalies {
    margin-bottom: 1rem;
}

.anomalie {
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.anomalie-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.anomalie-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--error);
}

/* ========================================
   FILTRES
   ======================================== */

.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filters select {
    min-width: 200px;
}

/* ========================================
   UTILITAIRES
   ======================================== */

.text-muted {
    color: var(--gray-600);
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.text-center {
    text-align: center;
}

/* ========================================
   PÉRIODES AUTOMATIQUES
   ======================================== */

#prochaines-periodes {
    background: #f0fdf4;
    border-left: 4px solid #58a84a;
    margin: 1.5rem 0;
}

#prochaines-periodes h3 {
    color: #4a8f3f;
    margin-bottom: 1rem;
}

#prochaines-periodes table {
    background: white;
    margin: 1rem 0;
}

#prochaines-periodes th {
    background: #58a84a;
    color: white;
    font-size: 0.85rem;
}

#prochaines-periodes td {
    font-size: 0.85rem;
}

#prochaines-periodes tr:hover {
    background: #f9fafb;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
}

/* ========================================
   IMPRESSION
   ======================================== */

@media print {
    .header-actions,
    .tabs,
    .btn,
    .card-header button,
    .modal {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}
/* ========================================
   RAPPORTS
   ======================================== */

.report-table {
    font-size: 0.9rem;
}

.report-table th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    text-align: left;
}

.report-table .total-row {
    background: var(--gray-100);
    font-weight: 600;
    border-top: 2px solid var(--primary);
}

.releve-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.releve-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.releve-section:last-child {
    border-bottom: none;
}

.releve-section h5 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.releve-table {
    width: 100%;
    margin-top: 0.5rem;
}

.releve-table td {
    padding: 0.5rem;
    border: none;
}

.releve-table tr {
    border-bottom: 1px solid var(--gray-100);
}

.releve-table tr:last-child {
    border-bottom: none;
}
/* ========================================
   SECTIONS FORMULAIRES
   ======================================== */

.form-section-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary);
    margin: 1.5rem 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

label:has(input[type="checkbox"]) {
    cursor: pointer;
    font-weight: normal;
}

/* ========================================
   NOTIFICATIONS TOAST
   ======================================== */

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 500px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease-in-out;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    background: linear-gradient(135deg, #6dbd5a 0%, #58a84a 100%);
    color: white;
    border-left: 4px solid #4a8f3f;
}

.toast-error {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    color: white;
    border-left: 4px solid #dc2626;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

/* ========================================
   WIZARD / ASSISTANT
   ======================================== */

.wizard-step {
    margin-bottom: 30px;
}

.wizard-step:not(.active) {
    opacity: 0.5;
    pointer-events: none;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-200);
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
}

.step-header h3 {
    color: var(--gray-700);
    font-size: 20px;
    margin: 0;
}

.step-content {
    padding: 20px;
}

.wizard-select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    background: white;
    transition: border-color 0.2s;
}

.wizard-select:focus {
    outline: none;
    border-color: var(--primary);
}

.wizard-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

