:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-light: #e2e8f0;
    --accent: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
}

/* --- Login Page Split Layout --- */
.login-split-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.login-left {
    flex: 1.2;
    background: linear-gradient(rgba(0, 31, 63, 0.4), rgba(0, 31, 63, 0.4)), url('../images/login_banner.png');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    color: white;
}

.login-left-content {
    max-width: 500px;
    z-index: 1;
}

.login-left-content h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
}

.login-left-content p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-white);
    padding: 40px;
}

.login-form-card {
    width: 100%;
    max-width: 400px;
}

.login-form-card h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.login-form-card p.subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* --- Login Page Refinement --- */
.login-brand-mobile {
    display: none;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

.login-brand-mobile span {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0;
    margin-top: -2px;
}

@media (max-width: 900px) {
    .login-left {
        display: none;
    }

    .login-split-container {
        background: linear-gradient(rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.8)), url('../images/login_banner.png');
        background-size: cover;
        background-position: center;
        justify-content: center;
        align-items: center;
        padding: 20px;
    }

    .login-right {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 32px 24px;
        border-radius: 24px;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
        max-width: 440px;
        width: 100%;
        flex: none;
    }

    .login-brand-mobile {
        display: block;
    }

    .login-form-card {
        padding: 0;
    }

    .login-form-card h1 {
        font-size: 1.75rem;
    }
}

/* --- Common Components (Restored) --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s;
    background: #f1f5f9;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.input-with-icon .form-control {
    padding-left: 48px;
}

.btn {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.alert {
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fee2e2;
}

.hint-box {
    margin-top: 32px;
    padding: 20px;
    background: #f8fafc;
    border: 1px dashed var(--border-light);
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hint-box code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-main);
}

/* --- Professional Header Navigation --- */
.header-nav {
    height: 70px;
    background: white;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-tag {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.admin-btn {
    background: #eff6ff;
    color: #2563eb;
}

.admin-btn:hover {
    background: #dbeafe;
}

.instructor-btn {
    background: #ecfdf5;
    color: #10b981;
}

.instructor-btn:hover {
    background: #d1fae5;
}

.timer-badge {
    background: #fffbeb;
    color: #d97706;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #fef3c7;
}

@media (max-width: 640px) {
    .header-nav {
        padding: 0 16px;
        height: 60px;
    }

    .user-tag {
        gap: 6px;
    }

    .timer-badge {
        padding: 6px 10px;
        font-size: 0.75rem;
        border-radius: 8px;
    }

    .logout-link {
        padding: 6px 10px;
        font-size: 0.75rem;
        border-radius: 8px;
    }

    .logotype {
        font-size: 1rem;
        letter-spacing: -0.5px;
    }
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}

.logout-link:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.watch-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 40px;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 32px;
}

@media (max-width: 1200px) {
    .watch-content {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .watch-content {
        padding: 12px;
        gap: 16px;
    }
    
    .video-main-card {
        border-radius: 12px;
    }
    
    .video-details {
        padding: 16px;
    }
    
    .video-details h2 {
        font-size: 1.25rem;
        line-height: 1.4;
    }

    .download-card, .sidebar-card {
        border-radius: 12px;
        padding: 16px;
    }
}

.video-main-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

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

.video-headline-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.video-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.dl-info-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.dl-info-sub {
    font-size: 0.8rem;
    color: #94a3b8;
}

@media (max-width: 768px) {
    .video-headline-area {
        margin-bottom: 12px;
    }
    
    .dl-info-name {
        font-size: 0.85rem;
    }
}

.video-details p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .video-details p {
        font-size: 0.85rem;
    }
}

.download-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-top: 24px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dl-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.dl-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.dl-item:hover {
    border-color: var(--primary-color);
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
}

.dl-icon {
    width: 40px;
    height: 40px;
    background: #dbeafe;
    color: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 16px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.notice-item {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.notice-item:last-child {
    border-bottom: none;
}

.notice-item .date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

@media (max-width: 640px) {
    .header-nav {
        padding: 0 16px;
    }

    .ticker-container {
        padding: 0 12px;
        gap: 8px;
        border-radius: 0 0 12px 12px;
    }

    .ticker-label {
        font-size: 0.65rem;
        padding: 1px 5px;
    }

    .ticker-item {
        font-size: 0.8rem;
    }

    .dl-list {
        grid-template-columns: 1fr;
    }
}
/* --- Live Question Ticker --- */
.ticker-container {
    background: #1e293b;
    color: white;
    padding: 0 24px;
    border-radius: 0 0 20px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    overflow: hidden;
    height: 50px;
}
.ticker-label {
    white-space: nowrap;
    background: #ef4444;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
}
.ticker-track-wrapper {
    flex: 1;
    height: 50px;
    overflow: hidden;
    position: relative;
}
.ticker-track {
    display: flex;
    flex-direction: column;
    position: absolute;
    width: 100%;
}
.ticker-item {
    height: 50px;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ticker-item strong { color: #38bdf8; margin-right: 8px; font-weight: 700; }

/* --- Enhanced Instructor UI --- */
.instructor-layout { display: grid; grid-template-columns: 320px 1fr 320px; gap: 20px; padding: 20px; height: calc(100vh - 70px); overflow: hidden; }
.col-panel { background: white; border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.panel-header { padding: 16px 20px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.panel-content { flex: 1; overflow-y: auto; padding: 15px; }

/* Timer Controls */
.timer-widget { background: #1e293b; color: white; padding: 20px; border-radius: 12px; text-align: center; margin-bottom: 20px; }
.timer-display { font-size: 2.5rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-bottom: 15px; color: #4ade80; }
.timer-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.t-btn { border: none; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; font-weight: 600; }
.t-start { background: #10b981; color: white; }
.t-pause { background: #f59e0b; color: white; }
.t-reset { background: #64748b; color: white; }

/* Chat-style Questions */
.chat-bubble { margin-bottom: 15px; max-width: 90%; }
.bubble-meta { font-size: 0.75rem; color: #64748b; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.bubble-content { background: #f1f5f9; padding: 12px 16px; border-radius: 4px 16px 16px 16px; font-size: 0.95rem; position: relative; }
.chat-bubble.pinned .bubble-content { background: #fffbeb; border: 1px solid #fde68a; }
.bubble-actions { margin-top: 6px; display: flex; gap: 8px; opacity: 0; transition: opacity 0.2s; }
.chat-bubble:hover .bubble-actions { opacity: 1; }

/* Saved Prompts */
.saved-prompt-item { padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 10px; cursor: pointer; transition: all 0.2s; position: relative; }
.saved-prompt-item:hover { border-color: #2563eb; background: #f0f9ff; }
.prompt-del { position: absolute; top: 5px; right: 5px; color: #ef4444; font-size: 0.8rem; padding: 4px; }

/* --- Mobile Premium Polish --- */
@media (max-width: 640px) {
    body {
        background-color: #f1f5f9;
    }

    .video-main-card, .download-card, .sidebar-card {
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
        border: 1px solid rgba(15, 23, 42, 0.05);
    }

    .btn, .nav-btn, .logout-link, .timer-badge {
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.1s active;
    }

    .btn:active {
        transform: scale(0.98);
    }
}
