/* Notion Style Design System */
:root {
    --notion-bg: #ffffff;
    --notion-sidebar: #f7f6f3;
    --notion-text: #37352f;
    --notion-text-muted: rgba(55, 53, 47, 0.6);
    --notion-border: rgba(55, 53, 47, 0.16);
    --notion-hover: rgba(55, 53, 47, 0.08);
    --radius: 3px;
    --sidebar-width: 380px;
}

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

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background-color: var(--notion-bg);
    color: var(--notion-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.main-header {
    height: 45px;
    background-color: var(--notion-bg);
    border-bottom: 1px solid var(--notion-border);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    width: 100%;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
}

.logo:hover {
    background-color: var(--notion-hover);
}

/* Layout */
.app-container {
    display: flex;
    height: calc(100vh - 45px);
}

.player-section {
    flex: 1;
    padding: 40px 60px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--notion-sidebar);
    border-left: 1px solid var(--notion-border);
    display: flex;
    flex-direction: column;
}

/* Video Player */
.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* Back to original aspect ratio */
    background-color: #000;
    border-radius: var(--radius);
    overflow: hidden; /* Standard hidden, no zoom */
    border: 1px solid var(--notion-border);
}

#yt-player {
    width: 100%;
    height: 100%;
}

.video-surface {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 10;
}

/* NEW Subtitle Area Styling BELOW the video */
.subtitle-area {
    margin-top: 20px;
    padding: 30px;
    background-color: #fafafa;
    border: 1px solid var(--notion-border);
    border-radius: var(--radius);
    text-align: center;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.current-subtitle {
    color: var(--notion-text);
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: 12px;
    line-height: 1.5;
}

.current-subtitle span.word {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.current-subtitle span.word:hover {
    background-color: var(--notion-hover);
    color: #000;
}

.current-translation {
    color: var(--notion-text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

.current-translation {
    color: var(--notion-text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Progress bar */
.progress-container {
    padding: 10px 0;
    cursor: pointer;
}

.progress-bar {
    height: 4px;
    background-color: var(--notion-border);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.progress-filled {
    height: 100%;
    background-color: #37352f;
    width: 0%;
}

.video-surface {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 100px); /* Leave area for overlay interaction */
    cursor: pointer;
    z-index: 10;
}

/* Controls */
.player-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--notion-border);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.time-display {
    font-size: 12px;
    color: var(--notion-text-muted);
}

/* Buttons */
.btn-ghost {
    background: none;
    border: none;
    padding: 6px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    color: var(--notion-text);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-ghost:hover {
    background-color: var(--notion-hover);
}

.btn-text {
    background: none;
    border: none;
    color: var(--notion-text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
}

.btn-text:hover {
    background-color: var(--notion-hover);
    color: var(--notion-text);
}

.speed-btn {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: var(--radius);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--notion-text-muted);
}

.speed-btn.active {
    background-color: var(--notion-border);
    color: var(--notion-text);
    font-weight: 600;
}

.btn-blue {
    background-color: #2383e2;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.btn-blue:hover {
    background-color: #1a6ab3;
}

/* Sidebar Script List */
.sidebar-tabs {
    display: flex;
    padding: 8px;
    gap: 4px;
}

.tab-btn {
    padding: 6px 12px;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--notion-text-muted);
    cursor: pointer;
    border-radius: var(--radius);
}

.tab-btn.active {
    background-color: var(--notion-hover);
    color: var(--notion-text);
    font-weight: 500;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

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

.sidebar-header h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--notion-text-muted);
}

.script-item {
    padding: 10px;
    border-radius: var(--radius);
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.script-item:hover {
    background-color: var(--notion-hover);
}

.script-item.active {
    background-color: var(--notion-hover);
    border-left: 2px solid var(--notion-text);
}

.script-time {
    font-size: 10px;
    color: var(--notion-text-muted);
    margin-bottom: 2px;
}

.script-text {
    font-size: 14px;
}

.script-trans {
    font-size: 12px;
    color: var(--notion-text-muted);
}

/* Dictionary Search Tab */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-box input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--notion-border);
    border-radius: var(--radius);
    font-size: 14px;
    background-color: var(--notion-bg);
}

.search-box input:focus {
    outline: none;
    border-color: var(--notion-text-muted);
}

.search-box button {
    background: none;
    border: 1px solid var(--notion-border);
    border-radius: var(--radius);
    padding: 6px 10px;
    cursor: pointer;
}

.search-box button:hover {
    background-color: var(--notion-hover);
}

.empty-state {
    font-size: 13px;
    color: var(--notion-text-muted);
    text-align: center;
    padding-top: 40px;
}

/* Modal Popup */
.word-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: var(--notion-bg);
    border: 1px solid var(--notion-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 20px;
}

.word-popup.hidden {
    display: none;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.popup-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.popup-body .phonetic {
    font-size: 12px;
    color: var(--notion-text-muted);
    margin-bottom: 12px;
}

.popup-body .meaning {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 12px;
}

.popup-body .example {
    font-size: 13px;
    font-style: italic;
    color: var(--notion-text-muted);
    margin-bottom: 20px;
}

.popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-thumb {
    background: rgba(55, 53, 47, 0.1);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(55, 53, 47, 0.2);
}

/* Dashboard Home Styles */
.home-layout {
    display: flex;
    height: 100vh;
    background-color: var(--notion-bg);
}

.dashboard-sidebar {
    width: 240px;
    background-color: var(--notion-sidebar);
    border-right: 1px solid var(--notion-border);
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 32px;
}

.user-avatar {
    font-size: 20px;
    background: var(--notion-hover);
    padding: 4px;
    border-radius: var(--radius);
}

.sidebar-nav {
    flex: 1;
}

.nav-item {
    display: block;
    text-decoration: none;
    color: var(--notion-text);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 4px;
    transition: background 0.2s;
}

.nav-item:hover {
    background-color: var(--notion-hover);
}

.nav-item.active {
    background-color: var(--notion-hover);
    font-weight: 600;
}

.dashboard-main {
    flex: 1;
    overflow-y: auto;
    padding: 40px 60px;
}

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

.header-breadcrumb {
    font-size: 13px;
    color: var(--notion-text-muted);
}

/* Hero Section */
.hero-section h1 {
    font-size: 32px;
    margin-bottom: 12px;
}

.hero-section p {
    color: var(--notion-text-muted);
    margin-bottom: 32px;
}

.import-bar {
    display: flex;
    max-width: 600px;
    gap: 12px;
    margin-bottom: 64px;
}

.import-bar input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--notion-border);
    border-radius: var(--radius);
    font-size: 14px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 24px;
    margin-bottom: 64px;
}

.video-card {
    background-color: #fff;
    border: 1px solid var(--notion-border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-2px);
    border-color: var(--notion-text-muted);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #ddd;
    overflow: hidden;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    padding: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-meta {
    font-size: 11px;
    color: var(--notion-text-muted);
}

/* Mini word list */
.words-mini-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.word-tag {
    padding: 8px 14px;
    background-color: var(--notion-sidebar);
    border: 1px solid var(--notion-border);
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.word-tag small {
    color: var(--notion-text-muted);
}

.empty-text {
    font-size: 13px;
    color: var(--notion-text-muted);
}
