:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(22, 30, 49, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Neon gradients & accents */
    --accent-blue: #38bdf8;
    --accent-blue-glow: rgba(56, 189, 248, 0.35);
    --accent-teal: #0d9488;
    --accent-teal-glow: rgba(13, 148, 136, 0.35);
    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.35);
    --accent-yellow: #f59e0b;
    --accent-yellow-glow: rgba(245, 158, 11, 0.35);
    
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(16px);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

header {
    background: var(--glass-bg);
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pwa-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: none; /* Show dynamically via JS */
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

.pwa-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(56, 189, 248, 0.4);
}

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

.icon-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-main);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Glassmorphism Card Style */
.card-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-pb: 12px;
    padding-bottom: 12px;
}

.card-title .material-symbols-outlined {
    color: var(--accent-blue);
}

/* Interactive Canvas Panel */
.canvas-section {
    position: relative;
    width: 100%;
    height: calc(100vh - 65px); /* Full height minus header */
    display: flex;
    flex-direction: column;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #060913;
    box-shadow: inset 0 4px 20px rgba(0,0,0,0.8);
}

canvas {
    display: block;
    width: 100%;
    cursor: crosshair;
}

.floating-coords {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    border-color: rgba(56, 189, 248, 0.3);
}

.drawer-toggle-btn {
    position: absolute;
    left: 16px;
    top: 24px;
    z-index: 20;
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
}

.drawer-toggle-btn:hover {
    transform: scale(1.05);
    background: var(--accent-blue);
    color: white;
}

/* Report Form Modal & Elements */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 6, 12, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 16px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #111827;
    border: 1px solid var(--card-border);
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 95vh;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
    }
    .modal-content {
        height: 100%;
        border-radius: 0;
        max-width: 100%;
        overflow-y: auto;
        transform: translateY(100%);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
}

.modal-close:hover {
    color: var(--accent-red);
}

/* Camera viewport inside Modal */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255,255,255,0.1);
}

#camera-video, #camera-preview, #edit-camera-video, #edit-camera-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#camera-preview, #edit-camera-preview {
    display: none;
}

/* Camera Controls Overlay */
.camera-controls {
    position: absolute;
    bottom: 16px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 5;
}

.shutter-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: white;
    border: 5px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: transform 0.1s ease;
}

.shutter-btn:active {
    transform: scale(0.9);
}

.camera-action-btn {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
}

/* Form inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.coord-display {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255,255,255,0.1);
    padding: 10px 14px;
    border-radius: 10px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--accent-blue);
    display: flex;
    justify-content: space-between;
}

.manual-coord-inputs {
    display: flex;
    gap: 12px;
}

.input-col {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
}

.input-col label {
    font-size: 0.75rem;
}

.form-select, .form-input {
    background: #1f2937;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 12px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
    width: 100%;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.form-select:focus, .form-input:focus {
    border-color: var(--accent-blue);
}

.submit-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Side Drawer: Report Feed */
.side-drawer {
    position: fixed;
    top: 65px; /* Below header */
    left: 0;
    width: 380px;
    max-width: 100%;
    height: calc(100vh - 65px);
    background: #111827;
    border-right: 1px solid var(--card-border);
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 40;
    display: flex;
    flex-direction: column;
}

.side-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-feed {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Customize scrollbar */
.report-feed::-webkit-scrollbar {
    width: 6px;
}
.report-feed::-webkit-scrollbar-track {
    background: transparent;
}
.report-feed::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.report-feed::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.report-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.report-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(56, 189, 248, 0.3);
}

.report-card.selected {
    background: rgba(56, 189, 248, 0.08);
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.report-card-img {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    object-fit: cover;
    background: #000;
    border: 1px solid rgba(255,255,255,0.08);
}

.report-card-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    flex: 1;
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-category-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-crack { background: var(--accent-red-glow); color: #fca5a5; border: 1px solid var(--accent-red); }
.badge-water { background: var(--accent-blue-glow); color: #bae6fd; border: 1px solid var(--accent-blue); }
.badge-light { background: var(--accent-yellow-glow); color: #fde047; border: 1px solid var(--accent-yellow); }
.badge-other { background: var(--accent-teal-glow); color: #99f6e4; border: 1px solid var(--accent-teal); }
.badge-bolter { background: var(--accent-red-glow); color: #fca5a5; border: 1px solid var(--accent-red); }
.badge-berg { background: var(--accent-yellow-glow); color: #fde047; border: 1px solid var(--accent-yellow); }
.badge-sproytebetong { background: var(--accent-teal-glow); color: #99f6e4; border: 1px solid var(--accent-teal); }
.badge-vann { background: var(--accent-blue-glow); color: #bae6fd; border: 1px solid var(--accent-blue); }
.badge-annet { background: rgba(71, 85, 105, 0.35); color: #cbd5e1; border: 1px solid #475569; }


.report-card-coords {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.report-card-desc {
    font-size: 0.85rem;
    color: var(--text-main);
    word-break: break-word;
}

.report-card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

.empty-feed {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-style: italic;
    font-size: 0.9rem;
}

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

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateX(20px);
    animation: slideInRight 0.3s forwards, fadeOutRight 0.3s 3s forwards;
}

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

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

@keyframes fadeOutRight {
    to { opacity: 0; transform: translateX(10px); }
}

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

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

/* Offline Banner */
.offline-banner {
    background: #b91c1c;
    color: white;
    text-align: center;
    padding: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: none;
    z-index: 100;
}

.offline-banner.active {
    display: block;
}
