/* Cyberpunk Theme */
:root {
    --cyberpunk-primary: #00ff88;
    --cyberpunk-secondary: #00ffff;
    --cyberpunk-accent: #ff00ff;
    --cyberpunk-dark: #0a0a0f;
    --cyberpunk-darker: #050508;
    --cyberpunk-light: #e0e0e0;
    --cyberpunk-glow: 0 0 10px;
}

/* Base Styles */
body {
    background-color: var(--cyberpunk-darker);
    color: var(--cyberpunk-light);
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Cyberpunk Title */
.cyberpunk-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    color: var(--cyberpunk-primary);
    text-shadow: var(--cyberpunk-glow) var(--cyberpunk-primary);
    letter-spacing: 0.2em;
}

.cyberpunk-subtitle {
    font-family: 'Orbitron', sans-serif;
    color: var(--cyberpunk-secondary);
    text-shadow: var(--cyberpunk-glow) var(--cyberpunk-secondary);
    letter-spacing: 0.1em;
}

/* Hero Section */
.hero-section {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/images/grid.svg') repeat;
    opacity: 0.1;
    z-index: 1;
}

.auth-buttons {
    margin-top: 2rem;
}

.auth-buttons .btn {
    font-size: 1.2rem;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.auth-buttons .btn-primary {
    background-color: var(--cyberpunk-primary);
    border-color: var(--cyberpunk-primary);
    color: var(--cyberpunk-dark);
}

.auth-buttons .btn-primary:hover {
    background-color: #00cc6a;
    border-color: #00cc6a;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.auth-buttons .btn-outline-light {
    color: var(--cyberpunk-light);
    border-color: var(--cyberpunk-light);
}

.auth-buttons .btn-outline-light:hover {
    background-color: var(--cyberpunk-light);
    color: var(--cyberpunk-dark);
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: rgba(10, 10, 15, 0.9);
    border-radius: 1rem;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.2);
    backdrop-filter: blur(10px);
    padding: 2rem;
}

.auth-card .card {
    background: transparent;
    border: none;
}

.auth-card .card-body {
    padding: 0;
}

/* Map Container */
.map-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 100px);
    background-color: var(--cyberpunk-darker);
    overflow: hidden;
}

.map-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: rgba(5, 5, 8, 0.6);
    border-radius: 0.5rem;
    padding: 0.5rem;
    backdrop-filter: blur(4px);
}

.map-info {
    margin-left: 20px;
    font-size: 0.9rem;
    color: var(--cyberpunk-light);
}

.map-resources {
    margin-left: auto;
}

/* Full interactive Leaflet world map filling the whole play area. Leaflet handles pan/zoom/tile
   loading itself; the game zones are a canvas overlay it positions in its own coordinate space. */
.map-leaflet {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: var(--cyberpunk-darker);
    z-index: 0;
}

/* Recolour only the OSM tiles (not our zone overlay, which lives in a separate Leaflet pane) to
   match the cyberpunk dark theme instead of OSM's default light basemap. */
.map-leaflet .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(1.15) saturate(0.5);
}

.map-leaflet .leaflet-control-attribution {
    background: rgba(5, 5, 8, 0.7) !important;
    color: rgba(224, 224, 224, 0.6) !important;
    font-size: 0.65rem;
}

.map-leaflet .leaflet-control-attribution a {
    color: rgba(0, 255, 136, 0.8) !important;
}

/* Company logo badge drawn in the centre of a claimed zone. */
.zone-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}

/* Override Radzen's default icon size (1.5rem) down to badge size. */
.zone-logo .rzi {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

/* Zone Details Panel */
.zone-details-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    width: 380px;
    max-width: calc(100vw - 40px);
    max-height: calc(100% - 40px);
    overflow-y: auto;
    background: rgba(10, 10, 15, 0.95);
    border-radius: 0.5rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.zone-details-panel .card {
    background: transparent;
    border: 1px solid var(--cyberpunk-primary);
}

.zone-details-panel .card-header {
    background: rgba(0, 255, 136, 0.1);
    border-bottom: 1px solid var(--cyberpunk-primary);
}

/* Settings: colour / logo pickers for company appearance */
.settings-container {
    padding: 1.5rem 0;
}

.swatch-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.swatch,
.logo-swatch {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.logo-swatch {
    background: rgba(255, 255, 255, 0.06);
    color: var(--cyberpunk-light);
}

.swatch:hover,
.logo-swatch:hover {
    transform: translateY(-2px);
}

.swatch.selected,
.logo-swatch.selected {
    border-color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

/* Mirrors how a zone is drawn on the map, so the leader sees the real result. */
.zone-preview {
    width: 3.5rem;
    height: 3.5rem;
    margin-top: 0.25rem;
    border: 1px solid;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.danger-card {
    border: 1px solid #ff3366 !important;
}

/* Zone actions: one block per action, hint text underneath its button. */
.zone-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.zone-action-hint {
    display: block;
    margin-top: 0.25rem;
}

/* Buttons must keep their intrinsic width - flex was shrinking them until the label clipped. */
.zone-details-panel .rz-button {
    flex-shrink: 0;
    white-space: nowrap;
}

/* SVG Styles */
.zone-rect {
    /* Semi-transparent so the world map background is visible through the grid, per the
       game's "not geolocated but based on the world map" premise. */
    fill-opacity: 0.6;
    transition: all 0.2s ease;
    cursor: pointer;
}

.zone-rect:hover {
    fill-opacity: 0.85;
    stroke-width: 2;
}

.zone-rect.selected {
    stroke: #ff0000;
    stroke-width: 2;
}

.selected-zone-indicator {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* App Layout (sidebar + main content) */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    background-color: var(--cyberpunk-dark);
}

main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* The sidebar header carries the brand lockup; .top-row only exists inside .sidebar now that
   main's account bar is gone. */
.sidebar .top-row {
    height: 3.5rem;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
}

.sidebar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Beta flag. Magenta rather than the brand green: it has to read as a separate stamp on the
   lockup, not as part of the name. Same accent Athena uses, so it stays inside the palette. */
.brand-beta {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0.15rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.55rem;
    line-height: 1;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cyberpunk-accent);
    padding: 0.2rem 0.35rem;
    border: 1px solid rgba(255, 0, 255, 0.55);
    border-radius: 0.2rem;
    background: rgba(255, 0, 255, 0.08);
    box-shadow: 0 0 6px rgba(255, 0, 255, 0.25);
    /* The lockup is already tight at 250px - the badge must never force the wordmark to clip. */
    white-space: nowrap;
}

.brand-text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.1;
    letter-spacing: 0.06em;
    color: var(--cyberpunk-primary);
    text-shadow: var(--cyberpunk-glow) rgba(0, 255, 136, 0.5);
    text-transform: uppercase;
    /* Two short lines rather than one clipped one, inside a 250px sidebar. */
    max-width: 7.5rem;
    white-space: normal;
}

main .content {
    flex: 1;
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
        flex-shrink: 0;
    }

    main {
        flex: 1;
        height: 100vh;
        overflow-y: auto;
    }

}

/* Navigation */
.nav-scrollable {
    /* Column flex so the account block can be pushed to the bottom with margin-top:auto.
       Bootstrap's .collapse:not(.show) still wins on mobile - it carries more specificity -
       so the hamburger toggle keeps working. */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 3.5rem);
    overflow-y: auto;
    background-color: var(--cyberpunk-dark);
}

@media (min-width: 641px) {
    .nav-scrollable {
        /* A fixed height, not max-height: margin-top:auto only pushes the account block down
           if the container actually fills the sidebar. */
        height: calc(100vh - 3.5rem);
        max-height: none;
        /* The collapse toggle is a mobile-only affordance; always show the nav on desktop
           regardless of the collapsed/expanded C# state driving the "collapse" class. */
        display: flex !important;
    }

    .navbar-toggler {
        display: none;
    }
}

.nav-item {
    padding: 0.5rem 1rem;
}

.nav-link {
    color: var(--cyberpunk-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: rgba(0, 255, 136, 0.1);
    color: var(--cyberpunk-primary);
}

.nav-link.active {
    background-color: rgba(0, 255, 136, 0.2);
    color: var(--cyberpunk-primary);
}

/* Account block - pinned to the bottom of the sidebar, above the fold on any viewport. */
.nav-account {
    margin-top: auto;
    border-top: 1px solid rgba(0, 255, 136, 0.2);
    padding: 0.5rem 0;
}

.nav-account-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem 0.5rem;
    color: var(--cyberpunk-primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* The username is user-supplied and unbounded, so it truncates rather than widening the
   sidebar or wrapping onto a second line. */
.nav-account-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Logout is a button, not a link, so it needs the anchor styling reset onto it to sit flush
   with the NavLinks above it. */
.nav-link-button {
    width: 100%;
    background: none;
    border: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

/* Feature Cards */
.feature-card {
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid var(--cyberpunk-primary);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
}

.feature-card:hover {
    background: rgba(10, 10, 15, 0.9);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    color: var(--cyberpunk-primary);
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: var(--cyberpunk-primary);
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
}

.feature-card p {
    color: var(--cyberpunk-light);
    opacity: 0.8;
}

/* Stat Cards */
.stat-card {
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid var(--cyberpunk-secondary);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(10, 10, 15, 0.9);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.stat-card .card-title {
    color: var(--cyberpunk-secondary);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-card .card-text {
    color: var(--cyberpunk-primary);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--cyberpunk-primary);
    border-color: var(--cyberpunk-primary);
}

.btn-primary:hover {
    background-color: #00cc6a;
    border-color: #00cc6a;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

.btn-success {
    background-color: var(--cyberpunk-primary);
    border-color: var(--cyberpunk-primary);
}

.btn-danger {
    background-color: #ff3366;
    border-color: #ff3366;
}

.btn-danger:hover {
    background-color: #cc2955;
    border-color: #cc2955;
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.5);
}

.btn-outline-light {
    color: var(--cyberpunk-light);
    border-color: var(--cyberpunk-light);
}

.btn-outline-light:hover {
    background-color: var(--cyberpunk-light);
    color: var(--cyberpunk-dark);
}

/* Form Controls */
.form-control {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--cyberpunk-light);
    color: var(--cyberpunk-light);
    border-radius: 0.5rem;
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--cyberpunk-primary);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
    color: var(--cyberpunk-light);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Cards */
.card {
    background-color: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 0.5rem;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.1);
}

.card-header {
    background-color: rgba(0, 255, 136, 0.1);
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
}

.card-body {
    padding: 1.5rem;
}

/* Alerts */
.alert {
    border-radius: 0.5rem;
    border: none;
    padding: 1rem;
}

.alert-danger {
    background-color: rgba(255, 51, 102, 0.2);
    color: #ff3366;
    border: 1px solid #ff3366;
}

.alert-success {
    background-color: rgba(0, 255, 136, 0.2);
    color: var(--cyberpunk-primary);
    border: 1px solid var(--cyberpunk-primary);
}

/* Spinner */
.spinner-border {
    border-color: var(--cyberpunk-primary) transparent var(--cyberpunk-primary) transparent;
}

/* General Utilities */
.text-primary {
    color: var(--cyberpunk-primary) !important;
}

.text-secondary {
    color: var(--cyberpunk-secondary) !important;
}

.bg-dark {
    background-color: var(--cyberpunk-dark) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        padding: 1rem;
    }
    
    .auth-card {
        width: 90%;
        padding: 1.5rem;
    }
    
    .map-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .zone-details-panel {
        position: fixed;
        top: 20px;
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

/* Lore page */
.lore-page {
    background-color: var(--cyberpunk-darker);
}

/* Shorter than the home hero: this page is meant to be read, so the text below the fold has
   to be visible without scrolling past a full viewport of banner. */
.lore-hero {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-align: center;
}

.lore-hero-content {
    position: relative;
    z-index: 2;
    padding: 3rem 2rem;
}

.lore-hero h1 {
    font-size: clamp(1.75rem, 5vw, 3.5rem);
    margin-bottom: 0.5rem;
}

/* Measure capped for readability - full-width prose on a wide monitor is unreadable. */
.lore-prose {
    max-width: 46rem;
    margin: 0 auto;
    color: var(--cyberpunk-light);
    line-height: 1.7;
}

.lore-lead {
    font-size: 1.2rem;
}

.lore-prose strong {
    color: var(--cyberpunk-primary);
}

.lore-closing {
    border-left: 2px solid var(--cyberpunk-primary);
    padding-left: 1.25rem;
    font-style: italic;
    color: var(--cyberpunk-secondary);
}

.lore-card {
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 1rem;
    height: 100%;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.lore-card:hover {
    border-color: var(--cyberpunk-primary);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.lore-card h3 {
    color: var(--cyberpunk-primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
}

.lore-card p {
    color: var(--cyberpunk-light);
    line-height: 1.7;
}

.lore-card strong {
    color: var(--cyberpunk-secondary);
}

/* Athena gets the accent colour - she's the one antagonist-shaped thing in the setting. */
.lore-athena {
    border-color: rgba(255, 0, 255, 0.35);
    /* Well clear of the card grid above: at the grid's own 1.5rem gap this read as a fifth
       card whose top border merged with the row above it, rather than as its own section. */
    margin-top: 3.5rem;
}

.lore-athena:hover {
    border-color: var(--cyberpunk-accent);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.2);
}

.lore-athena .feature-icon,
.lore-athena h3 {
    color: var(--cyberpunk-accent);
}

.lore-athena strong {
    color: var(--cyberpunk-accent);
}

/* Blazor's unhandled-error banner. The default template ships this rule in its own app.css;
   this project replaced that file wholesale and the rule went with it, so the div in index.html
   rendered with a plain block default - permanently visible on every page, announcing an error
   that never happened. Blazor sets an inline display:block when a real error occurs, which still
   overrides the "none" below. */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    background: #2a0a12;
    color: #ffdde5;
    border-top: 1px solid #ff3366;
    box-shadow: 0 -2px 12px rgba(255, 51, 102, 0.35);
}

#blazor-error-ui a {
    color: #ff3366;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
