/**
 * NVS Pointage - Design System Moderne
 * Inspiré des meilleurs SaaS : Stripe, Linear, Vercel, Notion
 * Palette professionnelle : Bleu, Blanc, Gris
 */

/* ===== Variables CSS - Design System Moderne ===== */
:root {
    /* Couleurs Primaires - Bleu professionnel */
    --primary: #0066FF;
    --primary-dark: #0052CC;
    --primary-light: #3385FF;
    --primary-lighter: #E6F2FF;
    
    /* Couleurs Neutres - Gris moderne */
    --gray-50: #FAFBFC;
    --gray-100: #F4F6F8;
    --gray-200: #E7EBF0;
    --gray-300: #D1D8E0;
    --gray-400: #A8B4C0;
    --gray-500: #6B7789;
    --gray-600: #4A5568;
    --gray-700: #2D3748;
    --gray-800: #1A202C;
    --gray-900: #0D1117;
    
    /* Couleurs Sémantiques */
    --success: #00C853;
    --success-light: #E8F5E9;
    --danger: #FF3B30;
    --danger-light: #FFEBEE;
    --warning: #FF9500;
    --warning-light: #FFF4E6;
    --info: #0066FF;
    --info-light: #E6F2FF;
    
    /* Background */
    --bg-primary: #FFFFFF;
    --bg-secondary: var(--gray-50);
    --bg-tertiary: var(--gray-100);
    
    /* Text */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    --text-disabled: var(--gray-400);
    
    /* Borders */
    --border-light: var(--gray-200);
    --border-medium: var(--gray-300);
    
    /* Shadows - Subtiles et modernes */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* Dark mode - Optionnel pour le futur */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: var(--gray-900);
        --bg-secondary: var(--gray-800);
        --bg-tertiary: var(--gray-700);
        --text-primary: var(--gray-50);
        --text-secondary: var(--gray-300);
        --text-tertiary: var(--gray-400);
        --border-light: var(--gray-700);
        --border-medium: var(--gray-600);
    }
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }

/* ===== Layout ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-6);
}

.main-content {
    padding: 0;
}

/* ===== Header ===== */
.header {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.user-info {
    padding: var(--space-2) var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ===== Navigation Tabs ===== */
.nav-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-8);
    background: var(--bg-primary);
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow-x: auto;
}

.nav-tab {
    padding: var(--space-3) var(--space-5);
    background: transparent;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ===== Sections ===== */
.section {
    margin-bottom: var(--space-8);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-6);
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: var(--space-1);
    font-weight: 400;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-6);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    margin-top: var(--space-6);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--bg-primary);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    position: relative;
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-icon {
    font-size: 24px;
    margin-bottom: var(--space-3);
    opacity: 0.8;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Boutons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: var(--font-sans);
}

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

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #E62E25;
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    padding: 10px;
    min-width: 40px;
}

/* ===== Formulaires ===== */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-lighter);
}

.form-control::placeholder {
    color: var(--text-disabled);
}

.form-inline {
    display: flex;
    gap: var(--space-3);
    align-items: flex-end;
}

.form-inline .form-group {
    flex: 1;
    margin-bottom: 0;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ===== Alertes ===== */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
    border-left: 3px solid;
}

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

.alert-success {
    background: var(--success-light);
    color: #2E7D32;
    border-color: var(--success);
}

.alert-error {
    background: var(--danger-light);
    color: #C62828;
    border-color: var(--danger);
}

/* ===== Tableaux ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--border-light);
}

th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: all 0.15s ease;
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

td {
    padding: var(--space-4);
    font-size: 14px;
    color: var(--text-primary);
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-primary {
    background: var(--primary-lighter);
    color: var(--primary);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

/* ===== Animations ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.95;
        transform: scale(1.01);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== Clients Grid ===== */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

.client-card {
    background: var(--bg-primary);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.client-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.client-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.client-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.client-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.client-actions {
    display: flex;
    gap: var(--space-2);
}

.client-actions .btn {
    flex: 1;
    font-size: 13px;
    padding: 8px 16px;
}

/* ===== Pointage Actif ===== */
.active-pointage {
    background: linear-gradient(135deg, var(--success) 0%, #00B84A 100%);
    color: white;
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.active-pointage::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 2px, transparent 2px);
    background-size: 30px 30px;
    animation: drift 20s linear infinite;
    opacity: 0.3;
}

@keyframes drift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(50px, 50px) rotate(360deg); }
}

.pointage-status {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    position: relative;
    z-index: 1;
}

.status-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.pointage-time {
    margin: var(--space-1) 0;
    font-size: 14px;
    opacity: 0.95;
}

.pointage-duration {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: var(--space-2) 0;
}

.pointage-form {
    margin-top: var(--space-6);
    position: relative;
    z-index: 1;
}

.pointage-form .form-control {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
}

/* ===== Liste Pointages ===== */
.pointages-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.pointage-item {
    padding: var(--space-5);
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.pointage-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-light);
}

.pointage-date {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    font-size: 15px;
}

.pointage-details {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.pointage-time-range {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.time-badge {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 13px;
    font-family: var(--font-mono);
}

.time-badge.start {
    color: var(--success);
    border-color: var(--success);
    background: var(--success-light);
}

.time-badge.end {
    color: var(--danger);
    border-color: var(--danger);
    background: var(--danger-light);
}

.separator {
    color: var(--text-tertiary);
    font-weight: 500;
}

.pointage-duration {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.pointage-notes {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    font-style: italic;
}

/* ===== Page Login - Ultra Moderne ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-6);
    background: linear-gradient(135deg, #F5F7FA 0%, #C3CFE2 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 102, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 200, 83, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: white;
    padding: var(--space-10);
    border-radius: var(--radius-xl);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
}

.login-card h1 {
    text-align: center;
    margin-bottom: var(--space-2);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    font-size: 14px;
}

.login-card .form-group {
    margin-bottom: var(--space-5);
}

.login-card .btn-primary {
    width: 100%;
    margin-top: var(--space-2);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-secondary);
}

.empty-state::before {
    content: '📋';
    font-size: 48px;
    display: block;
    margin-bottom: var(--space-4);
    opacity: 0.4;
}

.help-text {
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
    font-size: 14px;
    line-height: 1.6;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .clients-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--space-4);
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-4);
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .clients-grid {
        grid-template-columns: 1fr;
    }
    
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .card {
        padding: var(--space-5);
    }
    
    .pointage-details {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .login-card {
        padding: var(--space-8) var(--space-6);
    }
}

@media (max-width: 480px) {
    .stat-value {
        font-size: 28px;
    }
    
    .btn-large {
        padding: 12px 24px;
        font-size: 15px;
    }
}
