@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #f1f5f9;       /* Light slate background */
    --card-bg: #ffffff;        /* Pure white cards */
    --card-bg-solid: #ffffff;
    --border-color: #e2e8f0;   /* Clean light gray borders */
    --border-glow: rgba(13, 148, 136, 0.3);
    --text-primary: #0f172a;   /* Dark slate for high contrast */
    --text-secondary: #475569; /* Medium slate */
    --text-muted: #94a3b8;     /* Light slate for less important elements */
    
    --primary: #0d9488;        /* Medical Teal */
    --primary-glow: rgba(13, 148, 136, 0.1);
    --primary-light: #f0fdfa;  /* Very soft teal background */
    --secondary: #2563eb;      /* Medical Blue */
    --secondary-glow: rgba(37, 99, 235, 0.1);
    
    --status-completed: #10b981;
    --status-completed-bg: #ecfdf5;
    --status-watching: #3b82f6;
    --status-watching-bg: #eff6ff;
    --status-notstarted: #64748b;
    --status-notstarted-bg: #f8fafc;
    
    --level-clear: #10b981;
    --level-warning: #d97706;  /* Slightly darker amber for light contrast */
    --level-danger: #dc2626;   /* Slightly darker red for light contrast */
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    
    --font-sans: 'Outfit', 'Noto Sans JP', sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-color);
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: var(--bg-color);
}

*::-webkit-scrollbar-thumb {
    background-color: var(--text-muted);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary);
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(13, 148, 136, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(37, 99, 235, 0.02) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 300px;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(13, 148, 136, 0.2);
}

.logo-icon svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.course-selector {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.form-select {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.menu-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 8px;
    padding-left: 12px;
    letter-spacing: 0.5px;
}

.subject-item {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.subject-item:hover {
    background: #f8fafc;
}

.subject-item.active {
    background: var(--primary-light);
    border-color: rgba(13, 148, 136, 0.15);
}

.subject-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.subject-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.subject-item.active .subject-name {
    color: var(--primary);
}

.subject-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.subject-progress-container {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.subject-progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #ffffff;
}

.btn-sidebar {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-sidebar:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.btn-sidebar-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(13, 148, 136, 0.15);
}

.btn-sidebar-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-0.5px);
}

.btn-sidebar-danger {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.btn-sidebar-danger:hover {
    background: #fee2e2;
    color: #991b1b;
}

/* Main Content Styling */
.main-content {
    flex: 1;
    margin-left: 300px;
    padding: 32px 40px;
    min-width: 0;
}

/* Header Dashboard Section */
.dashboard-header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

/* White Card with Subtle Shadow */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-glow);
}

.card-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 12px;
}

/* Circular Progress Chart */
.progress-chart-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.progress-svg-wrap {
    position: relative;
    width: 80px;
    height: 80px;
}

.progress-circle-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 7;
}

.progress-circle-bar {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.6s ease;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.progress-chart-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.progress-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.progress-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Target Planner Card */
.target-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.target-inputs {
    display: flex;
    gap: 8px;
}

.form-control-dark {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    outline: none;
    flex: 1;
    transition: var(--transition);
}

.form-control-dark:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.target-result-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.target-highlight {
    font-weight: 700;
    color: var(--primary);
}

/* Stats Counter Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.stat-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}

.stat-num {
    font-size: 1.15rem;
    font-weight: 700;
}

.stat-num.completed { color: var(--status-completed); }
.stat-num.watching { color: var(--status-watching); }
.stat-num.notstarted { color: var(--text-secondary); }

.stat-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Today's Focus Section */
.today-focus-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

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

.today-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.today-target-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.today-select {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

/* Weekly Streak Tracker */
.weekly-tracker {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
}

.week-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.week-day-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
}

.week-day-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition);
}

.week-day-circle.completed {
    background: var(--status-completed-bg);
    border-color: var(--status-completed);
    color: var(--status-completed);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.week-day-circle.today {
    border-color: var(--primary);
    color: var(--primary);
}

.today-playlist {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.today-video-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    gap: 12px;
    transition: var(--transition);
}

.today-video-row.completed {
    opacity: 0.75;
    background: #f1f5f9;
}

.today-video-row.completed .today-video-title {
    color: var(--text-muted);
    text-decoration: line-through;
}

.today-video-row:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.today-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    transition: var(--transition);
}

.today-checkbox.checked {
    background: var(--status-completed);
    border-color: var(--status-completed);
}

.today-checkbox.checked::after {
    content: "✓";
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.today-video-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
}

.today-video-title:hover {
    color: var(--primary);
}

.today-video-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Subject View Header */
.subject-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.subject-view-title {
    font-size: 1.4rem;
    font-weight: 700;
}

.subject-view-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.subject-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-action:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.btn-action-danger {
    background: #fef2f2;
    border-color: #fee2e2;
    color: #ef4444;
}

.btn-action-danger:hover {
    background: #fee2e2;
}

/* Chapter Accordion Style */
.chapter-container {
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.chapter-header {
    padding: 12px 20px;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.chapter-header:hover {
    background: #f1f5f9;
}

.chapter-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.chapter-chevron {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
    transition: var(--transition);
    transform: rotate(0deg);
}

.chapter-container.open .chapter-chevron {
    transform: rotate(90deg);
}

.chapter-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chapter-duration {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 6px;
}

.chapter-progress {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.chapter-body {
    display: none;
    border-top: 1px solid var(--border-color);
}

.chapter-container.open .chapter-body {
    display: block;
}

/* Expandable Video Row Design (Super Clean) */
.video-list {
    display: flex;
    flex-direction: column;
}

.video-row-wrapper {
    border-bottom: 1px solid var(--border-color);
}

.video-row-wrapper:last-child {
    border-bottom: none;
}

/* Collapsed Clean Row */
.video-row-main {
    display: grid;
    grid-template-columns: 40px 60px 1fr 80px 100px 40px;
    align-items: center;
    padding: 10px 20px;
    cursor: pointer;
    transition: var(--transition);
}

.video-row-main:hover {
    background: #f8fafc;
}

.video-checkbox-cell {
    display: flex;
    align-items: center;
}

.video-number {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.video-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-row-main.completed .video-title {
    color: var(--text-muted);
    text-decoration: line-through;
}

.video-duration {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.video-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
}

.video-badge.notstarted { background: #f1f5f9; color: var(--text-secondary); }
.video-badge.watching { background: #eff6ff; color: var(--status-watching); }
.video-badge.completed { background: #ecfdf5; color: var(--status-completed); }

.btn-star-cell {
    display: flex;
    justify-content: center;
}

.btn-star {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.btn-star:hover {
    color: var(--level-warning);
}

.btn-star.active {
    color: var(--level-warning);
}

/* Expanded Detail Row */
.video-row-detail {
    display: none;
    background: #f8fafc;
    padding: 12px 20px 16px 60px; /* Aligned with title */
    border-top: 1px dashed var(--border-color);
    border-bottom: 1px dashed var(--border-color);
}

.video-row-wrapper.expanded .video-row-detail {
    display: block;
}

.video-row-wrapper.expanded .video-row-main {
    background: #f8fafc;
}

.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
}

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.level-selector {
    display: flex;
    gap: 4px;
}

.btn-level {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.btn-level-clear.active {
    background: #ecfdf5;
    border-color: var(--level-clear);
}

.btn-level-warning.active {
    background: #fffbeb;
    border-color: var(--level-warning);
}

.btn-level-danger.active {
    background: #fef2f2;
    border-color: var(--level-danger);
}

.detail-memo-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.memo-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition);
}

.memo-input:focus {
    border-color: var(--primary);
}

.btn-link-out {
    align-self: end;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-link-out:hover {
    background: var(--primary-light);
}

/* Review Needed Panel */
.review-panel {
    margin-top: 28px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--level-warning);
}

.review-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.review-item-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    transition: var(--transition);
}

.review-item-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.review-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.review-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.review-item-title:hover {
    color: var(--primary);
}

.review-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.badge-level {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.badge-level-clear { background: #ecfdf5; color: var(--level-clear); }
.badge-level-warning { background: #fffbeb; color: var(--level-warning); }
.badge-level-danger { background: #fef2f2; color: var(--level-danger); }

/* Import/Settings Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal-content-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.btn-file-select {
    border: 2px dashed var(--border-color);
    background: #f8fafc;
    color: var(--text-secondary);
    padding: 24px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-file-select:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-input-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

/* Toast Alerts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: 6px;
    padding: 10px 16px;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transform: translateY(10px);
    opacity: 0;
    animation: slideIn 0.2s forwards;
}

@keyframes slideIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.toast-success { border-left-color: var(--status-completed); }
.toast.toast-error { border-left-color: var(--level-danger); }

/* mobile menu */
.mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

/* Responsive design */
@media (max-width: 1024px) {
    .mobile-header {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .dashboard-header {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .video-row-main {
        grid-template-columns: 40px 1fr 40px;
        padding: 10px 14px;
        gap: 4px;
    }
    
    .video-row-main .video-duration,
    .video-row-main .video-badge,
    .video-row-main .video-number {
        display: none;
    }
    
    .video-row-detail {
        padding: 12px 14px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* --- CBT & Unit Exam Styles --- */

/* CBT Milestone Roadmap */
.cbt-roadmap-section {
    padding: 20px;
}

.roadmap-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .roadmap-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.roadmap-milestone {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.milestone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.milestone-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.milestone-percent {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.roadmap-milestone:nth-child(2) .milestone-percent {
    color: var(--secondary);
}

.roadmap-milestone:nth-child(3) .milestone-percent {
    color: #ec4899;
}

.milestone-progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.milestone-progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 4px;
    width: 0%;
    transition: width 0.4s ease;
}

.milestone-dates-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 6px;
    margin-top: 2px;
}

.milestone-date-label {
    color: var(--text-muted);
}

.milestone-date-value {
    color: var(--text-secondary);
    font-weight: 600;
}

.milestone-stats {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.roadmap-advice-box {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* QB Chapter Checkbox */
.qb-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    transition: var(--transition);
}

.qb-checkbox:hover {
    border-color: var(--secondary);
}

.qb-checkbox.checked {
    background: var(--secondary);
    border-color: var(--secondary);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.qb-checkbox.checked::after {
    content: "Q";
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
}

/* Unit Exam Items in Pacemaker */
.unit-exam-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.unit-exam-item:hover {
    border-color: var(--secondary);
}

.exam-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.exam-title-text {
    font-weight: 600;
    color: var(--text-primary);
}

.exam-meta-text {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.btn-delete-exam {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px;
    transition: var(--transition);
}

.btn-delete-exam:hover {
    color: var(--level-danger);
}

/* Subject Sidebar Badge */
.subject-exam-badge {
    background: #fff7ed;
    border: 1px solid #ffedd5;
    color: #ea580c;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    white-space: nowrap;
    margin-left: 6px;
}

/* Unit Exam Alert Card in Subject Details */
.exam-alert-card {
    background: linear-gradient(135deg, #fffbeb, #fff7ed);
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Today's Task Advice Banner & Recommendation Badges */
.today-advice-banner {
    background: linear-gradient(135deg, #f0fdfa, #ecfdf5);
    border: 1px solid #ccfbf1;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}

.today-advice-banner-icon {
    font-size: 1.25rem;
    line-height: 1;
    margin-top: 1px;
}

.today-advice-banner-title {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 3px;
    font-size: 0.85rem;
}

/* Recommendation Badges in Playlist Checklist */
.recommend-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    text-align: center;
}

.recommend-badge.exam-prep {
    background: #ffedd5;
    color: #ea580c;
    border: 1px solid #ffedd5;
}

.recommend-badge.review-star {
    background: #fef9c3;
    color: #a16207;
    border: 1px solid #fef9c3;
}

.recommend-badge.review-weakness {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fee2e2;
}

.recommend-badge.normal-notstarted {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #f1f5f9;
}

.recommend-badge.normal-watching {
    background: #eff6ff;
    color: #3b82f6;
    border: 1px solid #eff6ff;
}

/* --- Help Button & Help Modal Styles --- */

/* Help trigger button (Floating / Glassmorphism on PC) */
.help-btn {
    position: fixed;
    top: 24px;
    right: 32px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 0;
}

.help-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2px;
    transition: transform 0.2s ease;
}

.help-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.3);
}

.help-btn:hover svg {
    transform: scale(1.05);
}

.help-btn:active {
    transform: translateY(0);
}

/* Onboarding / Help Modal sizing */
.help-modal-card {
    max-width: 700px !important;
    width: 90% !important;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Modal Tabs Navigation */
.help-tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
    padding: 8px 16px 0;
    gap: 4px;
}

.help-tab-btn {
    border: none;
    background: transparent;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.help-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.02);
}

.help-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: #ffffff;
}

/* Tab Panel content */
.help-modal-body {
    padding: 24px !important;
    max-height: 60vh;
    overflow-y: auto;
}

.help-intro-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* Tab 1: Steps Styling */
.help-steps-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.help-step-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    align-items: flex-start;
}

.help-step-num {
    background: var(--primary);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.help-step-content {
    flex: 1;
}

.help-step-content h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.help-step-content p {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
}

.help-step-content code {
    background: #e2e8f0;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.75rem;
}

/* Tab 2: Feature cards */
.help-features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.help-feature-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.help-feature-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.help-feature-card h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.help-feature-card p {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
}

/* Tab 3: FAQ */
.help-faq-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.help-faq-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
}

.help-faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.help-faq-q {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.help-faq-q::before {
    content: "Q.";
    color: var(--primary);
    font-weight: 800;
}

.help-faq-a {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
    padding-left: 20px;
}

/* Mobile responsive override */
@media (max-width: 1024px) {
    .help-btn {
        top: 10px;
        right: 16px;
        width: 36px;
        height: 36px;
        background: transparent;
        border-color: transparent;
        box-shadow: none;
        backdrop-filter: none;
        color: var(--text-primary);
    }
    
    .help-btn:hover {
        background: rgba(0, 0, 0, 0.05);
        color: var(--primary);
        transform: none;
        box-shadow: none;
    }
    
    .help-modal-body {
        padding: 16px !important;
    }
}
