/**
 * Layout Structure
 * Sidebar + Top Bar + 3-Panel Content Layout
 */

/* ============================================
   APP CONTAINER
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg-0);
}

/* Sidebar Overlay (Mobile Only) */
.sidebar-overlay {
    display: none;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--color-bg-1);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border-right: 1px solid var(--stroke-subtle);
    display: flex;
    flex-direction: column;
    padding: var(--space-3);
    gap: var(--space-2);
    overflow-y: auto;
    z-index: 100;
}

.sidebar-logo {
    height: 32px;
    display: flex;
    align-items: center;
    margin-bottom: var(--space-2);
    font-size: var(--type-h2);
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-0_5);
}

.sidebar-section + .sidebar-section {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--stroke-subtle);
}

.sidebar-label {
    font-size: var(--type-caption);
    color: var(--color-text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0 var(--space-2);
    margin-bottom: var(--space-1);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px var(--space-2);
    height: 40px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: var(--type-body-default);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--timing-fast) var(--ease-out);
    text-decoration: none;
    user-select: none;
    position: relative;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text-primary);
}

.sidebar-item.active {
    background: var(--color-accent-muted);
    color: var(--color-accent);
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-accent);
    border-radius: 0 2px 2px 0;
}

.sidebar-item.disabled {
    color: var(--color-text-disabled);
    cursor: not-allowed;
}

.sidebar-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-item-icon svg,
.sidebar-item-icon i {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

/* Sidebar Spacer (pushes content to bottom) */
.sidebar-spacer {
    flex: 1;
}

/* ============================================
   TOP BAR
   ============================================ */

.topbar {
    width: calc(100% - var(--sidebar-width));
    height: var(--topbar-height);
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    background: var(--color-bg-1);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border-bottom: 1px solid var(--stroke-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-3);
    z-index: 1000;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.topbar-title {
    font-size: var(--type-h1);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.topbar-balance {
    display: flex;
    align-items: center;
    padding: var(--space-1) 12px;
    height: 40px;
    background: rgba(26, 26, 32, 0.6);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--type-mono-large);
    font-weight: 600;
    color: var(--color-text-primary);
}

.topbar-profile {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg-3);
    border: 1px solid var(--stroke-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--timing-fast) var(--ease-out);
}

.topbar-profile:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #7289da;
    object-fit: cover;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    width: calc(100% - var(--sidebar-width));
    padding: var(--space-3);
    display: flex;
    gap: var(--panel-gap);
}

/* ============================================
   THREE-PANEL LAYOUT
   ============================================ */

.panel-left {
    width: var(--panel-left-width);
    min-width: var(--panel-left-width);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.panel-center {
    flex: 1;
    min-width: 0; /* Allows flex shrink */
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.panel-right {
    width: var(--panel-right-width);
    min-width: var(--panel-right-width);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Panel Container (Glass Card) */
.panel {
    background: var(--color-bg-2);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border: 1px solid var(--stroke-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-3);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.panel-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--stroke-subtle);
}

.panel-title {
    font-size: var(--type-h1);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-text-primary);
}

.panel-subtitle {
    font-size: var(--type-body-small);
    color: var(--color-text-secondary);
}

.panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Scrollable Panel */
.panel.scrollable {
    max-height: calc(100vh - var(--topbar-height) - (var(--space-3) * 2));
    overflow-y: auto;
}

.panel-right.scrollable {
    max-height: calc(100vh - var(--topbar-height) - (var(--space-3) * 2));
}

/* ============================================
   CONTROL SECTIONS (Left Panel)
   ============================================ */

.control-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.control-label {
    font-size: var(--type-label);
    color: var(--color-text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.01em;
}

.mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-1);
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.mode-btn {
    padding: var(--space-1) var(--space-2);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: var(--type-body-default);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--timing-fast) var(--ease-out);
}

.mode-btn:hover {
    color: var(--color-text-primary);
}

.mode-btn.active {
    background: var(--color-accent);
    color: #FFFFFF;
}

/* Multiplier Display */
.multiplier-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--stroke-subtle);
    border-radius: var(--radius-md);
    gap: var(--space-1);
}

.multiplier-label {
    font-size: var(--type-label);
    color: var(--color-text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.01em;
}

.multiplier-value {
    font-family: var(--font-mono);
    font-size: var(--type-display-xl);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-accent);
    line-height: 1;
}

.potential-win {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2);
    gap: var(--space-0_5);
}

.win-label {
    font-size: var(--type-caption);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.win-value {
    font-family: var(--font-mono);
    font-size: var(--type-mono-large);
    font-weight: 600;
    color: var(--color-success);
}

/* ============================================
   ACTIVITY FEED (Right Panel)
   ============================================ */

.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-1);
}

.activity-feed-title {
    font-size: var(--type-label);
    color: var(--color-text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.activity-feed-filter {
    font-size: var(--type-caption);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color var(--timing-instant) var(--ease-out);
}

.activity-feed-filter:hover {
    color: var(--color-text-primary);
}

.activity-empty {
    padding: var(--space-4);
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: var(--type-body-small);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 1280px) {
    .panel-right {
        display: none;
    }
    
    .main-content {
        gap: 12px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .topbar {
        width: calc(100% - 200px);
        left: 200px;
    }
    
    .main-content {
        margin-left: 200px;
        width: calc(100% - 200px);
        padding: var(--space-2);
    }
    
    .panel-left {
        width: 240px;
        min-width: 240px;
    }
    
    .topbar-title {
        font-size: var(--type-h2);
    }
}

/* Mobile & Tablet Responsive (768px and below) */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--timing-default) var(--ease-out);
        width: 280px;
        z-index: 2000;
        box-shadow: var(--shadow-5);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Overlay for sidebar on mobile */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1999;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--timing-default) var(--ease-out);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        margin-top: var(--topbar-height);
        padding: var(--space-2);
        flex-direction: column;
    }
    
    .topbar {
        left: 0;
        width: 100%;
        padding: 0 var(--space-2);
    }
    
    .topbar-left {
        gap: var(--space-1_5);
    }
    
    .topbar-title {
        font-size: var(--type-body-large);
        font-weight: 600;
    }
    
    .topbar-right {
        gap: var(--space-1);
    }
    
    .topbar-balance {
        font-size: var(--type-body-default);
        padding: var(--space-1) 10px;
        height: 36px;
    }
    
    /* Mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: var(--color-bg-3);
        border: 1px solid var(--stroke-subtle);
        border-radius: var(--radius-sm);
        color: var(--color-text-primary);
        cursor: pointer;
        transition: all var(--timing-fast) var(--ease-out);
    }
    
    .mobile-menu-btn:active {
        transform: scale(0.95);
    }
    
    /* Convert 3-panel layout to single column */
    .panel-left,
    .panel-right {
        width: 100%;
        min-width: 100%;
    }
    
    .panel-center {
        width: 100%;
    }
    
    /* Make panels stack vertically */
    main {
        flex-direction: column !important;
        gap: var(--space-2) !important;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    .topbar {
        padding: 0 var(--space-1_5);
    }
    
    .main-content {
        padding: var(--space-1_5);
    }
    
    .topbar-title {
        display: none; /* Hide title on very small screens */
    }
    
    .topbar-balance {
        font-size: 14px;
        padding: var(--space-0_5) 8px;
        height: 32px;
    }
    
    .btn-small, .btn-sm {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .panel {
        padding: var(--space-2);
    }
}

/* Landscape phones */
@media (max-width: 896px) and (max-height: 414px) {
    .topbar-title {
        font-size: 14px;
    }
    
    .main-content {
        padding: var(--space-1_5);
    }
}
