:root {
    --bg-primary: #faf8f5;
    --bg-secondary: #f0ebe3;
    --bg-sidebar: #1a1a2e;
    --bg-sidebar-hover: #252542;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-light: #e8e8f0;
    --text-muted: #8a8aa0;
    --accent: #c9a227;
    --accent-hover: #d4b43a;
    --border: rgba(0,0,0,0.08);
    --shadow: rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Crimson Text', Georgia, serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar - Modern & Spacious */
.sidebar {
    width: 320px;
    background: linear-gradient(180deg, var(--bg-sidebar) 0%, #16162a 100%);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    transition: var(--transition);
}

.sidebar-header {
    padding: 32px 24px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.2);
}

.logo {
    font-size: 48px;
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.sidebar-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-light);
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Navigation */
.main-nav {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
}

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

.nav-section h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 12px;
}

.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.nav-btn:hover {
    background: var(--bg-sidebar-hover);
    border-color: rgba(255,255,255,0.1);
    transform: translateX(4px);
}

.nav-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a1a2e;
}

.nav-btn .icon {
    font-size: 1.2rem;
}

.nav-btn .badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 3px 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    color: inherit;
}

/* Resource Buttons in Sidebar */
.resource-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 6px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.resource-btn:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-light);
}

.resource-btn.active {
    background: rgba(201, 162, 39, 0.15);
    color: var(--accent);
}

/* Table of Contents in Sidebar */
.toc-container {
    max-height: 300px;
    overflow-y: auto;
}

.toc-act {
    margin-bottom: 12px;
}

.toc-act-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.toc-act-title:hover {
    background: rgba(255,255,255,0.05);
}

.toc-scenes {
    margin-top: 4px;
    padding-left: 16px;
}

.toc-scene {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 6px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border-left: 2px solid transparent;
}

.toc-scene:hover {
    color: var(--text-light);
    background: rgba(255,255,255,0.03);
    border-left-color: var(--accent);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.2);
}

.settings-group {
    margin-bottom: 16px;
}

.settings-group label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.settings-group select,
.settings-group input[type="range"] {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
}

.settings-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.3);
    color: #ff6b6b;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px var(--shadow);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-toggle-sidebar {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

.btn-toggle-sidebar span {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
}

.toolbar h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toolbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-arrows {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    padding: 8px 16px;
    border-radius: 50px;
    box-shadow: 0 2px 8px var(--shadow);
}

.nav-arrows button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.nav-arrows button:hover:not(:disabled) {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-arrows button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.location-indicator {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 150px;
    text-align: center;
}

.toolbar-right {
    display: flex;
    align-items: center;
}

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

.progress-bar {
    width: 120px;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    transition: width 0.3s ease;
}

.progress-indicator span {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 40px 60px;
    font-size: 18px;
    scroll-behavior: smooth;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 80px;
    margin-bottom: 24px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

.welcome-message h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.welcome-message p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.8;
}

.quick-actions {
    display: flex;
    gap: 16px;
}

.btn-primary {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border: none;
    border-radius: var(--radius);
    color: #1a1a2e;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(201, 162, 39, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 162, 39, 0.4);
}

/* Theatre Content Styling */
.theatre-content {
    max-width: 800px;
    margin: 0 auto;
}

.theatre-content h1.play-title {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 24px;
    border-bottom: 3px double var(--border);
}

.play-meta {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 48px;
}

.act-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 48px 0 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.scene-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-style: italic;
    margin: 32px 0 20px;
}

.character-line {
    margin: 20px 0;
    padding-left: 24px;
    border-left: 3px solid var(--accent);
}

.character-name {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.character-stage-dir {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9em;
}

.line-text {
    margin-top: 8px;
    line-height: 1.7;
}

.didascalie {
    font-style: italic;
    color: var(--text-secondary);
    margin: 20px 0;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--accent);
}

/* Resource Content (Full Screen) */
.resource-fullscreen {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0;
}

.resource-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.resource-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--text-primary);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-back:hover {
    background: var(--border);
    color: var(--text-primary);
}

.resource-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--text-primary);
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.resource-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin: 24px 0 12px;
}

.resource-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin: 20px 0 10px;
}

.resource-content p {
    margin-bottom: 16px;
    line-height: 1.7;
}

.resource-content ul {
    margin: 16px 0;
    padding-left: 24px;
}

.resource-content li {
    margin-bottom: 8px;
}

.resource-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Themes */
body.theme-light {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --border: rgba(0,0,0,0.08);
}

body.theme-dark {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --border: rgba(255,255,255,0.08);
}

body.theme-theater {
    --bg-primary: #0a0a12;
    --bg-secondary: #141420;
    --text-primary: #d4af37;
    --text-secondary: #8b7355;
    --accent: #d4af37;
    --accent-hover: #e4c04a;
    --border: rgba(212, 175, 55, 0.2);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -320px;
        height: 100vh;
        z-index: 100;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .btn-toggle-sidebar {
        display: flex;
    }
    
    .content-area {
        padding: 24px 32px;
    }
}

@media (max-width: 768px) {
    .toolbar {
        padding: 12px 16px;
    }
    
    .toolbar h2 {
        font-size: 1.125rem;
    }
    
    .nav-arrows {
        gap: 8px;
        padding: 6px 12px;
    }
    
    .content-area {
        padding: 16px 20px;
        font-size: 16px;
    }
    
    .theatre-content h1.play-title {
        font-size: 2rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}
