/* ============================================
   Layout - App Container, Sidebar, Canvas
   ============================================ */

/* Ambient background */
.ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 0%, rgba(201, 169, 98, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(120, 100, 180, 0.06) 0%, transparent 50%);
}

/* Main Layout */
.app-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.sidebar-header {
    padding: 32px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 18px;
    background: linear-gradient(180deg, rgba(201, 169, 98, 0.08) 0%, transparent 100%);
}

.logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent) 0%, #d4b872 50%, #8b7355 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(201, 169, 98, 0.3);
}

.logo-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.logo-text {
    font-weight: 800;
    font-size: 30px;
    letter-spacing: -0.5px;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-tagline {
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    font-style: italic;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Scrollbar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Section - Collapsible */
.section {
    margin-bottom: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    background: var(--bg-secondary);
    border-bottom: 1px solid transparent;
}

.section-header:hover {
    background: var(--bg-elevated);
}

.section.expanded .section-header {
    border-bottom-color: var(--border);
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.section-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.section.expanded .section-toggle {
    transform: rotate(180deg);
}

.section-badge {
    font-size: 10px;
    padding: 3px 8px;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 100px;
    font-weight: 500;
}

.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 16px;
}

.section.expanded .section-content {
    max-height: 3000px;
    padding: 16px;
    overflow: visible;
}

/* Location Marker */
.location-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -100%);
    z-index: 1100;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: opacity 0.3s ease;
}

.location-marker svg {
    width: 40px;
    height: 40px;
}

.location-marker.hidden {
    opacity: 0;
}

/* Map Scale Bar - Classic Ruler Style */
.maplibregl-ctrl-scale {
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid #2C2C2C !important;
    border-left: 2px solid #2C2C2C !important;
    border-right: 2px solid #2C2C2C !important;
    border-radius: 0 !important;
    padding: 0 4px !important;
    padding-bottom: 2px !important;
    font-size: 11px !important;
    font-family: 'JetBrains Mono', monospace !important;
    color: #2C2C2C !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    text-shadow:
        -1px -1px 0 rgba(255, 255, 255, 0.9),
        1px -1px 0 rgba(255, 255, 255, 0.9),
        -1px 1px 0 rgba(255, 255, 255, 0.9),
        1px 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.maplibregl-ctrl-top-left {
    top: 12px !important;
    left: 12px !important;
}

/* Icon Style Grid */
.icon-style-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.icon-style-btn {
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 8px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.icon-style-btn:hover {
    border-color: var(--border-hover);
}

.icon-style-btn.active {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.icon-style-btn svg {
    width: 24px;
    height: 24px;
}

.icon-style-btn span {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

.icon-style-btn.active span {
    color: var(--accent);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-brand {
    font-size: 13px;
    color: var(--accent);
}

.footer-brand a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

.footer-brand a:hover {
    color: var(--accent-hover);
}

/* Main canvas area */
.canvas-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background:
        linear-gradient(90deg, var(--border) 1px, transparent 1px),
        linear-gradient(var(--border) 1px, transparent 1px);
    background-size: 20px 20px;
    position: relative;
}

/* Toolbar */
.canvas-toolbar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    background: var(--bg-card);
    padding: 8px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.toolbar-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.toolbar-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.toolbar-divider {
    width: 1px;
    background: var(--border);
    margin: 4px 4px;
}

/* Info Button */
.info-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #d4b872 100%);
    border: none;
    color: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 100;
    box-shadow: 0 4px 20px rgba(201, 169, 98, 0.4);
}

.info-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(201, 169, 98, 0.6);
}

.info-btn svg {
    width: 24px;
    height: 24px;
}

/* Responsive */
@media (max-width: 1200px) {
    .poster-frame {
        width: 340px;
    }
}

@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        max-height: 50vh;
    }

    .canvas-area {
        min-height: 60vh;
    }

    .poster-frame {
        width: min(90%, 360px);
    }
}