:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.5);
    --input-bg: rgba(0, 0, 0, 0.2);
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 20%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utils */
.hidden {
    display: none !important;
}

/* Layout */
* {
    box-sizing: border-box;
}

/* App Layout - Fixed Full Screen */
body,
html {
    height: 100%;
    overflow: hidden;
    /* Prevent body scroll */
}

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 100%;
    /* Full height */
    box-sizing: border-box;
    z-index: 100;
    flex-shrink: 0;
}

/* ... existing styles ... */

.main-content {
    flex: 1;
    padding: 30px;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    /* Independent scroll */
    height: 100%;
}

.sidebar-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

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

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    /* Ensure it doesn't touch edges if parent padding is small */
}

/* Add a visual indicator line for active state */
.nav-item.active {
    border-left: 3px solid var(--accent-color);
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.1) 0%, transparent 100%);
}

.nav-item i {
    font-size: 1.2rem;
}

/* Main Content Scroll */
.main-content {
    flex: 1;
    padding: 30px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    height: 100%;
    position: relative;
}

/* Sticky Settings Panel */
aside.glass-panel {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 200;
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.centered-screen {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Glass Components */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Typography */
h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

p {
    color: var(--text-secondary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="date"] {
    width: 100%;
    padding: 12px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--accent-color), #2563eb);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    margin-top: 10px;
}

/* Camera Input Styling */
.file-input-wrapper {
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
}

.file-upload-box {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--input-bg);
}

.file-upload-box.has-file {
    border-color: var(--accent-color);
    background: rgba(56, 189, 248, 0.1);
}

.file-upload-box input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.icon-camera {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    opacity: 0.7;
}

/* Dashboard Specifics */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    color: var(--text-secondary);
    font-weight: 600;
}

td img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

/* Dashboard Action Cards */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.action-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    min-height: 140px;
}

.action-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-color: var(--accent-color);
}

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

.action-card h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.action-card p {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Modal for New Report */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #1e293b;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.glass-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Modal Animation */
.modal-content {
    animation: scaleIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Toasts */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--accent-color);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    min-width: 250px;
    color: var(--text-primary);
    font-size: 0.95rem;
    animation: slideInRight 0.3s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    display: flex;
    align-items: center;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.success {
    border-left-color: #10b981;
}

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

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOutRight {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Table Hover */
tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .menu-toggle {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        width: 80%;
        max-width: 300px;
        background: #0f172a;
        /* Solid bg for mobile drawer */
        border-right: 1px solid var(--glass-border);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Overlay when sidebar open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(3px);
        z-index: 90;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 70px 15px 20px 15px;
        /* Top padding for toggle button */
    }

    .container {
        padding: 15px;
    }

    /* Header Layout */
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-top: 0;
    }

    .header>div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    /* Filter Bar Stacking */
    main .glass-panel>div {
        flex-direction: column;
        align-items: stretch !important;
    }

    #search,
    #startDate,
    #endDate {
        width: 100% !important;
    }

    /* Buttons */
    .header button,
    main button {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 10px;
    }

    /* Table Adjustments */
    th,
    td {
        padding: 10px;
        font-size: 0.9rem;
    }

    /* Thumbnails smaller on mobile */
    td img {
        width: 40px;
        height: 40px;
    }

    /* Modal Full Screenish */
    .modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
    }

    /* Settings Page Grid */
    .container>div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Settings Sidebar */
    aside.glass-panel {
        width: 100% !important;
    }
}