/* =========================================
   Variables & Reset
   ========================================= */
:root {
    --bg-dark: #f5f5f7;
    --bg-panel: #ffffff;
    --bg-header: #ffffff;
    --accent-color: #00bcd4; /* Cyberpunk Cyan - keeping it bright but readable */
    --accent-hover: #008ba3;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: #d2d2d7;
    --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.05);
    
    --sidebar-width: 320px; /* Increased for wide logo */
    --header-height: 60px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* =========================================
   Main Grid Layout
   ========================================= */
.app-container {
    display: grid;
    /* 3-Column Layout: Left Sidebar, Main Content, Right Sidebar */
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--sidebar-width);
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* Prevent body scroll, handle scroll internally */
    transition: all 0.3s ease;
}

/* Mobile Utilities */
.mobile-only { display: none; }
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s;
}
.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* =========================================
   Sidebar Styling
   ========================================= */
.sidebar {
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color); /* For right sidebar */
    display: flex;
    flex-direction: column;
    height: 100%;
}

.left-sidebar { border-left: none; }
.right-sidebar { border-right: none; }

.sidebar-title {
    padding: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background: var(--accent-color);
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.scrollable-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.scrollable-list::-webkit-scrollbar {
    width: 6px;
}
.scrollable-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

/* List Items */
.list-item {
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.list-item.active {
    background-color: rgba(0, 229, 255, 0.1);
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
}

/* =========================================
   Main Content Area
   ========================================= */
.main-content {
    background-color: var(--bg-dark);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden; /* Ensure it doesn't expand beyond grid cell */
    min-width: 0; /* meaningful for flex/grid children */
}

.top-bar {
    height: var(--header-height);
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
}

#pageTitle {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Preview Grid */
.preview-grid {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    overflow-x: auto; /* Allow horizontal scroll for wide banners */
    display: flex; 
    flex-wrap: wrap;
    align-content: flex-start; /* Corrects flex wrap spacing behavior */
    gap: 30px;
    justify-content: center;
}

.banner-card {
    background: transparent;
    border-radius: 8px;
    /* padding: 10px; */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: transform 0.2s;
}

/* Label above basic banners */
.banner-label {
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

iframe {
    border: none;
    background: #fff; /* Ensure banners have white bg if transparent */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); /* Pop out effect */
}

/* =========================================
   Controls & Inputs
   ========================================= */
.filter-controls {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.language-toggle {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

button {
    background: #333;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

button:hover {
    background: #444;
}

button.active {
    background: var(--accent-color);
    color: #000;
    font-weight: bold;
}

/* Action Button (Shared style for Show All and Download) */
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #333;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none; /* For <a> tags */
    transition: all 0.2s;
    font-family: inherit;
    width: 100%; /* Full width in sidebar */
    box-sizing: border-box;
    text-align: center;
}

.action-btn:hover {
    background: #444;
}

.action-btn.hidden {
    display: none;
}

/* Brand Logo Area */
.brand-logo {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: #000; /* Black background for logo presence */
    overflow: hidden; /* Prevent logo from overflowing */
}

.sidebar-logo {
    max-width: 100%;
    height: auto;
    max-height: 50px; /* Constrain height */
    object-fit: contain; /* Ensure logo stays within bounds */
    display: block;
}

/* Mobile Logo in Header */
.mobile-logo {
    height: 30px;
    width: auto;
    margin-left: 10px;
    display: none; /* Hidden by default (desktop) */
}

.empty-state {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-top: 100px;
}

/* =========================================
   Responsive Adjustments
   ========================================= */
@media (max-width: 1200px) {
    .app-container {
        /* Narrower sidebars on medium screens */
        grid-template-columns: 260px minmax(0, 1fr) 220px;
    }
}

@media (max-width: 900px) {
    .app-container {
        /* Collapse to single column on mobile */
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    .mobile-only { display: block; }
    .mobile-logo { display: block; } /* Explicitly show logo on mobile */

    /* Convert sidebars to off-canvas drawers */
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        width: 300px; /* Slightly wider for mobile logo too */
        z-index: 100;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border: none;
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    }

    .left-sidebar {
        left: 0;
        transform: translateX(-100%);
    }

    .right-sidebar {
        right: 0;
        transform: translateX(100%);
        border-right: none;
        border-left: 1px solid var(--border-color);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
        order: 1; /* Ensure content is first in stack order logic if needed */
    }

    /* Icon Buttons */
    .icon-btn {
        background: transparent;
        padding: 5px;
        color: var(--text-secondary);
    }
    .icon-btn:hover {
        background: rgba(255,255,255,0.1);
        color: var(--text-primary);
    }
}

/* =========================================
   Desktop Sidebar Toggling
   ========================================= */
.app-container.left-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) var(--sidebar-width);
}

.app-container.right-collapsed {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 0;
}

.app-container.left-collapsed.right-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 0;
}

.app-container.left-collapsed .left-sidebar,
.app-container.right-collapsed .right-sidebar {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0s 0.2s; /* Wait for opacity transition */
}

/* Toggle Buttons */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Desktop Only Utility */
.desktop-only { display: flex; }
@media (max-width: 900px) {
    .desktop-only { display: none !important; }
}
