/* ============================================
   Portfolio BTS SIO - Styles
   Thème clair/sombre avec palette indigo/violet
   ============================================ */

/* --- Variables de thème --- */
:root,
[data-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f1f3f9;
    --bg-input: #f4f5f9;
    --text-primary: #1a1a2e;
    --text-secondary: #555770;
    --text-muted: #8e90a6;
    --border: #e2e4ed;
    --border-light: #eef0f6;
    --accent: #38bdf8;
    --accent-hover: #0284c7;
    --accent-light: rgba(56, 189, 248, 0.1);
    --accent-secondary: #0284c7;
    --accent-secondary-light: rgba(2, 132, 199, 0.1);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: rgba(239, 68, 68, 0.1);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --gradient-primary: linear-gradient(135deg, #38bdf8, #0ea5e9);
    --glow-primary: rgba(56, 189, 248, 0.4);
    --gradient-card: linear-gradient(135deg, rgba(56, 189, 248, 0.03), rgba(14, 165, 233, 0.03));
    --navbar-bg: rgba(255, 255, 255, 0.85);
    --modal-overlay: rgba(0, 0, 0, 0.5);
    
    --btn-primary-text: #ffffff;
    --btn-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
    --btn-shadow-hover: 0 6px 20px rgba(56, 189, 248, 0.4);
}

[data-theme="dark"] {
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-hover: #2a2a2a;
    --bg-input: #2a2a2a;
    --text-primary: #e8e8e8;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border: #333333;
    --border-light: #2a2a2a;
    --accent: #ccff00;
    --accent-hover: #bbee00;
    --accent-light: rgba(204, 255, 0, 0.15);
    --accent-secondary: #bbee00;
    --accent-secondary-light: rgba(187, 238, 0, 0.15);
    --danger: #f87171;
    --danger-hover: #ef4444;
    --danger-light: rgba(248, 113, 113, 0.15);
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);
    --gradient-primary: linear-gradient(135deg, #ccff00, #bbee00);
    --glow-primary: rgba(204, 255, 0, 0.4);
    --gradient-card: linear-gradient(135deg, rgba(204, 255, 0, 0.05), rgba(187, 238, 0, 0.05));
    --navbar-bg: rgba(18, 18, 18, 0.9);
    --modal-overlay: rgba(0, 0, 0, 0.7);
    
    --btn-primary-text: #1a1a1a;
    --btn-shadow: 0 4px 15px rgba(204, 255, 0, 0.3);
    --btn-shadow-hover: 0 6px 20px rgba(204, 255, 0, 0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.3;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

/* --- Theme Toggle --- */
.theme-toggle {
    position: relative;
    background: var(--bg-card);
    border: 2px solid var(--border);
    color: var(--text-secondary);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    z-index: 100;
}

.theme-toggle:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(20deg);
}

/* --- Login Page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    overflow-x: clip;
    overflow-y: auto;
    min-height: 100svh;
    padding: 64px 0 24px;
}

.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle at 30% 40%, rgba(204, 255, 0, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(187, 238, 0, 0.06) 0%, transparent 50%);
    animation: bgPulse 15s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-5%, -5%); }
}

.login-page > .theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
}

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

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 30px 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    box-shadow: 0 8px 25px var(--glow-primary);
}

img.login-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    border-radius: 0;
    object-fit: contain;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    display: block;
}

.login-header h1 {
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group label i {
    color: var(--accent);
    font-size: 0.8rem;
}

.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-size: 0.95rem; font-family: 'Inter', sans-serif; background: var(--bg-input); color: var(--text-primary); transition: all 0.2s ease; outline: none; box-sizing: border-box; }

.form-group input:focus {
    border-color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

/* --- Modern Toggle Switch --- */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-top: 0px;
    margin-bottom: 0px;
}

.toggle-switch input {
    display: none !important;
}

.toggle-slider {
    position: relative;
    flex-shrink: 0;
    width: 46px;
    height: 26px;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-light);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background-color: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    user-select: none;
}

.password-wrapper {
    position: relative;
}

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

.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 12px;
    font-size: 1rem;
    transition: color 0.2s;
}

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

/* --- Boutons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--btn-primary-text);
    border-color: transparent;
    box-shadow: var(--btn-shadow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--btn-shadow-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

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

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

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.btn-login {
    padding: 14px;
    font-size: 1rem;
    margin-top: 4px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* --- Navbar --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--navbar-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.nav-brand img.nav-logo {
    width: 28px;
    height: 28px;
    border-radius: 0;
    object-fit: contain;
}





.nav-brand i {
    font-size: 1.3rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

$120px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-admin {
    background: var(--gradient-primary);
    color: white;
}

.badge-user {
    background: var(--accent-secondary-light);
    color: var(--accent-secondary);
}

/* --- Container & Headers --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
}

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

.page-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h1 i {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-description {
    color: var(--text-muted);
    font-size: 0.95rem;
}

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

.section-header h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--accent);
}

$120px;
}

/* --- Dropzone --- */
.upload-section {
    margin-bottom: 16px;
}

.dropzone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    background: var(--gradient-card);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.dropzone:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.dropzone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: scale(1.01);
    box-shadow: var(--shadow-md);
}

.dropzone-content {
    position: relative;
    z-index: 1;
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dropzone-content h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.dropzone-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.dropzone-hint {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    margin-top: 12px !important;
}

.dropzone-overlay {
    position: absolute;
    inset: 0;
    background: var(--accent-light);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.5rem;
    color: var(--accent);
    font-weight: 700;
    z-index: 2;
    border-radius: var(--radius-lg);
}

.dropzone.drag-over .dropzone-overlay {
    display: flex;
}

/* --- Upload Progress --- */
.upload-progress {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* --- PDF Grid --- */
.pdf-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.pdf-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    flex: 1 1 300px;
    max-width: 380px;
    width: 100%;
}

.pdf-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.pdf-card-preview {
    aspect-ratio: 16 / 9;
    height: auto;
    background: var(--gradient-card);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.pdf-card-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    transform: scale(1);
}

.pdf-card-preview .pdf-icon-fallback {
    font-size: 3.5rem;
    color: var(--accent);
    opacity: 0.6;
}

.pdf-card-preview:hover .preview-overlay {
    opacity: 1;
}

.preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.preview-overlay i {
    font-size: 2rem;
    color: white;
}

.pdf-card-body {
    padding: 16px;
}

.pdf-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.pdf-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 14px;
}

.pdf-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pdf-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pdf-card-actions .btn {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    padding: 7px 10px;
}

.btn-view {
    background: var(--accent-light);
    color: var(--accent);
    border-color: transparent;
}

.btn-view:hover {
    background: var(--accent);
    color: white;
}

.btn-download {
    background: var(--success-light);
    color: var(--success);
    border-color: transparent;
}

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

.btn-print {
    background: var(--warning-light);
    color: var(--warning);
    border-color: transparent;
}

.btn-print:hover {
    background: var(--warning);
    color: white;
}

.btn-delete {
    background: var(--danger-light);
    color: var(--danger);
    border-color: transparent;
}

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

.btn-rename {
    background: var(--accent-secondary-light);
    color: var(--accent-secondary);
    border-color: transparent;
}

.btn-rename:hover {
    background: var(--accent-secondary);
    color: white;
}

/* --- View Mode Toggle --- */
.btn-view-toggle {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.btn-view-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.btn-view-toggle.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

/* --- Admin-only elements hidden in reader view --- */
body.reader-mode .upload-section,
body.reader-mode .section-header,
body.reader-mode .admin-only {
    display: none !important;
}

/* Elements only visible in reader mode (used to hide reader stuff from admin until they toggle view) */
.reader-only {
    display: none !important;
}
body.reader-mode .reader-only {
    display: flex !important;
}

/* CV Options Dropdown */
.btn-cv-options {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    z-index: 20;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-cv-options i {
    font-size: 1rem !important; /* Override action-card i */
    color: var(--text-muted) !important;
    transition: color 0.2s ease;
}
.btn-cv-options:hover {
    background-color: var(--bg-hover);
}
.btn-cv-options:hover i {
    color: var(--text-primary) !important;
}

.cv-dropdown-menu {
    position: absolute;
    top: 45px;
    right: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    text-align: left;
    overflow: hidden;
    z-index: 30;
    display: none;
}
.cv-dropdown-menu.active {
    display: block;
}
.cv-dropdown-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: background 0.2s;
}
.cv-dropdown-btn:hover {
    background: var(--bg-hover);
}
.cv-dropdown-btn i {
    font-size: 0.95rem !important; /* Override action-card i */
    margin-right: 10px;
    width: 20px;
    text-align: center;
}
.cv-dropdown-btn .fa-pen {
    color: var(--accent) !important;
}
.cv-dropdown-btn.delete-btn {
    color: var(--danger);
    border-top: 1px solid var(--border-light);
}
.cv-dropdown-btn.delete-btn i {
    color: var(--danger) !important;
}

body.reader-mode .page-header h1 i::before {
    content: "\f518"; /* fa-book-reader */
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--modal-overlay);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 32px;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

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

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

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

.modal-large {
    width: 90%;
    max-width: 1000px;
    height: 85vh;
    transition: all 0.3s ease;
}

.modal-fullscreen {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.modal-small {
    width: 100%;
    max-width: 440px;
}

.modal-edit {
    width: 100%;
    max-width: 540px;
}

/* --- Textarea --- */
textarea {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.2s ease;
    outline: none;
    resize: vertical;
    min-height: 70px;
    width: 100%;
}

textarea:focus {
    border-color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

textarea::placeholder {
    color: var(--text-muted);
}

/* --- Thumbnail Editor --- */
.thumbnail-editor {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.thumbnail-preview {
    width: 140px;
    height: 100px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    position: relative;
}

.reposition-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
    z-index: 10;
}

.reposition-overlay i {
    font-size: 1.5rem;
}

.reposition-overlay span {
    font-size: 0.75rem;
    font-weight: 500;
}

.thumbnail-preview:hover .reposition-overlay {
    opacity: 1;
}


.thumbnail-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thumbnail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    padding: 8px;
}

.thumbnail-placeholder i {
    font-size: 1.5rem;
    opacity: 0.4;
}

.thumbnail-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thumbnail-actions .text-muted {
    font-size: 0.75rem;
}

/* --- PDF Card Description --- */
.pdf-card-description {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    font-style: italic;
}

/* --- PDF Card Thumbnail --- */
.pdf-card-preview img.card-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- Framer WYSIWYG (cadrage custom) --- */
.framer-wrapper {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-input);
}

.framer-viewport {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
    cursor: grab;
    background: #1a1a2e;
    border-bottom: 1px solid var(--border);
}

.framer-viewport:active {
    cursor: grabbing;
}

.framer-viewport img {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    user-select: none;
    pointer-events: none;
    will-change: transform;
}

.framer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-hover);
    flex-wrap: wrap;
}

.framer-controls .btn {
    padding: 5px 10px;
    font-size: 0.78rem;
}

.framer-slider {
    flex: 1;
    min-width: 80px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.framer-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.cropper-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

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

.modal-header h3 {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.close-modal:hover {
    color: var(--danger);
    background-color: var(--bg-hover);
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    flex: 1;
    overflow: auto;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-sm);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    animation: slideInRight 0.3s ease;
    min-width: 280px;
    max-width: 400px;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-success i {
    color: var(--success);
}

.toast-error i {
    color: var(--danger);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    .nav-user {
        display: none;
    }

    .container {
        padding: 20px 16px;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .pdf-grid {
        /* Géré par flex-wrap désormais */
    }

    .dropzone {
        padding: 32px 20px;
    }

    .modal-large {
        width: 100%;
        height: 95vh;
    }

    .login-card {
        padding: 28px;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Selection --- */
::selection {
    background: var(--accent-light);
    color: var(--accent);
}

/* --- Footer --- */
.site-footer { text-align: center; padding: 40px 20px; margin-top: 40px; color: var(--text-muted); font-size: 0.9rem; border-top: 1px solid var(--border); }


body:not(.login-page) { display: flex; flex-direction: column; }
body:not(.login-page) .container { flex: 1; }

/* --- Nouveau Layout avec Sidebar --- */
body:has(.app-wrapper) {
    overflow: hidden; /* Use main-content scroll instead */
    flex-direction: row;
}

.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
    background-color: var(--bg-primary);
}

.sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-profile {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.sidebar-collapse-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
    width: 30px;
    height: 30px;
    border-radius: 5px;
}
.sidebar-collapse-btn:hover {
    color: var(--accent);
    background-color: var(--bg-hover);
}

.app-wrapper.sidebar-collapsed .sidebar {
    width: 80px;
}
.app-wrapper.sidebar-collapsed .profile-name,
.app-wrapper.sidebar-collapsed .profile-role {
    display: none;
}
.app-wrapper.sidebar-collapsed .menu-item {
    font-size: 0;
    justify-content: center;
    padding: 15px 0;
}
.app-wrapper.sidebar-collapsed .menu-item span,
.app-wrapper.sidebar-collapsed .menu-text {
    display: none;
}
.app-wrapper.sidebar-collapsed .sidebar-profile {
    padding: 30px 5px;
}
.app-wrapper.sidebar-collapsed .sidebar-collapse-btn {
    position: static;
    margin: 0 auto 10px auto;
    display: block;
}

.sidebar-profile .profile-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    border-radius: 0;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.sidebar-profile .profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.profile-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.profile-role {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu {
    padding: 20px 10px;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.menu-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    transition: color 0.2s ease;
}

.menu-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    transform: translateX(5px);
}

.menu-item.active {
    background-color: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    
}

.menu-item.active i {
    color: var(--accent);
}

.menu-item.text-danger {
    color: var(--danger);
}
.menu-item.text-danger:hover {
    background-color: var(--danger-light);
    color: var(--danger-hover);
}

.sidebar-footer {
    padding: 20px 10px;
    border-top: 1px solid var(--border-light);
}

.main-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
    scroll-behavior: smooth;
}

.content-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

/* Hide old navbar */
body:has(.app-wrapper) .navbar {
    display: none !important;
}

/* Blobs décoratifs */
.blob {
    position: fixed;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    background: var(--gradient-primary);
    filter: blur(80px);
    opacity: 0.15;
    z-index: 1;
    pointer-events: none;
    animation: blobMorph 15s ease-in-out infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    bottom: -50px;
    left: 280px;
    animation-delay: -5s;
}

@keyframes blobMorph {
    0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; transform: rotate(0deg); }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: rotate(180deg); }
}

/* Home Page Centered Layout */
.home-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    text-align: center;
}

.home-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.home-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 40px;
    line-height: 1.6;
}

.home-actions-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 25px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-width: 200px;
    text-decoration: none;
    color: var(--text-primary);
}

.action-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.action-card i {
    font-size: 2.5rem;
    color: var(--accent);
}

.action-card span {
    font-weight: 600;
    font-size: 1.1rem;
}

.sidebar-collapse-btn svg {
    transition: color 0.2s ease;
}
.sidebar-collapse-btn:hover svg {
    color: var(--accent);
}



.app-wrapper.sidebar-collapsed .sidebar-menu {
    padding: 20px 5px;
}

.app-wrapper.sidebar-collapsed .sidebar-footer {
    padding: 20px 5px;
}

.app-wrapper.sidebar-collapsed .menu-item {
    justify-content: center;
    padding: 15px 0;
    margin-bottom: 10px;
    border-radius: var(--radius-md);
}

.app-wrapper.sidebar-collapsed .menu-item.active {
    border-left: none; /* Remove left border so it stays perfectly centered */
    border-bottom: 3px solid var(--accent); /* Or just keep it as a box */
}

.nav-logo {
    transition: width 0.3s ease, height 0.3s ease;
}

.app-wrapper.sidebar-collapsed .sidebar-profile .profile-avatar {
    width: 45px;
    height: 45px;
    border-radius: 0;
}
.sidebar-profile .profile-avatar {
    transition: width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
}

.app-wrapper.sidebar-collapsed .menu-item {
    gap: 0 !important;
}
.app-wrapper.sidebar-collapsed .menu-item.active {
    border: none !important;
}




/* Scroll Reveal Animations */
.reveal-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}
.reveal-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Styles pour la section Contact */
.contact-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 0 20px;
}
.contact-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-md); }
.contact-header { text-align: center; margin-bottom: 15px; }
.contact-header i { font-size: 2rem; color: var(--accent); margin-bottom: 8px; }
.contact-header h1 { font-size: 1.5rem; color: var(--text-primary); }
.contact-header p {
    color: var(--text-secondary);
    margin-top: 8px;
}
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}
.form-control { width: 100%; padding: 8px 12px; border: 2px solid var(--border); border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary); transition: border-color 0.2s; font-family: inherit; }
.form-control:focus {
    border-color: var(--accent);
    outline: none;
}
.file-drop-area { border: 2px dashed var(--border); border-radius: var(--radius-md); padding: 12px; text-align: center; background: var(--bg-input); cursor: pointer; transition: all 0.2s; }
.file-drop-area:hover, .file-drop-area.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.file-drop-area i { font-size: 1.2rem; color: var(--accent); margin-bottom: 5px; }
.file-drop-area p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
#fileList {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-hover);
    padding: 6px 12px;
    border-radius: 4px;
    margin-bottom: 4px;
}
.file-item .remove-file {
    color: var(--danger);
    cursor: pointer;
}
.btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
    margin-top: 10px;
}






/* Theme logo handling */
[data-theme="dark"] .light-logo { display: none !important; }
[data-theme="light"] .dark-logo { display: none !important; }





/* Cursor Orb */
.cursor-orb {
    position: fixed;
    top: 0;
    left: 0;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: var(--accent);
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 9999;
    will-change: transform;
    transition: opacity 0.5s ease;
}
[data-theme="dark"] .cursor-orb {
    opacity: 0.08; /* Slightly dimmer in dark mode to not be overwhelming */
}

/* Desktop auth: keep CAPTCHA input beside refresh, not on a second row. */
@media (min-width: 901px) {
    .login-page { padding: 16px 0; }
    .login-page .login-container { max-width: 500px; padding: 12px 20px; }
    .login-page .login-card { padding: 22px 32px; }
    .login-page .login-header { margin-bottom: 16px; }
    .login-page .login-form { gap: 10px; }
    .login-page .captcha-row #captcha { grid-column: 3; min-width: 0; width: 100%; }
    .login-page .login-footer { margin-top: 14px; }
}
@media (min-width: 901px) and (max-height: 720px) {
    .login-page { padding-top: 0; padding-bottom: 0; }
    .login-page .login-header img.login-logo { max-height: 72px; width: auto; }
    .login-page .login-header { margin-bottom: 10px; position: relative; padding-left: 72px; min-height: 60px; text-align: left; }
    .login-page .login-header img.login-logo { position: absolute; left: 0; top: 0; margin: 0; }
    .login-page .login-card { padding: 12px 28px; }
    .login-page .login-form { gap: 8px; }
    .login-page .form-group label { margin-bottom: 4px; }
    .login-page .login-footer { margin-top: 8px; padding-top: 8px; }
    .login-page .login-footer p { margin-bottom: 4px; }
    .login-page .login-container { padding-top: 4px; padding-bottom: 4px; }
}
/* Mobile release: scrollable auth pages and bounded application primitives. */
.login-page .form-group input { font-size: 16px; min-height: 48px; }
.login-page .login-form { gap: 14px; }
.login-page .login-form .form-group { margin-bottom: 0; }
.login-page .login-header h1 { color: var(--text-primary); background: none; -webkit-text-fill-color: currentColor; }
.login-page .login-subtitle, .login-page .login-footer { color: var(--text-secondary); }
.login-page .btn-primary { background: #0369a1; color: #fff; }
[data-theme="dark"] .login-page .btn-primary { background: var(--gradient-primary); color: var(--btn-primary-text); }
.login-page #accessTrigger { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; color: #0369a1; }
[data-theme="dark"] .login-page #accessTrigger { color: var(--accent); }
.login-page .theme-toggle, .password-toggle, .modal-close, .close-modal { width: 44px; height: 44px; flex-shrink: 0; }
.login-page .toggle-switch { min-height: 44px; position: relative; }
.login-page .toggle-switch input { display: block !important; position: absolute; opacity: 0; width: 46px; height: 44px; margin: 0; }
.login-page .toggle-switch input:focus-visible + .toggle-slider { outline: 3px solid var(--accent-secondary); outline-offset: 3px; }
.login-page :is(button, a):focus-visible { outline: 3px solid var(--accent-secondary); outline-offset: 3px; }
.captcha-row { display: grid; grid-template-columns: 140px 44px minmax(0, 1fr); gap: 8px; align-items: center; }
.captcha-row #captcha { grid-column: 1 / -1; width: 100%; }
.captcha-row img { flex-shrink: 0; }
.login-page .alert { overflow-wrap: anywhere; align-items: flex-start; }
.login-page .alert-error { color: #b91c1c; }
[data-theme="dark"] .login-page .alert-error { color: var(--danger); }
.modal-content { min-height: 0; max-height: calc(100dvh - 32px); }
.modal-header, .modal-footer { flex-shrink: 0; }
.modal-body { min-height: 0; overscroll-behavior: contain; }
.modal { padding: 16px; }
.document-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.document-options > * { min-width: 0; }
.mobile-nav-header, .mobile-nav-close, .mobile-nav-backdrop, .mobile-table-hint { display: none; }
.response-message { overflow-wrap: anywhere; color: var(--text-secondary); margin-bottom: 24px; }
.response-return { width: 100%; min-height: 44px; white-space: normal; }
.modal-fullscreen { height: 100dvh !important; max-height: 100dvh !important; }

@media (max-width: 900px) {
    [data-theme="light"] { --text-muted: #666b80; }
    [data-theme="dark"] { --text-muted: #a0a0a0; }
    [data-theme="light"] .btn-primary { background: #0369a1; color: #fff; }
    [data-theme="light"] :is(.btn-view, .btn-rename, .btn-view-toggle) { color: #0369a1; }
    [data-theme="light"] .btn-download { color: #047857; }
    [data-theme="light"] .btn-print { color: #b45309; }
    [data-theme="light"] .btn-delete { color: #b91c1c; }
    [data-theme="light"] .app-wrapper .sidebar .menu-item.active { color: #0369a1; }
    .login-container { padding: 12px 16px; }
    .login-card { padding: 24px; }
    .login-header { margin-bottom: 20px; }
    .login-header h1 { font-size: 1.3rem; }
    .login-footer { margin-top: 20px; }
    .form-group :is(input, textarea, select), .form-control, textarea { font-size: 16px; }
    .btn, .btn-icon, .btn-cv-options, .sidebar-collapse-btn { min-width: 44px; min-height: 44px; }
    .btn { white-space: normal; }
    .app-wrapper { flex-direction: column; height: 100dvh; }
    .app-wrapper .sidebar { width: 100%; flex-shrink: 0; border-right: 0; border-bottom: 1px solid var(--border); }
    .app-wrapper .sidebar-profile { display: none; }
    .app-wrapper :is(.sidebar-menu, .sidebar-footer) { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; flex-grow: 0; }
    .app-wrapper .sidebar .menu-item { width: auto; flex: 0 0 auto; font-size: 0.85rem; gap: 8px !important; padding: 10px 12px; margin: 0; min-height: 44px; }
    .app-wrapper.sidebar-collapsed .sidebar :is(.menu-text, .menu-item span) { display: inline; }
    .app-wrapper .sidebar .menu-item:hover { transform: none; }
    .app-wrapper .main-content { width: 100%; min-width: 0; min-height: 0; height: auto; padding: 24px 16px max(24px, env(safe-area-inset-bottom)); overflow-x: clip; }
    .content-container { min-width: 0; }
    .home-centered { min-height: calc(100dvh - 190px); }
    .home-title { font-size: clamp(2rem, 8vw, 3rem); overflow-wrap: anywhere; }
    [data-theme="light"] .home-title { color: var(--text-primary); background: none; -webkit-text-fill-color: currentColor; }
    .home-subtitle { font-size: 1rem; margin-bottom: 24px; }
    .action-card { min-width: 0; width: 100%; }
    .home-actions-grid { width: 100%; }
    .contact-container { padding: 0; margin: 32px auto; }
    .main-content .settings-container { padding: 0; margin: 0 auto; }
    .settings-header { flex-wrap: wrap; gap: 16px; }
    .settings-header > * { min-width: 0; max-width: 100%; }
    .settings-header > div { flex-wrap: wrap; }
    .main-content .users-table-wrapper { overflow-x: auto; max-width: 100%; }
    .mobile-table-hint { display: block; color: var(--text-secondary); font-size: 0.85rem; margin: 12px 0 -8px; }
    .users-table { min-width: 560px; }
    .users-table th, .users-table td { padding: 12px; }
    .users-table th { white-space: nowrap; }
    .modal-header, .modal-footer { padding: 12px 16px; gap: 8px; }
    .modal-header h3 { min-width: 0; }
    .modal-body { padding: 16px; }
    .modal-footer { flex-wrap: wrap; }
    .modal-large { height: calc(100dvh - 32px); }
    .thumbnail-editor { flex-wrap: wrap; }
    .document-options { grid-template-columns: minmax(0, 1fr); }
    .toggle-switch { min-height: 44px; position: relative; }
    .toggle-switch input { display: block !important; position: absolute; opacity: 0; width: 46px; height: 44px; margin: 0; }
    .toggle-switch input:focus-visible + .toggle-slider { outline: 3px solid var(--accent-secondary); outline-offset: 3px; }
    :is(button, a, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid var(--accent-secondary); outline-offset: 3px; }
    #skillsDropdownContainer .form-control { min-height: 44px; }
    #skillsSelectedText { min-width: 0; }
    .framer-slider { height: 44px; background: linear-gradient(var(--border), var(--border)) center / 100% 6px no-repeat; }
    .mobile-nav-ready .mobile-nav-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(8px, env(safe-area-inset-top)) 16px 8px; background: var(--bg-card); border-bottom: 1px solid var(--border); flex-shrink: 0; min-height: 64px; }
    .mobile-nav-ready .mobile-nav-header { position: sticky; top: 0; z-index: 104; }
    .mobile-nav-header span { font-size: 0.95rem; font-weight: 700; min-width: 0; }
    .mobile-nav-toggle, .mobile-nav-close { border: 1px solid var(--border); background: var(--bg-hover); color: var(--text-primary); border-radius: var(--radius-sm); font: inherit; cursor: pointer; min-height: 44px; min-width: 44px; padding: 8px 12px; }
    .app-wrapper.mobile-nav-ready .sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px, calc(100vw - 32px)); height: 100dvh; overflow-y: auto; overscroll-behavior: contain; z-index: 110; visibility: hidden; transform: translateX(-100%); transition: transform 0.2s ease; padding-bottom: env(safe-area-inset-bottom); box-shadow: var(--shadow-xl); }
    .mobile-nav-ready.mobile-nav-open .sidebar { visibility: visible; transform: translateX(0); }
    .app-wrapper.mobile-nav-ready .sidebar-profile { display: block; flex-shrink: 0; padding: 20px; }
    .app-wrapper.mobile-nav-ready .sidebar-collapse-btn { display: none; }
    .app-wrapper.mobile-nav-ready :is(.sidebar-menu, .sidebar-footer) { flex-direction: column; overflow: visible; padding: 12px; flex-shrink: 0; }
    .mobile-nav-ready .sidebar .menu-item { width: 100%; justify-content: flex-start; font-size: 0.95rem; gap: 12px !important; }
    .app-wrapper.mobile-nav-ready .sidebar-profile .profile-avatar { width: 48px; height: 48px; margin: 0 auto 8px; }
    .mobile-nav-ready .sidebar .profile-name { font-size: 1rem; }
    .mobile-nav-ready .sidebar .profile-role { font-size: 0.75rem; }
    .mobile-nav-ready .sidebar :is(.profile-name, .profile-role) { display: block; }
    .mobile-nav-ready .mobile-nav-close { display: block; position: sticky; top: 12px; z-index: 2; align-self: flex-end; flex-shrink: 0; margin: 12px 12px -56px 0; font-size: 1.5rem; padding: 0; }
    .mobile-nav-ready.mobile-nav-open .mobile-nav-backdrop { display: block; position: fixed; inset: 0; border: 0; background: var(--modal-overlay); z-index: 105; }
    .mobile-nav-ready.mobile-nav-open .main-content { overflow: hidden; }
    .home-centered { min-height: calc(100dvh - 112px); }
    .toast-container { left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
    .toast { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
    .blob { max-width: 80vw; }
}

@media (prefers-reduced-motion: reduce) {
    /* Retain a perceptible signal without large spatial motion. */
    .login-page::before { animation: mobileSignal 4s ease-in-out infinite alternate; }
    .blob { animation: mobileBlobSignal 4s ease-in-out infinite alternate; }
    .app-wrapper.mobile-nav-ready .sidebar { transition: none; }
    .main-content { scroll-behavior: auto; }
}
@keyframes mobileSignal { from { opacity: 0.45; } to { opacity: 1; } }
@keyframes mobileBlobSignal { from { opacity: 0.08; } to { opacity: 0.2; } }


.badge-skill {
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

