:root {
    /* UI-UX Pro Max Design System: Simav Interactive Globe - Academic Modern Refinement */
    --color-primary: #1E3A8A;
    /* Deep Academic Blue */
    --color-secondary: #64748B;
    /* Slate Gray */
    --color-accent: #F59E0B;
    /* Amber Gold */
    --color-background: #F8FAFC;
    /* Clean Paper Gray/White */
    --color-surface: #FFFFFF;
    /* Pure White */
    --color-text: #0F172A;
    /* Dark Navy Text */
    --color-text-muted: #475569;
    /* Slate for labels */

    /* Spacing & Borders */

    /* Spacing & Borders */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --radius: 16px;

    /* Effects */
    --glass: none;
    /* Solid surfaces for academic professionalism */
    --hud-border: 1px solid #E2E8F0;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: 200ms ease-in-out;

    /* Header Dynamic Variables */
    --title-size: 2.22rem;
    --subtitle-size: 1.11rem;
    --header-font: 'Playfair Display', serif;
    --header-align-y: 20px;

    /* Legacy Aliases for Compatibility */
    --primary-color: var(--color-primary);
    --secondary-color: var(--color-secondary);
    --cta-color: var(--color-accent);
    --bg-color: var(--color-background);
    --surface-color: var(--color-surface);
}

@import url('https://fonts.googleapis.com/css2?family=Exo:wght@300;400;500;600;700&family=Roboto+Mono:wght@300;400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
}

body {
    overflow: hidden;
    background: #F1F5F9;
    /* Solid light academic background */
    font-family: 'Inter', sans-serif;
    color: var(--color-text);
    line-height: 1.5;
}

#canvas-container {
    width: 100vw;
    height: 100vh;
    /* Dynamic Viewport Height for Mobile */
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    touch-action: none;
    /* Prevent zooming/scrolling on canvas */
}

.ui-overlay {
    position: absolute;
    width: auto;
    /* Take only what's needed */
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 40px;
    /* Reduced top/bottom padding to 0 for absolute slider control */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    left: var(--header-align-x);
    top: var(--header-align-y);
    transform: translate(-50%, 0);
    /* Horizontal centering relative to align-x */
}

/* Fixed positioning classes removed in favor of dynamic --header-align-y */

.header-content {
    background: var(--color-surface);
    padding: 8px 30px;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    box-shadow: var(--shadow-md);
    text-align: center;
    min-width: 250px;
    max-width: 90vw;
    word-wrap: break-word;
}

.title {
    font-family: var(--header-font);
    color: var(--color-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-size: clamp(1rem, var(--title-size), 4vw);
    line-height: 1.2;
    letter-spacing: -0.5px;
    font-weight: 700;
    text-transform: none;
    text-align: center;
    transition: var(--transition);
}

.subtitle {
    font-family: 'Inter', sans-serif;
    color: var(--color-secondary);
    font-size: var(--subtitle-size);
    margin-top: 8px;
    font-weight: 500;
    letter-spacing: 0;
}

/* Sidebar */
.sidebar {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 20;
}

.panel {
    background: var(--color-background);
    padding: var(--space-md);
    border-radius: var(--radius);
    border: var(--hud-border);
    -webkit-backdrop-filter: var(--glass);
    backdrop-filter: var(--glass);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.panel:hover {
    box-shadow: 0 15px 45px rgba(3, 105, 161, 0.1);
    border-color: rgba(3, 105, 161, 0.3);
}

.panel h3 {
    font-family: 'Inter', sans-serif;
    margin-bottom: var(--space-md);
    font-size: 0.85rem;
    color: var(--color-accent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
}

/* Icons in H3 */
.panel h3 i,
.panel h3 svg {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

/* Grid Buttons */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

button {
    background: white;
    border: 1px solid #E2E8F0;
    color: var(--color-primary);
    padding: 10px 20px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
}

button:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
}

button.active {
    background: var(--color-primary);
    color: white;
    font-weight: bold;
}

.btn-danger {
    border-color: #ef4444;
    color: #ef4444;
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
}

.btn-danger:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Controls */
.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Inter', sans-serif;
}

input[type="range"] {
    width: 100%;
    cursor: pointer;
}

select.search-bar,
input.search-bar {
    padding: 10px 14px;
    background: white;
    color: var(--color-text);
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    appearance: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    width: 100%;
    transition: all var(--transition);
}

select.search-bar {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

select.search-bar:focus,
input.search-bar:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.05);
    outline: none;
}

option {
    background: white;
    color: var(--color-text);
    padding: 12px;
}

option {
    background: #1e293b;
    color: white;
    padding: 12px;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Drop Hint */
#drop-zone-hint {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 243, 255, 0.15);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px 25px;
    font-size: 1.5rem;
    font-family: 'Orbitron';
    color: white;
    text-shadow: 0 0 15px var(--primary-color);
    pointer-events: none;
    z-index: 50;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.hidden {
    display: none !important;
    opacity: 0;
}

/* Info Card */
.info-card {
    position: absolute;
    width: 300px;
    background: rgba(5, 10, 20, 0.95);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    z-index: 100;
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    overflow: hidden;
    transition: opacity 0.3s;
}

.card-header {
    background: rgba(0, 243, 255, 0.1);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 243, 255, 0.2);
}

#card-title {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1rem;
}

.close-card {
    cursor: pointer;
    font-size: 1.2rem;
}

.card-body {
    padding: 15px;
}

#card-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #333;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

#card-img:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
}

#card-img[style*="cursor: pointer"] {
    position: relative;
}

#card-img[style*="cursor: pointer"]::after {
    content: '🔗';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 243, 255, 0.9);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
}

#card-img[style*="cursor: pointer"]:hover::after {
    opacity: 1;
}

#card-desc {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #ddd;
    margin-bottom: 10px;
}

#card-date {
    display: block;
    font-size: 0.75rem;
    color: #888;
    text-align: right;
}

.card-footer {
    padding: 10px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #333;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.red {
    border-color: #ff5555;
    color: #ff5555;
}

.red:hover {
    background: #ff5555;
    color: white;
}

/* Search Bar */
.search-bar {
    width: 100%;
    padding: 10px;
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    color: var(--text-color);
    font-family: 'Exo 2';
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
}

.search-bar:focus {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.search-bar::placeholder {
    color: #666;
}

/* Category Filters */
.category-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.category-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.category-label input[type="checkbox"] {
    cursor: pointer;
}

.category-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 5px currentColor;
}

/* Statistics Panel */
.stats-panel {
    background: linear-gradient(135deg, rgba(10, 15, 30, 0.9), rgba(0, 50, 100, 0.3));
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: rgba(0, 243, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(0, 243, 255, 0.2);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    font-family: 'Orbitron';
}

.stat-label {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 2px;
}

/* Data Management Buttons */
.data-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-action {
    width: 100%;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px;
    border-radius: 4px;
    font-family: 'Exo 2';
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 10px var(--primary-color);
}

/* Pin Animations */
@keyframes pinDrop {
    0% {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }

    50% {
        transform: translateY(10px) scale(1.1);
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes pinPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

.pin-dropping {
    animation: pinDrop 0.6s ease-out;
}

.pin-pulse {
    animation: pinPulse 1.5s ease-in-out infinite;
}

/* Dimmed pins for filtering */
.pin-dimmed {
    opacity: 0.2 !important;
    filter: grayscale(80%);
}

/* Scrollbar for sidebar */
.sidebar {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding-right: 5px;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ========================================
   MOBILE AND TABLET RESPONSIVE STYLES
   ======================================== */

/* Hamburger Menu Button (Mobile Only) */
.hamburger-menu {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 10001;
    /* Higher than sidebar */
    background: var(--bg-dark);
    border: var(--hud-border);
    border-radius: 8px;
    width: 60px;
    height: 60px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    /* Improve touch response */
}

.hamburger-menu span {
    display: block;
    width: 30px;
    height: 3px;
    background: var(--primary-color);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger-menu:hover {
    background: rgba(0, 243, 255, 0.1);
    transform: scale(1.05);
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Tablet Styles (768px - 1024px) */
@media screen and (max-width: 1024px) {
    .sidebar {
        width: 300px;
    }

    .title {
        font-size: 1.5rem;
    }
}

/* Mobile Styles (< 768px) */
@media screen and (max-width: 768px) {

    /* Show hamburger menu */
    .hamburger-menu {
        display: flex;
    }

    /* Sidebar becomes full-screen overlay */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        z-index: 9999;
        transition: left 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 243, 255, 0.3);
    }

    .sidebar.active {
        left: 0;
    }

    /* Overlay backdrop when sidebar is open */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        z-index: 9998;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    body.sidebar-open::before {
        opacity: 1;
        pointer-events: all;
    }

    /* Adjust title for mobile */
    .title {
        font-size: 1.2rem;
        padding: 15px 20px;
        left: 70px;
    }

    /* Touch-friendly buttons */
    button,
    .btn-primary,
    .btn-action,
    .btn-danger {
        min-height: 44px;
        font-size: 0.9rem;
        padding: 12px 16px;
    }

    /* Stack grid buttons vertically on mobile */
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Reduce panel padding */
    .panel {
        padding: 15px;
    }

    .panel h3 {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    /* Smaller input fields */
    input[type="text"],
    input[type="url"],
    textarea {
        font-size: 16px;
        /* Prevents zoom on iOS */
        padding: 10px;
    }

    /* Info card adjustments */
    .info-card {
        max-width: 90%;
        width: 280px !important;
        padding: 12px;
        left: 5% !important;
        right: 5% !important;
    }

    .info-card img {
        max-width: 100% !important;
        max-height: 200px !important;
        width: auto !important;
        height: auto !important;
    }

    .info-card h2 {
        font-size: 1rem;
    }

    .info-card p {
        font-size: 0.8rem;
    }

    /* Statistics panel */
    .stat-item {
        font-size: 0.85rem;
    }

    /* Category filters */
    .category-filters {
        gap: 8px;
    }

    .category-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* Small Mobile (< 480px) */
@media screen and (max-width: 480px) {
    .sidebar {
        width: 90%;
    }

    .title {
        font-size: 1rem;
        left: 65px;
    }

    .hamburger-menu {
        width: 45px;
        height: 45px;
        top: 15px;
        left: 15px;
    }

    button,
    .btn-primary,
    .btn-action,
    .btn-danger {
        font-size: 0.85rem;
        padding: 10px 14px;
    }
}

/* Landscape mode on mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        width: 60%;
    }

    .panel {
        padding: 10px;
    }

    .panel h3 {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
}

/* Touch-specific improvements */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .switch {
        transform: scale(1.2);
    }

    /* Remove hover effects on touch devices */
    button:hover,
    .btn-primary:hover,
    .btn-action:hover {
        transform: none;
    }

    /* Active state instead of hover */
    button:active,
    .btn-primary:active,
    .btn-action:active {
        transform: scale(0.95);
    }
}

/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.85);
    /* Semi-transparent dark academic blue */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.modal-content {
    width: 90%;
    max-width: 450px;
    background: var(--color-surface);
    border: 1px solid var(--color-primary);
    box-shadow: 0 0 20px rgba(30, 58, 138, 0.5);
    /* Primary Blue Glow */
    border-radius: 8px;
    padding: 25px;
    animation: fadeIn 0.3s ease-out;
}

.modal-content h3 {
    margin-top: 0;
    color: var(--color-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-content label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #ccc;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    margin-bottom: 15px;
}

#drop-zone-hint {
    background: rgba(30, 58, 138, 0.9);
    /* Strong Academic Blue */
    border: 2px solid var(--color-secondary);
    /* Cyan Accent */
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 20px 40px;
    border-radius: 50px;
    pointer-events: auto;
    /* Enable clicks for cancel button */
    display: flex;
    /* Changed from just text to flex column */
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* Utility Classes for DOM Cleanup */
.mt-10 {
    margin-top: 10px;
}

.mr-5 {
    margin-right: 5px;
}

.w-100 {
    width: 100%;
}

.d-block {
    display: block;
}

.pointer {
    cursor: pointer;
}

.pointer-auto {
    pointer-events: auto;
}

.icon-sm {
    width: 14px;
    height: 14px;
}

/* Structural Classes */
.admin-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.panel-section-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    margin-top: 15px;
}

.panel-section-divider-thick {
    margin-top: 20px;
    border-top: 2px solid var(--color-primary);
    padding-top: 15px;
}

.btn-save-main {
    width: 100%;
    height: 50px;
    font-weight: bold;
    background: var(--color-primary);
    color: #0f172a;
}

.save-status-msg {
    text-align: center;
    margin-top: 8px;
    font-size: 0.8rem;
    height: 1.2em;
}

.pin-actions-message {
    text-align: center;
    padding: 15px;
    color: #888;
    font-size: 0.85rem;
}

.speed-label {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.speed-min-max {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-top: 2px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.reset-btn {
    width: 100%;
    margin-top: 5px;
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    font-size: 0.8rem;
}

.lang-toggle-btn {
    font-weight: bold;
    padding: 12px;
    font-size: 1rem;
}

/* Category Filter Dots */
.dot-general {
    background: #ff6b6b;
}

.dot-business {
    background: #4dabf7;
}

.dot-event {
    background: #51cf66;
}

.dot-personal {
    background: #9775fa;
}