/* ===================================
   Variables globales
   =================================== */
:root {
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-light: #f7fafc;
    --card-bg: #ffffff;
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #64748b;
    --secondary-dark: #475569;
    --success: #10b981;
    --success-dark: #059669;
    --error: #ef4444;
    --error-dark: #dc2626;
    --warning: #f59e0b;
    --info: #3b82f6;
    --text-dark: #1a202c;
    --text-medium: #475569;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --border: #e2e8f0;
    --border-focus: #667eea;
    --shadow: 0 8px 32px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.2s ease;
}

/* ===================================
   Reset et base
   =================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

body.light-bg {
    background: var(--bg-light);
}

/* ===================================
   Layout
   =================================== */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.container-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.container-narrow {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===================================
   Cards
   =================================== */
.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

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

.card-compact {
    padding: 1.5rem;
}

.card-glass {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
}

/* ===================================
   Typography
   =================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

h1 {
    font-size: 2rem;
    text-align: center;
}

h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-medium);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ===================================
   Buttons
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.8rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: white;
    background: var(--primary);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-secondary {
    background: var(--secondary);
    box-shadow: 0 4px 15px rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-success {
    background: var(--success);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-danger {
    background: var(--error);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--error-dark);
}

.btn-small {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ===================================
   Forms
   =================================== */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-medium);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ===================================
   Tables
   =================================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f8fafc;
    color: var(--text-medium);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: #f8fafc;
}

.table-compact th,
.table-compact td {
    padding: 0.6rem;
    font-size: 0.9rem;
}

/* ===================================
   Messages & Alerts
   =================================== */
.msg, .message, .alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 500;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

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

.msg.success, .message.success, .alert.success {
    background: #d1fae5;
    color: #065f46;
    border-color: var(--success);
}

.msg.error, .message.error, .alert.error {
    background: #fee2e2;
    color: #991b1b;
    border-color: var(--error);
}

.msg.info, .message.info, .alert.info {
    background: #dbeafe;
    color: #1e40af;
    border-color: var(--info);
}

.msg.warning, .message.warning, .alert.warning {
    background: #fef3c7;
    color: #92400e;
    border-color: var(--warning);
}

/* ===================================
   Badges & Tags
   =================================== */
.badge, .tag {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--text-medium);
}

.badge.success, .tag.success {
    background: #d1fae5;
    color: #065f46;
}

.badge.error, .tag.error {
    background: #fee2e2;
    color: #991b1b;
}

.badge.info, .tag.info {
    background: #dbeafe;
    color: #1e40af;
}

.badge.primary, .tag.primary {
    background: #ede9fe;
    color: #5b21b6;
}

/* ===================================
   Filters Section
   =================================== */
.filters {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.filters.collapsed {
    max-height: 60px;
    overflow: hidden;
}

.filters-toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.filters-toggle:hover {
    color: var(--primary-dark);
}

.filters-toggle .shortcut-hint {
    opacity: 0.6;
    font-weight: 400;
    font-size: 0.85rem;
}

.filter-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ===================================
   Stats & Metrics
   =================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===================================
   Loading States
   =================================== */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   Keyboard Hints
   =================================== */
.keyboard-hint {
    font-size: 0.75rem;
    color: var(--text-lighter);
    background: #f8fafc;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

kbd {
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-family: monospace;
    font-size: 0.7rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ===================================
   Utility Classes
   =================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex { display: flex; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ===================================
   Responsive
   =================================== */
@media (max-width: 768px) {
    .container,
    .container-wide,
    .container-narrow {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-toggle .shortcut-hint {
        display: none;
    }
    
    .keyboard-hint {
        display: none;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
}