/* ==========================================================================
   LSPD MANUAL - TACTICAL MDT INTERFACE (RP VERSION)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Inter:wght@400;700;900&display=swap');

body.light-theme {
    --bg-deep: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --border-dim: #e2e8f0;
    --border-accent: #2563eb;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --lspd-blue: #2563eb;
    --hazard: #d97706;
    --scanline-opacity: 0.01;
    --watermark-color: rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

:root {
    --bg-deep: #05070a;
    --bg-surface: #0a0e14;
    --bg-card: #0f141d;
    --border-dim: #1e293b;
    --border-accent: #3b82f6;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --lspd-blue: #2563eb;
    --hazard: #f59e0b;
    --scanline-opacity: 0.25;
    --watermark-color: rgba(255, 255, 255, 0.02);
    --shadow-sm: none;
    --sidebar-width: 280px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--lspd-blue); }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-deep);
    background-image: 
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, var(--scanline-opacity)) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    background-size: 100% 4px, 3px 100%;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.page-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-surface);
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-shell.collapsed {
    --sidebar-width: 70px;
}

.sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-dim);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    z-index: 100;
    overflow: hidden;
}

.sidebar::after {
    content: "LSPD MDT TERMINAL v4.2.1";
    position: absolute;
    bottom: 10px;
    left: 15px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.5;
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Premium Select Styling */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 2.5rem !important;
    cursor: pointer;
}

.local-search, select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-deep);
    border: 1px solid var(--border-dim);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    border-radius: 4px;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.local-search:focus, select:focus {
    outline: none;
    border-color: var(--lspd-blue);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.2);
}

select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.sidebar-alert-badge {
    margin: 0.5rem 1rem;
    padding: 0.6rem 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-dim);
    border-left: 3px solid var(--lspd-blue);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-primary);
}

.brand-row {
    padding: 1rem;
    background: rgba(37, 99, 235, 0.03);
    border-bottom: 1px solid var(--border-dim);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    position: relative;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform 0.3s;
}

.sidebar.collapsed .brand-logo {
    transform: scale(1.1);
}

.brand {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--lspd-blue);
    text-transform: uppercase;
    line-height: 1.2;
    letter-spacing: 0.05em;
    display: flex;
    flex-direction: column;
    transition: opacity 0.2s, visibility 0.2s;
}

.page-shell.collapsed .brand,
.page-shell.collapsed .brand::after,
.page-shell.collapsed .nav-text,
.page-shell.collapsed .nav-divider,
.page-shell.collapsed .user-dropdown,
.page-shell.collapsed .sidebar-search {
    display: none !important;
}

.page-shell.collapsed .brand-row,
.page-shell.collapsed .user-status,
.page-shell.collapsed .sidebar-nav a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.page-shell.collapsed .sidebar-nav a {
    border-left: none;
    border-bottom: 3px solid transparent;
}

.page-shell.collapsed .sidebar-nav a.active {
    border-bottom-color: var(--lspd-blue);
    background: rgba(37, 99, 235, 0.1);
}

.brand::after {
    content: "PROPERTY OF LOS SANTOS";
    font-size: 7px;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    font-weight: 400;
    margin-top: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    overflow-y: auto;
    flex: 1;
}

.sidebar-search {
    padding: 1rem;
    border-bottom: 1px solid var(--border-dim);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-search input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-deep);
    border: 1px solid var(--border-dim);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    border-radius: 4px;
    transition: 0.2s;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--lspd-blue);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.1);
}

.sidebar-alert-badge {
    margin: 0.5rem 1rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-dim);
    border-left: 3px solid var(--lspd-blue);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.page-shell.collapsed .sidebar-alert-badge {
    display: none;
}

.search-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    font-weight: 900;
    color: var(--hazard);
    padding: 1rem 1.25rem 0.5rem;
    letter-spacing: 0.15em;
}

.global-result {
    background: rgba(245, 158, 11, 0.05) !important;
    border-left-color: var(--hazard) !important;
    color: var(--text-primary) !important;
}

.global-result:hover {
    background: rgba(245, 158, 11, 0.15) !important;
}

.sidebar-nav a {
    padding: 0.6rem 1.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-left: 3px solid transparent;
    transition: 0.1s;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.nav-text {
    transition: opacity 0.2s;
}

.sidebar-collapse-toggle {
    margin-top: auto;
    height: 50px;
    border-top: 1px solid var(--border-dim);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.2);
    color: var(--lspd-blue);
    font-size: 1.2rem;
    transition: 0.2s;
    z-index: 101;
    width: 100%;
}

.sidebar-collapse-toggle .toggle-icon {
    transition: transform 0.3s;
    display: inline-block;
}

.page-shell.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
    opacity: 1;
}

.sidebar-nav a:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--lspd-blue);
    border-left-color: var(--lspd-blue);
}

.nav-divider {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--lspd-blue);
    padding: 1.5rem 1.5rem 0.5rem;
    letter-spacing: 0.2em;
    opacity: 0.7;
}

.sidebar-nav a.active {
    background: rgba(37, 99, 235, 0.2);
    color: var(--lspd-blue);
    border-left-color: var(--lspd-blue);
    font-weight: 700;
}

/* Content Area */
.content-page {
    padding: 0 2.5rem 2.5rem 2.5rem; /* Supprimé le padding-top pour coller la barre */
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
    width: 100%;
}

.toc-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(10, 10, 12, 0.98);
    backdrop-filter: blur(15px);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.25rem 2.5rem;
    border-bottom: 1px solid var(--lspd-blue);
    margin: 0 -2.5rem 3rem -2.5rem; /* Aligné parfaitement en haut */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
}

.toc-link {
    color: var(--text-muted);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.6rem;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.02);
}

.toc-link:hover {
    color: var(--lspd-blue);
    border-color: var(--lspd-blue);
    background: rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

/* Watermark */
.content-page::before {
    content: "CONFIDENTIAL";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 8rem;
    font-weight: 900;
    color: var(--watermark-color);
    pointer-events: none;
    z-index: 0;
}

.manual-header {
    margin-bottom: 5rem;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 2rem;
}

.manual-header h1 {
    font-size: 3rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.manual-header p {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Sections */
section {
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 1;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

h2 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(37, 99, 235, 0.05);
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--lspd-blue);
}

p {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.vehicle-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.vehicle-img-container {
    width: 100%;
    height: 200px;
    position: relative;
    overflow: hidden;
    background: #000;
}

.vehicle-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: 0.3s;
}

.vehicle-card:hover .vehicle-img {
    opacity: 1;
    transform: scale(1.05);
}

.img-placeholder {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--hazard);
    color: #000;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 6px;
}

.vehicle-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tech-specs {
    margin: 1.5rem 0 0 0;
    list-style: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    border-top: 1px solid var(--border-dim);
    padding-top: 1rem;
}

.tech-specs li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.tech-specs li span {
    color: var(--lspd-blue);
    font-weight: 700;
}

.card h3 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card a {
    display: block;
    width: 100%;
    padding: 0.6rem;
    text-align: center;
    background: #1e293b;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
}

.card a:hover {
    background: var(--lspd-blue);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    margin: 2rem 0;
}

th {
    background: var(--lspd-blue);
    color: #fff;
    padding: 0.8rem;
    text-align: left;
}

td {
    padding: 0.8rem;
    border: 1px solid var(--border-dim);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* User Status */
.user-status {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
}

.settings-btn {
    font-size: 1rem;
    opacity: 0.9;
    transition: 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: var(--lspd-blue);
}

.settings-btn:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.sidebar.collapsed .user-status {
    padding: 1rem 0;
    display: flex;
    justify-content: center;
}

.user-info-card h4 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: var(--lspd-blue);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-sm {
    font-size: 0.8rem;
    opacity: 0.8;
}

.user-detail {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

.user-detail strong {
    color: var(--text-primary);
    font-weight: 600;
}

#logout-button {
    width: 100%;
    background: rgba(127, 29, 29, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.4rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    margin-top: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
}

body.light-theme #logout-button {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

#logout-button:hover {
    background: #7f1d1d;
    color: #fff;
}

/* Alert */
.premium-alert {
    border: 1px solid var(--hazard);
    background: rgba(245, 158, 11, 0.05);
    padding: 1.25rem;
    color: var(--hazard);
    font-family: 'JetBrains Mono', monospace;
    position: relative;
    padding-left: 3.5rem;
    border-radius: 4px;
    margin: 1.5rem 0;
}

.premium-alert::before {
    content: "!";
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    font-weight: 900;
}

/* Mobile */
@media (max-width: 1024px) {
    .page-shell { flex-direction: column; margin: 0; }
    .sidebar { width: 100%; }
    .content-page { padding: 1.5rem; }
    .sidebar-nav { display: none; }
}

/* Login Page Override */
.login-shell {
    background-color: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-glass-card {
    background: var(--bg-surface);
    border: 1px solid var(--lspd-blue);
    padding: 3rem;
    width: 400px;
    position: relative;
}

.login-glass-card::before {
    content: "LSPD - AUTHENTICATION REQUIRED";
    position: absolute;
    top: -25px;
    left: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--lspd-blue);
}

.login-form input {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border-dim);
    padding: 0.8rem;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 1rem;
}

.mobile-toggle {
    display: none !important;
}

.btn-primary {
    width: 100%;
    background: var(--lspd-blue);
    color: #fff;
    border: none;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    cursor: pointer;
}

/* User Badge Styles */
.user-status {
    position: relative;
    padding: 1rem;
    border-bottom: 1px solid var(--border-dim);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.user-badge:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-rank-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.user-dropdown {
    display: block;
    margin-top: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    border-left: 2px solid var(--lspd-blue);
    padding: 0.5rem 0.75rem;
}

.user-status:hover .user-dropdown {
    display: block;
}

.user-detail {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.user-detail strong {
    color: var(--lspd-blue);
    margin-right: 0.5rem;
}

#logout-button {
    width: 100%;
    margin-top: 1rem;
    padding: 0.6rem;
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

#logout-button:hover {
    background: #ef4444;
    color: #fff;
}

/* Miranda Box Styles */
.miranda-box {
    background: rgba(37, 99, 235, 0.05);
    border: 2px solid var(--lspd-blue);
    padding: 2.5rem;
    margin: 3rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    position: relative;
    border-radius: 4px;
}

.miranda-box::before {
    content: "PROTOCOL 12.02 - MIRANDA WARNING";
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--bg-surface);
    padding: 0 10px;
    font-size: 0.7rem;
    font-weight: 900;
    color: var(--lspd-blue);
}

.miranda-box p {
    margin-bottom: 1.25rem;
}

.miranda-box strong {
    color: var(--lspd-blue);
}

.miranda-notes {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-dim);
    font-size: 0.8rem;
    color: var(--hazard);
    font-style: italic;
}
