/* CSS Variables for Premium Dark Theme */
:root {
    --bg-dark: #0a0b10;
    --bg-card: rgba(21, 24, 36, 0.5);
    --bg-sidebar: #0f111a;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --border-color: rgba(255, 255, 255, 0.08);
    
    --text-primary: #f0f2f5;
    --text-secondary: #9aa2b1;
    --text-muted: #5e6675;
    
    --primary: #8a2be2; /* Neon purple */
    --primary-glow: rgba(138, 43, 226, 0.4);
    --accent: #00e5ff; /* Cyan accent */
    --accent-glow: rgba(0, 229, 255, 0.3);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --font-main: 'Outfit', 'Noto Sans KR', -apple-system, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
}

/* App Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
    width: 100vw;
}

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

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    color: var(--accent);
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo h1 span {
    color: var(--primary);
    font-weight: 400;
}

.sidebar-menu {
    flex: 1;
    padding: 24px 16px;
}

.menu-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    padding-left: 8px;
}

.streamer-nav {
    list-style: none;
}

.streamer-nav li {
    margin-bottom: 4px;
}

.streamer-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.streamer-nav a:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.streamer-nav li.active a {
    background: linear-gradient(135deg, var(--primary), rgba(138, 43, 226, 0.4));
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.indicator-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* Auth Status Panel in Sidebar */
.auth-panel {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.2);
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.status-dot.offline {
    background-color: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-auth {
    background: linear-gradient(135deg, #4285f4, #357ae8);
    color: white;
    width: 100%;
}

.btn-auth:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.btn-secondary {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none !important;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.main-header {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.header-breadcrumb .inactive {
    color: var(--text-muted);
}

.header-breadcrumb .breadcrumb-separator {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.header-breadcrumb .active {
    font-weight: 600;
    color: var(--text-primary);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

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

/* Content Views */
.content-view {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.content-view:not(.active) {
    display: none !important;
}

/* Welcome Dashboard */
.welcome-banner {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.15) 0%, rgba(0, 229, 255, 0.05) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--primary);
    filter: blur(120px);
    opacity: 0.15;
}

.welcome-text h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(90deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-text p {
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 650px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-premium);
}

.stat-icon {
    color: var(--primary);
    width: 36px;
    height: 36px;
    padding: 8px;
    background-color: rgba(138, 43, 226, 0.1);
    border-radius: 8px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.instructions-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.instructions-card h3 {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
}

.instructions-card ol {
    margin-left: 20px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.instructions-card li {
    margin-bottom: 8px;
}

/* Recordings View */
.view-header {
    margin-bottom: 28px;
}

.streamer-heading {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.streamer-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.recordings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* Glassmorphism Card Style */
.recording-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.recording-card:hover {
    transform: translateY(-4px);
    border-color: rgba(138, 43, 226, 0.3);
    box-shadow: 0 12px 30px var(--primary-glow);
}

.card-thumbnail {
    height: 160px;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.thumbnail-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.card-details {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-details h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
    word-break: break-all;
}

.meta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-features {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--bg-hover);
    color: var(--text-secondary);
}

.badge.active {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.card-actions {
    margin-top: auto;
}

.btn-play {
    background: linear-gradient(135deg, var(--primary) 0%, #a050ff 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-play:hover {
    box-shadow: 0 4px 15px var(--primary-glow);
    filter: brightness(1.15);
}

/* Empty & Loading Shimmer States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    text-align: center;
}

.empty-icon {
    width: 60px;
    height: 60px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
}

.shimmer-sidebar {
    padding: 10px;
}

.shimmer-sidebar .shimmer-item {
    height: 40px;
    background-color: var(--bg-hover);
    border-radius: 6px;
    margin-bottom: 8px;
    animation: shimmer 1.5s infinite linear;
}

.shimmer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.shimmer-card {
    height: 320px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% { opacity: 0.5; }
    50% { opacity: 0.8; }
    100% { opacity: 0.5; }
}

/* Integrated Synced Player View */
.player-container {
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.player-back-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.player-back-bar h3 {
    font-size: 1.15rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-workspace {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    min-height: 0; /* Important for scroll container inside grid */
}

.video-section {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    min-height: 0;
}

.video-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

#main-video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    outline: none;
}

/* Chat Sidebar Panel */
.chat-section {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.chat-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-mini-toggle {
    background: none;
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-smooth);
}

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

.btn-mini-toggle.active {
    background-color: rgba(138, 43, 226, 0.15);
    border-color: var(--primary);
    color: var(--accent);
}

.comments-feed {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Chat bubble aesthetics */
.chat-bubble {
    padding: 8px 12px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: var(--transition-smooth);
}

.chat-bubble:hover {
    background-color: var(--bg-hover);
    border-color: rgba(255, 255, 255, 0.05);
}

.chat-bubble.active {
    background-gradient: linear-gradient(135deg, rgba(138, 43, 226, 0.1) 0%, rgba(0, 229, 255, 0.05) 100%);
    background-color: rgba(138, 43, 226, 0.1);
    border-color: var(--primary);
    box-shadow: inset 0 0 8px rgba(138, 43, 226, 0.2);
}

.chat-bubble.future {
    display: none !important;
}

.chat-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.75rem;
}

.chat-user {
    font-weight: 600;
    color: var(--accent);
}

.chat-time {
    color: var(--text-muted);
}

.chat-msg {
    color: var(--text-primary);
    word-break: break-all;
}

.comments-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 20px;
}

/* Floating Scroll Resume Button */
.btn-floating-resume {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary) 0%, #a050ff 100%);
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-floating-resume:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none; /* In production, we'd add a burger menu. For now, simple hiding works */
    }
}

@media (max-width: 900px) {
    .player-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 300px;
    }
}
