/* ============================================================
   영어 영상 학습툴 — 새 사이트 테마 (크림 + 오렌지 + 네이비)
   base.css의 CSS 변수(--c-*)를 사용한다.
   메인 페이지 + 플레이어 페이지 공용.
   ============================================================ */

.video-study-wrap {
    font-family: var(--font-body);
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 56px 24px 72px;
    display: grid;
    gap: 26px;
    box-sizing: border-box;
}

:root {
    --subtitle-item-gap: 8px;
}

/* ---------- 페이지 헤더 ---------- */

.video-page-head {
    text-align: center;
    margin-bottom: 6px;
}

.video-eyebrow {
    font-family: var(--font-head);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--c-orange);
    margin: 0 0 12px;
}

.video-page-head .video-study-title {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    margin: 0 0 14px;
}

.video-page-head .video-study-desc {
    margin: 0;
    font-size: 1rem;
}

/* ---------- 카드 공통 ---------- */

.video-study-card,
.video-list-card {
    background: var(--c-cream-light);
    border: 1px solid var(--c-line);
    padding: 30px 28px;
}

.video-study-title {
    margin: 0 0 8px;
    font-family: var(--font-head);
    font-weight: 600;
    letter-spacing: -1px;
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--c-navy);
}

.video-study-desc {
    margin: 0 0 16px;
    color: var(--c-navy-soft);
    font-size: 0.95rem;
}

.video-box-title {
    margin: 0 0 16px;
    font-family: var(--font-head);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--c-navy);
}

/* ---------- 입력 ---------- */

.video-input-group {
    display: grid;
    gap: 12px;
}

.caption-check-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--c-navy-soft);
    cursor: pointer;
    justify-self: end;
    user-select: none;
}

.caption-check-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--c-orange);
}

.video-input-label {
    color: var(--c-navy);
    font-size: 0.9rem;
    font-weight: 700;
}

.video-input {
    width: 100%;
    border: 1px solid #DDD8CB;
    border-radius: 2px;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--c-navy);
    background: #fff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}

.video-input:focus {
    border-color: var(--c-orange);
}

.video-input::placeholder {
    color: #ADA793;
}

/* ---------- 버튼 ---------- */

.video-btn {
    justify-self: end;
    border: 0;
    border-radius: 4px;
    background: var(--c-orange);
    color: #fff;
    font-family: var(--font-head);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    height: auto;
    line-height: 1;
    transition: background 0.15s, transform 0.1s;
}

.video-btn:hover:not(:disabled) {
    background: var(--c-orange-dark);
}

.video-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.video-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.video-btn.danger {
    background-color: var(--c-orange);
    color: #fff;
}

.video-btn.danger:hover:not(:disabled) {
    background-color: var(--c-orange-dark);
}

.video-btn.small {
    padding: 9px 16px;
    font-size: 0.85rem;
}

.video-btn:disabled {
    background-color: #B9B3A2;
    cursor: not-allowed;
    opacity: 0.65;
}

/* ---------- 추천 채널 ---------- */

.yt-channel-card {
    padding: 24px 28px;
}

.yt-channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.yt-channel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 6px 10px;
    background-color: #fff;
    color: var(--c-navy);
    text-decoration: none;
    border-radius: 0;
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    border: 1px solid var(--c-line);
    transition: all 0.15s ease;
}

.yt-channel-btn:hover {
    border-color: var(--c-orange);
    color: var(--c-orange);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(31, 35, 51, 0.08);
}

/* ---------- LIST ---------- */

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

.video-list-title {
    margin: 0;
    font-family: var(--font-head);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--c-navy);
}

.video-list-limit-hint {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--c-navy-soft);
    margin-left: 8px;
    vertical-align: middle;
}

.video-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.video-list-empty {
    border: 1px dashed var(--c-line);
    padding: 18px;
    text-align: center;
    color: var(--c-navy-soft);
    background: var(--c-cream);
}

.video-note {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--c-navy-soft);
    text-align: right;
}

.video-job-item {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--c-line);
    background: #fff;
    margin-bottom: 12px;
    transition: box-shadow 0.15s ease;
}

.video-job-item:hover {
    box-shadow: 0 8px 20px rgba(31, 35, 51, 0.08);
}

.video-job-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.video-job-bottom-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 12px;
}

.video-job-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.video-job-no {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--c-navy-soft);
}

.video-job-title {
    font-size: 1rem;
    color: var(--c-navy);
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1.35;
    word-break: break-word;
}

.video-job-meta {
    font-size: 0.82rem;
    color: var(--c-navy-soft);
}

.job-error {
    margin-top: 6px;
    color: #C0392B;
    font-size: 0.82rem;
}

.video-job-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.video-job-date {
    font-size: 0.75rem;
    color: var(--c-navy-soft);
    font-weight: 400;
    flex-shrink: 0;
}

.video-job-main {
    min-width: 0;
}

.video-inline-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--c-orange);
    border-radius: 4px;
    background: transparent;
    color: var(--c-orange);
    font-family: var(--font-head);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    padding: 8px 14px;
    transition: background 0.15s, color 0.15s;
}

.video-inline-btn:hover {
    background: var(--c-orange);
    color: #fff;
}

.video-inline-btn.danger {
    border-color: #C0392B;
    background: transparent;
    color: #C0392B;
}

.video-inline-btn.danger:hover {
    background: #C0392B;
    color: #fff;
}

.video-check {
    margin: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--c-orange);
}

/* ============================================================
   플레이어 페이지
   ============================================================ */

.yt-player {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    margin-bottom: 12px;
}

.yt-player iframe,
.local-video-player {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: var(--video-ar, 16 / 9);
}

.video-click-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 64px;
    z-index: 2;
    border: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.video-click-overlay:focus {
    outline: none;
}

/* ── 자막 헤더 (타이틀 + 재생 버튼) ── */
.subtitle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: nowrap;
}

.subtitle-sync-controls {
    display: flex;
    align-items: center;
    gap: 2px;
}

.sync-btn {
    border: 1px solid var(--c-line);
    background: #fff;
    color: var(--c-navy);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 4px;
    cursor: pointer;
}

.sync-btn:hover {
    background: var(--c-cream);
}

.sync-offset-label {
    min-width: 30px;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--c-orange);
}

.player-btns {
    display: flex;
    gap: 6px;
}

.player-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--c-navy);
    cursor: pointer;
    padding: 0;
    transition: background 0.12s, transform 0.10s;
}

.player-btn:hover {
    background: #34394e;
}

.player-btn:active {
    transform: scale(0.90);
    background: var(--c-orange);
}

.player-btn img {
    width: 14px;
    height: 14px;
    display: block;
    pointer-events: none;
}

/* ── 자막 아이템 (3-column: 아이콘 | 시간 | 텍스트) ── */
.subtitle-item {
    display: grid;
    grid-template-columns: 26px 54px 1fr;
    gap: 6px;
    align-items: start;
    border: 1px solid var(--c-line);
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
    margin-bottom: var(--subtitle-item-gap);
    cursor: pointer;
    background: #fff;
}

.subtitle-item.active {
    border-color: var(--c-orange);
    background: var(--c-tint);
}

.subtitle-item.ghost {
    opacity: 0.22;
}

/* 아이콘 없는 빈 칼럼 */
.subtitle-icon-col {
    width: 22px;
    height: 22px;
}

/* ── 그룹(묶음) 아이콘 — 노란 하이라이트는 기능 색상으로 유지 ── */
.subtitle-group-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--c-line);
    border-radius: 5px;
    background: #FCFAF4;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.10s, box-shadow 0.12s;
}

.subtitle-group-btn.group-hover {
    background: #ffd666;
    border-color: #f0b429;
    box-shadow: 0 1px 4px rgba(240, 180, 41, 0.25);
}

.subtitle-group-btn.group-active {
    transform: scale(0.85);
    background: #ffca28;
    border-color: #e6a817;
}

.subtitle-icon {
    width: 14px;
    height: 14px;
    display: block;
    pointer-events: none;
}

.subtitle-time {
    color: var(--c-orange);
    font-size: 0.82rem;
    font-weight: 700;
}

.subtitle-text {
    color: var(--c-navy);
    font-size: 0.9rem;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.video-player-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    grid-template-rows: auto auto;
    gap: 16px;
    align-items: start;
}

.video-player-left {
    grid-column: 1;
    grid-row: 1;
}

.video-player-right {
    grid-column: 2;
    grid-row: 1 / 3;
}

.video-player-desc {
    grid-column: 1;
    grid-row: 2;
    color: var(--c-navy-soft);
    font-size: 0.9rem;
    line-height: 1.6;
}

.video-player-left .video-study-title {
    font-size: 1.1rem;
    letter-spacing: -0.3px;
    margin-bottom: 10px;
}

.video-player-title {
    font-weight: 700;
}

.video-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.video-player-header .video-study-title {
    margin-bottom: 0;
}

.video-player-header-btns {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.vp-header-btn {
    font-family: var(--font-head);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border: 1px solid var(--c-navy);
    border-radius: 4px;
    background: var(--c-navy);
    color: #fff;
    cursor: pointer;
    transition: background 0.12s;
}

.vp-header-btn:hover {
    background: #34394e;
}

.vp-header-btn:active {
    transform: scale(0.95);
}

.video-player-right {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.video-player-right .video-list-title {
    flex: 0 0 auto;
}

.subtitle-scroll {
    min-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

/* ── 자막 출처 배지/아이콘 ── */
.subtitle-source-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    vertical-align: middle;
}

.source-youtube {
    color: var(--c-orange);
}

.source-whisper {
    color: #3E8DF3;
}

.source-icon {
    font-size: 24px;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.analyze-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================================
   번역/어휘 모달
   ============================================================ */

.trans-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 35, 51, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.trans-modal {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    width: 90%;
    max-width: 420px;
    overflow: hidden;
    animation: transModalIn 0.18s ease-out;
}

@keyframes transModalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.trans-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--c-line);
}

.trans-modal-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--c-navy);
}

.trans-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--c-navy-soft);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.trans-modal-close:hover {
    color: var(--c-navy);
}

.trans-modal-body {
    padding: 16px 18px 20px;
    color: var(--c-navy);
}

.trans-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #ADA793;
    margin-bottom: 4px;
    letter-spacing: 0.03em;
}

.trans-section-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--c-navy);
}

.trans-en {
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.trans-ko {
    font-family: 'Gowun Dodum', 'Noto Sans KR', sans-serif;
}

.trans-divider {
    border: none;
    border-top: 1px solid var(--c-line);
    margin: 12px 0;
}

/* ── 문장학습 모달 헤더 오른쪽 (어휘찾기 + 닫기) ── */
.trans-modal-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vocab-open-btn {
    background: var(--c-navy);
    color: var(--c-yellow);
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s;
}

.vocab-open-btn:hover {
    background: #34394e;
}

/* ── 어휘 찾기 모달 (다크 컨셉 유지) ── */
.vocab-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 35, 51, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9100;
}

.vocab-modal {
    background: var(--c-navy);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: transModalIn 0.18s ease-out;
}

.vocab-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.vocab-modal-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--c-yellow);
}

.vocab-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.vocab-modal-close:hover {
    color: #fff;
}

.vocab-modal-body {
    padding: 14px 18px 18px;
    overflow-y: auto;
    flex: 1;
}

.vocab-section-label {
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    margin-bottom: 6px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.vocab-list {
    list-style: none;
    margin: 0 0 4px;
    padding: 0;
}

.vocab-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

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

.vocab-en {
    color: var(--c-yellow);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    flex-shrink: 0;
}

.vocab-kr {
    color: #dfe6eb;
    font-size: 13px;
    text-align: right;
    font-family: 'Gowun Dodum', 'Noto Sans KR', sans-serif;
}

.vocab-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 10px 0;
}

.vocab-empty {
    color: #9ca3af;
    font-size: 13px;
    padding: 4px 0;
}

.vocab-en-sentence {
    color: var(--c-yellow);
    font-size: 14px;
    line-height: 1.5;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    padding-bottom: 2px;
}

/* 숙어 하이라이트 — 반전 (노란 배경 + 어두운 글자) */
.vocab-hl-idiom {
    background: var(--c-yellow);
    color: var(--c-navy);
    border-radius: 3px;
    padding: 1px 3px;
    font-weight: 600;
}

/* 단어 하이라이트 — 밑줄 + 살짝 밝은 배경 */
.vocab-hl-word {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 3px;
    padding: 1px 3px;
    text-decoration: underline;
    text-decoration-color: #9ca3af;
    text-underline-offset: 2px;
}

.vocab-loading {
    color: #dfe6eb;
    font-size: 14px;
    text-align: center;
    padding: 20px 0;
}

/* ── 아이콘 세로 스택 (그룹 아이콘 + 문장 번역 아이콘) ── */
.subtitle-icon-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* ── 문장 번역 아이콘 버튼 (자막 목록 내) ── */
.subtitle-trans-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--c-line);
    border-radius: 5px;
    background: #FCFAF4;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.12s, border-color 0.12s, transform 0.10s;
}

.subtitle-trans-btn:hover {
    background: #c8e6c9;
    border-color: #66bb6a;
}

.subtitle-trans-btn:active {
    transform: scale(0.85);
    background: #a5d6a7;
}

.subtitle-trans-btn img {
    width: 14px;
    height: 14px;
    display: block;
    pointer-events: none;
}

/* ── 문장 번역 모달 ── */
.sentence-trans-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 35, 51, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9200;
}

.sentence-trans-modal {
    background: var(--c-navy);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    width: 90%;
    max-width: 380px;
    overflow: hidden;
    animation: transModalIn 0.18s ease-out;
}

.sentence-trans-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sentence-trans-label {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.sentence-trans-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #fff;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.sentence-trans-close:hover {
    color: #ccc;
}

.sentence-trans-body {
    padding: 16px 18px 20px;
}

.sentence-trans-en {
    color: var(--c-yellow);
    font-size: 15px;
    line-height: 1.6;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.sentence-trans-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: 12px 0;
}

.sentence-trans-ko {
    color: #FCFAF4;
    font-size: 15px;
    line-height: 1.6;
    font-family: 'Gowun Dodum', 'Noto Sans KR', sans-serif;
}

.sentence-trans-loading {
    color: #ccc;
    font-size: 14px;
    text-align: center;
    padding: 10px 0;
}

/* ============================================================
   반응형
   ============================================================ */

@media (max-width: 950px) {
    .video-study-wrap {
        padding: 36px 14px 48px;
    }

    .video-study-card,
    .video-list-card,
    .yt-channel-card {
        padding: 20px 16px;
    }

    .video-player-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .video-player-left,
    .video-player-right,
    .video-player-desc {
        grid-column: 1;
        grid-row: auto;
    }

    .video-player-desc {
        order: 3;
    }

    .yt-player {
        max-width: 100%;
    }

    .subtitle-scroll {
        min-height: 220px;
    }

    .subtitle-sync-controls {
        order: 3;
        width: 100%;
        justify-content: flex-end;
        margin-left: auto;
    }

    .yt-channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    .video-job-item {
        gap: 10px;
    }

    .video-job-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .video-job-title {
        width: 100%;
        font-size: 0.95rem;
    }

    .video-job-bottom-row {
        grid-template-columns: 52px 1fr auto;
        gap: 10px;
    }

    .video-job-action {
        grid-column: 3;
        justify-self: end;
        margin-top: 0;
    }
}
