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

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fb;
    color: #1e293b;
}

/* Navbar */
.navbar {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: #475569;
    font-weight: 500;
}

.nav-links a.active {
    color: #2563eb;
}

/* Buttons */
.btn-primary, .btn-success, .btn-danger, .btn-outline {
    padding: 0.5rem 1.2rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid #cbd5e1;
}

.btn-outline:hover {
    background: #f1f5f9;
}

/* Container */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* Course Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.card-content {
    padding: 1.2rem;
}

.card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.card p {
    color: #64748b;
    margin-bottom: 1rem;
    line-height: 1.4;
}

/* Access Panel */
.access-panel {
    background: #fef9c3;
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 1px solid #fde047;
}

.access-panel h3 {
    margin-bottom: 0.5rem;
}

.access-panel input {
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    width: 250px;
    margin-right: 0.5rem;
    margin-top: 0.5rem;
}

/* Player Layout */
.player-container {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    min-height: calc(100vh - 70px);
}

.player-sidebar {
    width: 350px;
    background: white;
    border-radius: 1rem;
    padding: 1.2rem;
    height: calc(100vh - 100px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.player-main {
    flex: 1;
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    min-height: 500px;
}

.content-tree {
    margin-top: 1rem;
}

.tree-node {
    margin-left: 1rem;
    padding: 0.3rem 0;
}

.subject-node {
    font-weight: 600;
    margin-top: 0.5rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 8px;
}

.subject-node:hover {
    background: #f1f5f9;
}

.paper-node {
    margin-left: 1rem;
    font-weight: 500;
    color: #475569;
    padding: 0.3rem;
}

.chapter-node {
    margin-left: 1rem;
    font-weight: 500;
    color: #2563eb;
    padding: 0.3rem;
}

.lecture-item {
    margin-left: 1.5rem;
    padding: 0.5rem;
    margin: 0.3rem 0;
    border-radius: 8px;
    cursor: pointer;
    color: #475569;
}

.lecture-item:hover {
    background: #eef2ff;
    color: #2563eb;
}

/* YouTube Player Container */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: black;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.lecture-placeholder {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
}

/* Admin Dashboard */
.dashboard-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.request-item, .user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.code-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem;
    border-bottom: 1px solid #e2e8f0;
    font-family: monospace;
}

.code-badge {
    background: #f1f5f9;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-family: monospace;
    font-size: 0.9rem;
}

.stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat {
    font-size: 1.1rem;
    font-weight: 600;
    background: #f8fafc;
    padding: 0.5rem 1rem;
    border-radius: 10px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.form-group input, .form-group select {
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    width: 100%;
    max-width: 400px;
    margin-top: 0.3rem;
}

.form-group small {
    font-size: 0.8rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
}

hr {
    margin: 1rem 0;
    border: none;
    border-top: 1px solid #e2e8f0;
}

.codes-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.structure-view {
    max-height: 400px;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
}

@media (max-width: 768px) {
    .player-container {
        flex-direction: column;
    }
    
    .player-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        height: auto;
        max-height: 400px;
    }
    
    .container {
        padding: 1rem;
    }
    
    .navbar {
        padding: 1rem;
    }
}
