/**
 * Navigator View - Styles
 *
 * Zoomable/pannable canvas with project screenshot thumbnails
 * grouped by category. Dark by default, supports light/dark theme.
 */

/* ── Reset & Base ────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #0a0e17;
    color: #e2e8f0;
    overflow: hidden;
    height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 100;
    position: relative;
    height: 56px;
}

.nav-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.nav-brand {
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: -0.3px;
}

.nav-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Zoom Controls ───────────────────────────────────────────── */
.nav-zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 2px;
    margin-right: 8px;
}

.nav-zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.nav-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.nav-zoom-level {
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    min-width: 44px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

.nav-zoom-fit {
    margin-left: 2px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 6px 6px 0;
    padding-left: 4px;
}

/* ── Header Buttons ──────────────────────────────────────────── */
.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
}

.nav-btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

.nav-btn-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-btn-logout {
    padding: 7px 14px;
    background: rgba(100, 116, 139, 0.3);
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.nav-btn-logout:hover {
    background: rgba(100, 116, 139, 0.45);
    color: #e2e8f0;
}

/* ── Viewport ────────────────────────────────────────────────── */
.nav-viewport {
    position: relative;
    width: 100%;
    height: calc(100vh - 56px);
    overflow: hidden;
    cursor: grab;
    background:
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.03) 0%, transparent 50%),
        #0a0e17;
}

.nav-viewport:active {
    cursor: grabbing;
}

.nav-viewport.nav-on-card {
    cursor: default;
}

/* Spacebar pan mode: grab cursor everywhere, override card pointer */
.nav-viewport.nav-space-pan {
    cursor: grab !important;
}

.nav-viewport.nav-space-pan:active {
    cursor: grabbing !important;
}

.nav-viewport.nav-space-pan .nav-card {
    pointer-events: none;
}

/* ── Canvas ──────────────────────────────────────────────────── */
.nav-canvas {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

/* ── Loading ─────────────────────────────────────────────────── */
.nav-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #64748b;
    font-size: 14px;
    z-index: 10;
}

.nav-loading.hidden {
    display: none;
}

.nav-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(100, 116, 139, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: nav-spin 0.8s linear infinite;
}

@keyframes nav-spin {
    to { transform: rotate(360deg); }
}

/* ── Groups ──────────────────────────────────────────────────── */
.nav-group {
    position: absolute;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    overflow: hidden;
}

.nav-group-header {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-group-cards {
    display: grid;
    gap: 16px;
    padding: 20px;
}

/* ── Cards ────────────────────────────────────────────────────── */
.nav-card {
    display: flex;
    flex-direction: column;
    width: 280px;
    height: 200px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.nav-card:hover {
    transform: scale(1.04);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.nav-card-thumb {
    width: 100%;
    height: 150px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.nav-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s;
}

.nav-card-thumb img.img-loading {
    opacity: 0;
}

.nav-card-label {
    display: flex;
    align-items: center;
    padding: 0 14px;
    height: 50px;
    font-size: 13px;
    font-weight: 500;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Category Colors ─────────────────────────────────────────── */
.nav-group[data-category="Cameras"] .nav-group-header { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.nav-group[data-category="Cameras"] .nav-card:hover { border-color: rgba(59, 130, 246, 0.4); box-shadow: 0 8px 32px rgba(59, 130, 246, 0.15); }

.nav-group[data-category="Analysis"] .nav-group-header { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.nav-group[data-category="Analysis"] .nav-card:hover { border-color: rgba(139, 92, 246, 0.4); box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15); }

.nav-group[data-category="Finance"] .nav-group-header { background: rgba(5, 150, 105, 0.15); color: #34d399; }
.nav-group[data-category="Finance"] .nav-card:hover { border-color: rgba(5, 150, 105, 0.4); box-shadow: 0 8px 32px rgba(5, 150, 105, 0.15); }

.nav-group[data-category="Tools"] .nav-group-header { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.nav-group[data-category="Tools"] .nav-card:hover { border-color: rgba(245, 158, 11, 0.4); box-shadow: 0 8px 32px rgba(245, 158, 11, 0.15); }

.nav-group[data-category="Communication"] .nav-group-header { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.nav-group[data-category="Communication"] .nav-card:hover { border-color: rgba(6, 182, 212, 0.4); box-shadow: 0 8px 32px rgba(6, 182, 212, 0.15); }

.nav-group[data-category="Infrastructure"] .nav-group-header { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }
.nav-group[data-category="Infrastructure"] .nav-card:hover { border-color: rgba(100, 116, 139, 0.4); box-shadow: 0 8px 32px rgba(100, 116, 139, 0.15); }

.nav-group[data-category="Admin"] .nav-group-header { background: rgba(244, 63, 94, 0.15); color: #fb7185; }
.nav-group[data-category="Admin"] .nav-card:hover { border-color: rgba(244, 63, 94, 0.4); box-shadow: 0 8px 32px rgba(244, 63, 94, 0.15); }

/* ── Dark Mode (deeper variant) ──────────────────────────────── */
[data-theme="dark"] body {
    background: #060a12;
}

[data-theme="dark"] .nav-viewport {
    background:
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.02) 0%, transparent 50%),
        #060a12;
}

[data-theme="dark"] .nav-header {
    background: rgba(6, 10, 18, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .nav-group {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .nav-card {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .nav-card-label {
    color: #cbd5e1;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-header {
        padding: 10px 12px;
        height: 48px;
    }

    .nav-viewport {
        height: calc(100vh - 48px);
    }

    .nav-brand {
        font-size: 14px;
    }

    .nav-zoom-level {
        display: none;
    }

    .nav-btn-logout {
        font-size: 11px;
        padding: 6px 10px;
    }

    .nav-zoom-controls {
        margin-right: 4px;
    }
}

@media (max-width: 480px) {
    .nav-header-right {
        gap: 4px;
    }

    .nav-zoom-fit {
        display: none;
    }
}

/* ── Reduced Motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .nav-card {
        transition: none;
    }

    .nav-card:hover {
        transform: none;
    }

    .nav-loading-spinner {
        animation: none;
        border-top-color: transparent;
    }

    .nav-card-thumb img {
        transition: none;
    }
}
