/**
 * Design System Moderne - Evoice SaaS
 * Système de design cohérent avec variables CSS et composants harmonisés
 */

:root {
    /* Palette de couleurs principale */
    --color-primary: #667eea;
    --color-primary-dark: #5568d3;
    --color-primary-light: #8b9ef5;
    --color-secondary: #764ba2;
    --color-secondary-dark: #5d3a7e;
    --color-secondary-light: #9568c4;
    
    /* Dégradés */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-primary-hover: linear-gradient(135deg, #5568d3 0%, #5d3a7e 100%);
    --gradient-success: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-info: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-warning: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    
    /* Couleurs de texte */
    --color-text-primary: #2c3e50;
    --color-text-secondary: #6c757d;
    --color-text-muted: #95a5a6;
    --color-text-light: #ffffff;
    
    /* Couleurs de fond */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f8f9fa;
    --color-bg-tertiary: #e9ecef;
    --color-bg-dark: #2c3e50;
    
    /* Couleurs de statut */
    --color-success: #28a745;
    --color-success-light: #d4edda;
    --color-success-dark: #155724;
    --color-danger: #dc3545;
    --color-danger-light: #f8d7da;
    --color-danger-dark: #721c24;
    --color-warning: #ffc107;
    --color-warning-light: #fff3cd;
    --color-warning-dark: #856404;
    --color-info: #17a2b8;
    --color-info-light: #cce5ff;
    --color-info-dark: #004085;
    
    /* Espacements */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 1rem;      /* 16px */
    --spacing-lg: 1.5rem;    /* 24px */
    --spacing-xl: 2rem;      /* 32px */
    --spacing-xxl: 3rem;     /* 48px */
    
    /* Bordures */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    --border-radius-full: 50px;
    
    /* Ombres */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 10px 30px rgba(102, 126, 234, 0.2);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Typographie */
    --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Z-index */
    --z-sidebar: 1000;
    --z-modal: 1050;
    --z-dropdown: 1000;
    --z-tooltip: 1070;
}

/* Reset et base */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Cartes modernes */
.card-modern,
.stat-card,
.chart-container {
    background: var(--color-bg-primary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card-modern::before,
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.card-modern:hover,
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(102, 126, 234, 0.2);
}

.card-modern:hover::before,
.stat-card:hover::before {
    opacity: 1;
}

/* Icônes de statistiques */
.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--color-text-light);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-value {
    font-size: 2rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    line-height: 1.2;
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    font-size: 0.9rem;
}

/* Boutons modernes */
.btn-modern,
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--border-radius-md);
    padding: 12px 24px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-light);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.btn-modern::before,
.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-modern:hover::before,
.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-modern:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    background: var(--gradient-primary-hover);
}

.btn-modern:active,
.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary {
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    background: transparent;
    border-radius: var(--border-radius-md);
    padding: 10px 22px;
    font-weight: var(--font-weight-semibold);
    transition: all var(--transition-base);
}

.btn-outline-primary:hover {
    background: var(--color-primary);
    color: var(--color-text-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Formulaires modernes */
.form-control,
.form-select {
    border-radius: var(--border-radius-md);
    border: 2px solid var(--color-bg-tertiary);
    padding: 12px 16px;
    transition: all var(--transition-base);
    font-size: 0.95rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
    outline: none;
}

.form-label {
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
}

/* Badges de statut */
.status-badge,
.invoice-status {
    padding: 6px 14px;
    border-radius: var(--border-radius-full);
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    transition: all var(--transition-base);
}

.status-paid {
    background: linear-gradient(135deg, var(--color-success-light) 0%, #c3e6cb 100%);
    color: var(--color-success-dark);
    border: 1px solid #c3e6cb;
}

.status-sent {
    background: linear-gradient(135deg, var(--color-info-light) 0%, #b3d9ff 100%);
    color: var(--color-info-dark);
    border: 1px solid #b3d9ff;
}

.status-draft {
    background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, #dee2e6 100%);
    color: var(--color-text-secondary);
    border: 1px solid #dee2e6;
}

.status-accepted {
    background: linear-gradient(135deg, var(--color-success-light) 0%, #c3e6cb 100%);
    color: var(--color-success-dark);
    border: 1px solid #c3e6cb;
}

.status-overdue {
    background: linear-gradient(135deg, var(--color-danger-light) 0%, #f5c6cb 100%);
    color: var(--color-danger-dark);
    border: 1px solid #f5c6cb;
}

/* Alertes modernes */
.alert {
    border-radius: var(--border-radius-md);
    border: none;
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: var(--color-success-light);
    color: var(--color-success-dark);
    border-left-color: var(--color-success);
}

.alert-danger {
    background: var(--color-danger-light);
    color: var(--color-danger-dark);
    border-left-color: var(--color-danger);
}

.alert-warning {
    background: var(--color-warning-light);
    color: var(--color-warning-dark);
    border-left-color: var(--color-warning);
}

.alert-info {
    background: var(--color-info-light);
    color: var(--color-info-dark);
    border-left-color: var(--color-info);
}

/* Tableaux modernes */
.table-modern,
.invoices-table {
    background: var(--color-bg-primary);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-modern thead th,
.invoices-table thead th {
    background: linear-gradient(135deg, var(--color-bg-dark) 0%, #34495e 100%);
    color: var(--color-text-light);
    font-weight: var(--font-weight-semibold);
    border: none;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-modern tbody td,
.invoices-table tbody td {
    padding: var(--spacing-md) var(--spacing-lg);
    vertical-align: middle;
    border-bottom: 1px solid var(--color-bg-tertiary);
    transition: all var(--transition-fast);
}

.table-modern tbody tr,
.invoices-table tbody tr {
    transition: all var(--transition-fast);
}

.table-modern tbody tr:hover,
.invoices-table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Éléments récents */
.recent-item {
    border-left: 4px solid var(--color-primary);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    background: var(--color-bg-primary);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.recent-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--color-primary-dark);
}

/* Modals modernes */
.modal-content {
    border-radius: var(--border-radius-xl);
    border: none;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    background: var(--gradient-primary);
    color: var(--color-text-light);
    border-bottom: none;
    padding: var(--spacing-lg);
}

.modal-header .btn-close {
    filter: invert(1);
    opacity: 0.8;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: var(--spacing-xl);
}

.modal-footer {
    border-top: 1px solid var(--color-bg-tertiary);
    padding: var(--spacing-lg);
}

/* Page de connexion moderne */
.login-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-base);
}

.login-card:hover {
    box-shadow: 0 25px 50px rgba(102, 126, 234, 0.2);
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Utilitaires */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-hover {
    transition: box-shadow var(--transition-base);
}

.shadow-hover:hover {
    box-shadow: var(--shadow-hover);
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --spacing-lg: 1rem;
        --spacing-xl: 1.5rem;
    }
    
    .stat-card,
    .chart-container {
        padding: var(--spacing-md);
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--border-radius-sm);
    transition: background var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

/* Loading spinner moderne */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
    border-color: var(--color-primary);
    border-right-color: transparent;
}

/* Amélioration des transitions globales */
a, button, input, select, textarea {
    transition: all var(--transition-fast);
}

/* Focus visible pour l'accessibilité */
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

