/**
 * STYLES D'AUTHENTIFICATION
 * ==========================
 * Pages de connexion, profil et administration
 * Design moderne et responsive (mobile, tablette, desktop)
 */

/* ================================================
   VARIABLES CSS POUR AUTH (standalone)
   ================================================ */
.auth-container,
.auth-body {
    --primary: #0066FF;
    --primary-hover: #0052CC;
    --primary-light: #E6F0FF;
    --bg-card: #FFFFFF;
    --bg-page: #F9FAFB;
    --bg-hover: #F3F4F6;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
}

.auth-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================================
   AUTH CONTAINER
   ================================================ */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
    position: relative;
}

/* Subtle pattern overlay */
.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(0, 102, 255, 0.03) 1px, transparent 0);
    background-size: 40px 40px;
    pointer-events: none;
}

/* ================================================
   AUTH CARD - Design moderne et clair
   ================================================ */
.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 20px 25px -5px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    animation: cardAppear 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 1;
}

.auth-card-wide {
    max-width: 520px;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ================================================
   AUTH HEADER
   ================================================ */
.auth-header {
    text-align: center;
    margin-bottom: 36px;
}

.auth-logo {
    max-width: 220px;
    height: auto;
    margin-bottom: 20px;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.auth-header p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ================================================
   AUTH FORM
   ================================================ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.form-group input,
.form-group select {
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all var(--transition);
    width: 100%;
    box-sizing: border-box;
}

.form-group input:hover,
.form-group select:hover {
    border-color: #D1D5DB;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.12);
}

.form-group input:disabled {
    background: var(--bg-page);
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: var(--border-light);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

/* ================================================
   PASSWORD INPUT
   ================================================ */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.toggle-password:hover {
    color: var(--text-secondary);
}

.eye-icon {
    width: 20px;
    height: 20px;
}

/* ================================================
   FORM MESSAGES
   ================================================ */
.form-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-left: 4px solid #EF4444;
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 14px;
    color: #DC2626;
    display: none;
    animation: shake 0.4s ease;
}

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

.form-message {
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    display: none;
}

.message-success {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    border-left: 4px solid #10B981;
    color: #065F46;
}

.message-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-left: 4px solid #EF4444;
    color: #DC2626;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-decoration: none;
    letter-spacing: -0.01em;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 102, 255, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: #D1D5DB;
}

.btn-danger {
    background: #DC2626;
    color: white;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover:not(:disabled) {
    background: #B91C1C;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-full {
    width: 100%;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: #D1D5DB;
}

.btn-icon.delete-user:hover {
    background: #FEF2F2;
    color: #DC2626;
    border-color: #FECACA;
}

.btn-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================================
   AUTH LINKS & FOOTER
   ================================================ */
.auth-links {
    margin-top: 28px;
    text-align: center;
}

.auth-link {
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.auth-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.auth-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.fdlabs-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    padding: 8px 16px;
    border-radius: var(--radius);
}

.fdlabs-link:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

.copyright {
    font-size: 12px;
    color: var(--text-muted);
}

/* ================================================
   SIDEBAR FOOTER (FDLabs)
   ================================================ */
.sidebar-footer {
    border-top: 1px solid var(--sidebar-border, #E5E7EB);
    padding: 16px 20px;
    margin-top: auto;
}

.fdlabs-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-sidebar-muted, #6B7280);
    text-decoration: none;
    font-size: 12px;
    transition: color var(--transition-fast);
}

.fdlabs-sidebar-link:hover {
    color: var(--text-sidebar, #374151);
}

/* ================================================
   USER MENU
   ================================================ */
.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.user-menu-trigger:hover {
    background: var(--bg-hover);
    border-color: #D1D5DB;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #0052CC 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.user-menu-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-menu-arrow {
    color: var(--text-muted);
    transition: transform var(--transition);
}

.user-menu.open .user-menu-arrow {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.user-menu.open .user-menu-dropdown {
    display: block;
    animation: dropdownAppear 0.2s ease;
}

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

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
}

.user-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-menu-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.user-menu-item:hover svg {
    opacity: 1;
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.user-menu-logout:hover {
    color: #DC2626;
    background: #FEF2F2;
}

/* ================================================
   PROFILE PAGE
   ================================================ */
.profile-page {
    animation: fadeIn 0.4s ease;
}

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

.profile-header {
    margin-bottom: 32px;
}

.profile-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.profile-header p {
    font-size: 15px;
    color: var(--text-secondary);
}

.profile-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-status {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 100px;
}

.status-success {
    background: #ECFDF5;
    color: #059669;
}

.status-warning {
    background: #FEF3C7;
    color: #D97706;
}

.section-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
}

.role-admin {
    background: #EEF2FF;
    color: #4338CA;
}

.role-employee {
    background: #F0FDF4;
    color: #15803D;
}

/* ================================================
   ADMIN PAGE
   ================================================ */
.admin-page {
    animation: fadeIn 0.4s ease;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.admin-title h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.admin-title p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Users Table */
.users-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
}

.users-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.users-table tbody tr:last-child td {
    border-bottom: none;
}

.users-table tbody tr {
    transition: background var(--transition-fast);
}

.users-table tbody tr:hover {
    background: var(--bg-page);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, #0052CC 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-email {
    font-size: 13px;
    color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #ECFDF5;
    color: #059669;
}

.status-inactive {
    background: #FEF2F2;
    color: #DC2626;
}

.security-status {
    font-size: 13px;
    font-weight: 500;
}

.security-ok {
    color: #059669;
}

.security-missing {
    color: #DC2626;
}

.last-login {
    font-size: 13px;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* ================================================
   MODALS
   ================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: overlayAppear 0.2s ease;
}

@keyframes overlayAppear {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-large {
    max-width: 600px;
}

.modal-small {
    max-width: 400px;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.modal-close {
    background: var(--bg-page);
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
}

.modal-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid var(--border);
    background: var(--bg-page);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.warning-text {
    color: #DC2626;
    font-size: 14px;
    margin-top: 12px;
    font-weight: 500;
}

/* Security Questions Group */
.security-question-group {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.security-question-group:last-of-type {
    margin-bottom: 0;
}

.security-question-group h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
}

.security-question-group .form-group {
    margin-bottom: 12px;
}

.security-question-group .form-group:last-child {
    margin-bottom: 0;
}

.question-select {
    width: 100%;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Password Expiry Notice */
.password-expiry-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    border-radius: var(--radius);
    font-size: 13px;
    color: #92400E;
    line-height: 1.5;
}

.password-expiry-notice svg {
    flex-shrink: 0;
    color: #D97706;
    margin-top: 1px;
}

.password-expiry-notice strong {
    font-weight: 600;
}

/* Password Requirements */
.password-requirements {
    margin-top: 8px;
    padding: 12px 14px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.password-requirements .requirements-title {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.password-requirements ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
    color: var(--text-secondary);
    line-height: 1.8;
}

.password-requirements li {
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color var(--transition-fast);
}

.password-requirements li .req-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.password-requirements li.requirement-met {
    color: #059669;
}

.password-requirements li.requirement-met .req-icon {
    background: #10B981;
    color: white;
}

.password-requirements li.requirement-unmet {
    color: var(--text-secondary);
}

/* Eye icons for password toggle */
.eye-icon {
    width: 20px;
    height: 20px;
}

.toggle-password .eye-closed {
    display: none;
}

/* ================================================
   ADMIN & AUDIT PAGE FILTERS
   ================================================ */
.admin-actions,
.audit-actions {
    display: flex;
    gap: 12px;
}

.admin-filters,
.audit-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.audit-page {
    animation: fadeIn 0.4s ease;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select,
.filter-input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    min-width: 200px;
    transition: border-color var(--transition-fast);
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary);
}

.audit-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
}

.audit-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
}

.audit-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.audit-table tbody tr:last-child td {
    border-bottom: none;
}

.audit-table tbody tr {
    transition: background var(--transition-fast);
}

.audit-table tbody tr:hover {
    background: var(--bg-page);
}

.log-date {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.log-admin {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.log-details {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.action-badge svg {
    flex-shrink: 0;
}

.action-create-user {
    background: #ECFDF5;
    color: #059669;
}

.action-update-user {
    background: #EEF2FF;
    color: #4338CA;
}

.action-delete-user {
    background: #FEF2F2;
    color: #DC2626;
}

.action-reset-password {
    background: #FEF3C7;
    color: #D97706;
}

.no-data {
    text-align: center;
    padding: 40px 20px !important;
    color: var(--text-muted);
    font-size: 14px;
}

/* ================================================
   SETUP ALERT MODAL
   ================================================ */
.setup-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
    animation: overlayAppear 0.2s ease;
}

.setup-alert {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.setup-alert-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.setup-alert h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.setup-alert p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
}

.setup-alert .btn {
    min-width: 160px;
}

/* Force setup modals - Cannot be dismissed */
.force-setup-modal {
    cursor: default;
}

.force-setup-modal .modal {
    cursor: default;
}

.force-setup-modal .modal-header {
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-card) 100%);
}

.force-setup-modal .modal-header h2 {
    color: var(--primary);
}

/* ================================================
   RESPONSIVE - TABLET
   ================================================ */
@media (max-width: 1024px) {
    .auth-card {
        padding: 40px 32px;
    }
}

/* ================================================
   RESPONSIVE - MOBILE
   ================================================ */
@media (max-width: 768px) {
    .auth-container {
        padding: 24px 16px;
        justify-content: flex-start;
        padding-top: 60px;
    }

    .auth-card {
        padding: 32px 24px;
        max-width: 100%;
    }

    .auth-header h1 {
        font-size: 24px;
    }

    .auth-header p {
        font-size: 14px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .form-group input,
    .form-group select {
        padding: 16px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }

    .btn {
        padding: 16px 24px;
        font-size: 16px;
    }

    .auth-footer {
        margin-top: 32px;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .admin-header .btn {
        width: 100%;
    }

    .users-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .users-table {
        min-width: 700px;
    }

    .user-menu-name {
        display: none;
    }

    .user-menu-trigger {
        padding: 8px 10px;
    }

    .modal {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }

    .modal-header {
        padding: 20px 20px 16px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 16px 20px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .profile-section {
        padding: 20px;
    }
}

/* ================================================
   RESPONSIVE - SMALL MOBILE
   ================================================ */
@media (max-width: 480px) {
    .auth-container {
        padding: 16px;
        padding-top: 40px;
    }

    .auth-card {
        padding: 28px 20px;
        border-radius: var(--radius-lg);
    }

    .auth-header {
        margin-bottom: 28px;
    }

    .auth-header h1 {
        font-size: 22px;
    }

    .auth-form {
        gap: 16px;
    }

    .form-group {
        gap: 6px;
    }

    .auth-footer {
        margin-top: 28px;
        padding-top: 20px;
    }

    .fdlabs-link {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .security-question-group {
        padding: 16px;
    }
}

/* ================================================
   TOUCH DEVICE OPTIMIZATIONS
   ================================================ */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    .btn-primary:hover:not(:disabled) {
        transform: none;
    }

    .form-group input:hover,
    .form-group select:hover {
        border-color: var(--border);
    }
}

/* ================================================
   PAGE ANALYTICS (STATISTIQUES)
   ================================================ */
.analytics-page {
    animation: fadeIn 0.4s ease;
}

/* Cartes de statistiques */
.analytics-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: box-shadow var(--transition);
}

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

.analytics-card-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.analytics-card-content {
    flex: 1;
    min-width: 0;
}

.analytics-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.analytics-card-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 4px;
}

.analytics-card-period {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Sections analytiques */
.analytics-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.analytics-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

/* Grille de données */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.analytics-section-small {
    margin-bottom: 0;
}

/* Graphique en barres */
.analytics-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding: 20px 10px 0;
    gap: 8px;
}

.chart-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 80px;
    height: 100%;
}

.chart-bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(180deg, var(--primary) 0%, #0052CC 100%);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    min-height: 20px;
    transition: height 0.3s ease;
}

.chart-bar-value {
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.chart-bar-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 8px;
    text-transform: capitalize;
}

.chart-bar-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Tableaux analytiques */
.analytics-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
}

.analytics-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
}

.analytics-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.analytics-table tbody tr:last-child td {
    border-bottom: none;
}

.analytics-table tbody tr {
    transition: background var(--transition-fast);
}

.analytics-table tbody tr:hover {
    background: var(--bg-page);
}

/* Badges de type de page */
.page-type-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.page-type-home {
    background: #ECFDF5;
    color: #059669;
}

.page-type-guide {
    background: #EEF2FF;
    color: #4338CA;
}

.page-type-profile {
    background: #FEF3C7;
    color: #D97706;
}

.page-type-admin {
    background: #FEE2E2;
    color: #DC2626;
}

.page-type-audit {
    background: #F3E8FF;
    color: #7C3AED;
}

.page-type-analytics {
    background: #CFFAFE;
    color: #0891B2;
}

/* Statistiques par appareil */
.device-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.device-stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.device-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.device-count {
    font-size: 13px;
    color: var(--text-secondary);
}

.device-bar {
    height: 8px;
    background: var(--bg-page);
    border-radius: 100px;
    overflow: hidden;
}

.device-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #0052CC 100%);
    border-radius: 100px;
    transition: width 0.3s ease;
}

/* Responsive Analytics */
@media (max-width: 1200px) {
    .analytics-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .analytics-cards {
        grid-template-columns: 1fr;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .analytics-card {
        padding: 20px;
    }

    .analytics-card-value {
        font-size: 24px;
    }

    .analytics-chart {
        height: 160px;
        padding: 16px 5px 0;
    }

    .chart-bar {
        max-width: 30px;
    }

    .chart-bar-value {
        font-size: 10px;
    }

    .chart-bar-label {
        font-size: 10px;
    }

    .chart-bar-date {
        font-size: 9px;
    }

    .analytics-table {
        min-width: 400px;
    }
}
