:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* Light Mode Variables override */
body.light-mode {
    --bg-dark: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

/* Adjust gradients/bg for light mode */
body.light-mode #login-screen {
    background: radial-gradient(circle at top right, #e2e8f0, #cbd5e1);
}

body.light-mode .content {
    background: #f8fafc;
}

body.light-mode .vehicle-card:hover {
    background: #f8fafc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
}

.hidden {
    display: none !important;
}

/* Splash Screen */
.splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.splash-content {
    text-align: center;
}

.splash-icon {
    font-size: 5rem;
    color: var(--primary);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

.splash-title {
    font-size: 2.5rem;
    margin: 1rem 0;
    font-weight: 700;
    opacity: 0;
    animation: fadeUp 0.8s forwards 0.3s;
}

.loader-line {
    width: 200px;
    height: 4px;
    background: var(--border);
    margin: 1rem auto;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.loader-line::after {
    content: '';
    position: absolute;
    left: -50%;
    width: 40%;
    height: 100%;
    background: var(--primary);
    animation: loading 1.5s infinite ease-in-out;
}

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

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

@keyframes loading {
    from { left: -50%; }
    to { left: 100%; }
}

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

.rotating {
    animation: rotate 1s linear infinite;
}

/* Login Screen */
#login-screen {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1000;
}

.login-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    position: relative;
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo i {
    font-size: 3rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.8rem;
    margin: 0.5rem 0 0.2rem;
}

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

/* Forms & Inputs */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.icon-left {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

.icon-right {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    cursor: pointer;
}

input, select {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem 0.75rem 2.8rem; /* Space for icon */
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.85rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--text-muted);
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.msg-error {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    text-align: center;
    min-height: 1.2rem;
}

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.form-footer a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

/* Dashboard Layout */
#dashboard-screen {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: transform 0.3s ease;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.85rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    text-align: left;
}

.nav-item:hover, .nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.nav-item.logout {
    margin-top: auto;
    color: var(--danger);
}

.nav-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.spacer {
    flex: 1;
}

.user-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.details {
    display: flex;
    flex-direction: column;
}

#user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

#user-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Mobile Header */
.mobile-header {
    display: none;
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 90;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

.brand-mobile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Main Content */
.content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    position: relative;
    background: var(--bg-dark);
}

/* Views */
.view {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
}

#search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.85rem 1rem;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    height: 46px; /* Matched height */
}

.icon-clear {
    position: absolute;
    right: 10px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    display: none;
}

/* Vehicle Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding-bottom: 2rem;
}

.vehicle-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.vehicle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.card-icon.icon-removed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.card-info {
    flex: 1;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.card-header-row h3 {
    font-size: 1.1rem;
    margin: 0;
}

.model-badge {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.card-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.status-badge {
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.status-parked { color: var(--success); background: rgba(16, 185, 129, 0.1); }
.status-removed { color: var(--danger); background: rgba(239, 68, 68, 0.1); }
.status-moving { color: var(--warning); background: rgba(245, 158, 11, 0.1); }

.sector-badge {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    text-align: center;
    border: 1px solid var(--border);
    animation: zoomIn 0.3s ease;
}

.vehicle-detail {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 1000;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 20px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.vehicle-detail.hidden {
    transform: translateX(100%);
    display: flex !important; /* Override hidden display none to allow transition */
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    }
    
    .sidebar.active {
        transform: translateX(260px);
    }
    
    .sidebar-overlay.active {
        display: block;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 95;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .content {
        padding-top: 70px; /* Space for mobile header */
        padding-bottom: 80px;
    }
    
    .vehicle-detail {
        width: 100%;
    }
    
    .btn-new-entry .btn-text,
    .btn-text-move {
        display: none;
    }
}

/* Theme Toggle & New Buttons */
.theme-toggle-float {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
}

.theme-toggle-float:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.theme-toggle-mini {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.theme-toggle-mini:hover {
    background: var(--bg-card);
    color: var(--warning);
    border-color: var(--warning);
}

.btn-icon-only {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 48px;
    height: 46px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-only:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Height adjustments */
#search-input, #search-btn, .btn-new-entry {
    height: 46px;
}

/* Sector Filter Section from previous file */
.sector-filter-section {
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.sector-filter-container {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mobile-hidden {
    display: none;
}

/* Admin Tables */
.user-table {
    width: 100%;
    border-collapse: collapse;
}

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

.user-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}