/* ============================================================
   [BETA] 학생 포털 - 라이트 카드형 디자인 시스템
   기존 style.css(다크 글래스모피즘)와 완전히 분리된 별도 테마.
============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@400;500;600;700;800&display=swap');

/* width:100% + padding 조합이 border-box 없이는 padding만큼 넘치는 문제가 여러 버튼(전체 폭 버튼 전반)에서
   실제로 발생했음(사진 첨부 버튼, 이전/다음 강의 버튼 등) - 전체에 기본 리셋으로 한 번에 해결 */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --beta-bg: #f2f4f8;
    --beta-card: #ffffff;
    --beta-border: #eef0f5;
    --beta-text: #1c2130;
    --beta-text-muted: #8b93a7;
    --beta-primary: #6366f1;
    --beta-primary-soft: #eef0ff;
    --beta-danger: #ef4444;
    --beta-success: #10b981;
    --beta-warning: #f59e0b;
    --beta-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
    --beta-shadow-hover: 0 8px 24px rgba(15, 23, 42, 0.1);
    --beta-radius-lg: 20px;
    --beta-radius-md: 14px;
    --beta-radius-full: 999px;
}

body.beta-body {
    font-family: 'Pretendard', sans-serif;
    background: var(--beta-bg);
    color: var(--beta-text);
    margin: 0;
    min-height: 100vh;
}

.beta-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--beta-bg);
    padding-bottom: 40px;
}

/* --- 상단바 --- */
.beta-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    background: rgba(242, 244, 248, 0.92);
    backdrop-filter: blur(10px);
    z-index: 10;
}
.beta-topbar .beta-back {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--beta-radius-full);
    color: var(--beta-text);
    text-decoration: none;
    font-size: 1.2rem;
    background: var(--beta-card);
    box-shadow: var(--beta-shadow);
}
.beta-topbar .beta-logo {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.3px;
    text-decoration: none;
    color: var(--beta-text);
}
.beta-topbar .beta-logo small {
    display: block;
    font-size: 0.65rem;
    color: var(--beta-text-muted);
    font-weight: 500;
    text-align: center;
}
.beta-topbar .beta-spacer { width: 36px; }

/* --- 본문 --- */
.beta-main { padding: 4px 20px 20px; }

.beta-greeting {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 4px 0 2px;
}
.beta-greeting-sub {
    color: var(--beta-text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* --- 요약 pill 한 줄 통계 --- */
.beta-summary-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--beta-primary-soft);
    color: var(--beta-primary);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 12px 16px;
    border-radius: var(--beta-radius-full);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.beta-summary-pill .divider { color: rgba(99,102,241,0.35); font-weight: 400; }

/* --- 카드 공통 --- */
.beta-card {
    background: var(--beta-card);
    border-radius: var(--beta-radius-lg);
    box-shadow: var(--beta-shadow);
    margin-bottom: 14px;
    overflow: hidden;
}
.beta-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px 4px;
}
.beta-card-title { font-weight: 700; font-size: 0.95rem; }
.beta-card-link {
    font-size: 0.78rem; color: var(--beta-text-muted);
    text-decoration: none; display: flex; align-items: center; gap: 2px;
}

/* --- 리스트 행 (출결/과제/공지) --- */
.beta-row {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px;
    text-decoration: none; color: var(--beta-text);
    border-top: 1px solid var(--beta-border);
}
.beta-row:first-of-type { border-top: none; }
.beta-row-body { flex: 1; min-width: 0; }
.beta-row-title { font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.beta-row-sub { font-size: 0.76rem; color: var(--beta-text-muted); margin-top: 2px; }
.beta-row-chevron { color: #c7cbd6; font-size: 0.9rem; }

/* --- 필수강의 완강 섹션(카테고리별 그룹핑) --- */
.beta-section-divider {
    padding: 14px 18px 6px;
    font-size: 0.8rem; font-weight: 700; color: var(--beta-text-muted);
    border-top: 1px solid var(--beta-border);
    background: #fafbfc;
}
.beta-category-header {
    padding: 8px 18px 4px;
    font-size: 0.74rem; font-weight: 700; color: var(--beta-primary);
    background: #fafbfc;
}

/* --- 태그 pill (현장/필수/정규/라이브) --- */
.beta-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--beta-radius-full);
    background: #eef0f4;
    color: #5b6270;
    flex-shrink: 0;
}
.beta-tag.tag-live { background: rgba(239,68,68,0.12); color: var(--beta-danger); }
.beta-tag.tag-required { background: rgba(245,158,11,0.14); color: #b45309; }
.beta-tag.tag-regular { background: rgba(99,102,241,0.12); color: var(--beta-primary); }

/* --- 상태 배지 --- */
.beta-badge {
    font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: var(--beta-radius-full);
}
.beta-badge.b-danger { background: rgba(239,68,68,0.12); color: var(--beta-danger); }
.beta-badge.b-success { background: rgba(16,185,129,0.12); color: var(--beta-success); }
.beta-badge.b-warning { background: rgba(245,158,11,0.14); color: #b45309; }
.beta-badge.b-muted { background: #eef0f4; color: var(--beta-text-muted); }

/* --- 2단 액션 카드 (강의 3분류 등) --- */
.beta-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.beta-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }

.beta-action-card {
    background: var(--beta-card);
    border-radius: var(--beta-radius-md);
    box-shadow: var(--beta-shadow);
    padding: 16px 14px;
    text-decoration: none;
    color: var(--beta-text);
    display: flex; flex-direction: column; gap: 8px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}
.beta-action-card:active { transform: scale(0.97); }
.beta-action-card .beta-icon-circle { font-size: 1.3rem; }
.beta-action-card .beta-action-title { font-weight: 700; font-size: 0.85rem; line-height: 1.3; }
.beta-action-card .beta-action-sub { font-size: 0.72rem; color: var(--beta-text-muted); }
.beta-action-card.live { background: linear-gradient(135deg, #fee2e2, #ffffff); }

/* --- 아이콘 원형 로우 (공지/QnA/후기) --- */
.beta-icon-row {
    display: flex; justify-content: space-around;
    background: var(--beta-card);
    border-radius: var(--beta-radius-lg);
    box-shadow: var(--beta-shadow);
    padding: 18px 8px;
    margin-bottom: 14px;
}
.beta-icon-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    text-decoration: none; color: var(--beta-text);
    position: relative;
    flex: 1;
}
.beta-icon-circle-wrap {
    width: 46px; height: 46px;
    border-radius: var(--beta-radius-full);
    background: #f5f6fa;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    position: relative;
}
.beta-icon-item span.label { font-size: 0.72rem; font-weight: 600; color: var(--beta-text-muted); }
.beta-icon-badge {
    position: absolute; top: -2px; right: -2px;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: var(--beta-radius-full);
    background: var(--beta-danger);
    color: #fff; font-size: 0.65rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--beta-card);
}

/* --- 준비중 placeholder --- */
/* 아직 준비 안 된 기능: 내용은 블러로 가리고, 그 위에 안 흐린 "준비 중" 배지만 보여줌 */
.beta-action-card.beta-soon { position: relative; overflow: hidden; }
.beta-soon-content { filter: blur(5px); user-select: none; pointer-events: none; }
.beta-soon-badge {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    font-size: 0.78rem; font-weight: 700; color: var(--beta-text-muted);
    background: rgba(255,255,255,0.55);
}

/* --- 폼 요소 --- */
.beta-textarea, .beta-input {
    width: 100%;
    border: 1px solid var(--beta-border);
    border-radius: var(--beta-radius-md);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.88rem;
    box-sizing: border-box;
    background: #fafbfc;
    color: var(--beta-text);
}
.beta-textarea { min-height: 90px; resize: vertical; }
.beta-textarea:focus, .beta-input:focus { outline: none; border-color: var(--beta-primary); background: #fff; }

.beta-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--beta-primary);
    color: #fff; font-weight: 700; font-size: 0.85rem;
    border: none; border-radius: var(--beta-radius-full);
    padding: 12px 20px; cursor: pointer;
    width: 100%;
    box-shadow: 0 6px 16px rgba(99,102,241,0.28);
}
.beta-btn:active { transform: scale(0.98); }
.beta-btn.outline { background: #fff; color: var(--beta-primary); border: 1px solid var(--beta-primary); box-shadow: none; }
.beta-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- 탭(내 질문 / 공개 질문) --- */
.beta-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.beta-tab-btn {
    flex: 1; text-align: center; padding: 10px; border-radius: var(--beta-radius-full);
    background: var(--beta-card); color: var(--beta-text-muted); font-weight: 700; font-size: 0.85rem;
    box-shadow: var(--beta-shadow); cursor: pointer; border: none;
}
.beta-tab-btn.active { background: var(--beta-primary); color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,0.28); }

.beta-empty {
    text-align: center; color: var(--beta-text-muted); font-size: 0.85rem; padding: 40px 10px;
}

.beta-logout-row {
    display: flex; justify-content: center; gap: 20px;
    margin-top: 10px; font-size: 0.8rem; color: var(--beta-text-muted);
}
.beta-logout-row a { color: inherit; text-decoration: none; }

/* --- 사진 팝업(라이트박스) --- */
.beta-photo-modal {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(10,10,16,0.95);
    display: flex; flex-direction: column;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.beta-photo-modal.open { opacity: 1; pointer-events: auto; }
.beta-photo-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; color: #fff; font-weight: 700; font-size: 0.9rem;
    flex-shrink: 0;
}
.beta-photo-modal-close {
    background: rgba(255,255,255,0.14); border: none; color: #fff;
    width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; cursor: pointer;
}
/* 가로 스와이프로 넘기는 캐러셀. scroll-snap으로 네이티브 스와이프/모멘텀을 그대로 활용하고,
   touch-action에 pinch-zoom을 남겨둬서 브라우저 기본 핀치줌이 스와이프와 충돌 없이 같이 동작하게 함 */
.beta-photo-modal-body {
    flex: 1; display: flex; overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    touch-action: pan-x pinch-zoom;
}
.beta-photo-slide {
    flex: 0 0 100%; width: 100%; height: 100%;
    scroll-snap-align: center;
    display: flex; align-items: center; justify-content: center;
    padding: 0 14px 24px; box-sizing: border-box;
    overflow: auto; /* 확대했을 때 손가락/마우스로 끌어서 볼 수 있게 */
}
.beta-photo-slide img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    border-radius: 8px; cursor: zoom-in;
    transition: width 0.2s, height 0.2s;
    /* pinch-zoom만 있으면 이미지 위에서 시작하는 한손가락 스와이프를 브라우저가 스크롤로 안 넘겨줘서
       캐러셀 넘기기가 먹통이었음(사진이 화면 대부분을 차지해서 거의 항상 이미지 위에서 스와이프하게 됨) */
    touch-action: pan-x pinch-zoom;
}
.beta-photo-slide img.zoomed {
    max-width: none; max-height: none; width: auto; height: 220%; cursor: zoom-out;
    touch-action: auto; /* 확대 중엔 이미지 안에서 자유롭게 끌어서 볼 수 있어야 하니 제한 해제 */
}

.beta-photo-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,0.14); border: none; color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    z-index: 10;
}
.beta-photo-nav.prev { left: 10px; }
.beta-photo-nav.next { right: 10px; }
.beta-photo-nav:disabled { opacity: 0.25; }

/* --- 데스크톱에서도 폰 프레임처럼 보이지 않게, 그냥 중앙 정렬된 넓은 카드형 --- */
@media (min-width: 540px) {
    .beta-shell { box-shadow: 0 0 40px rgba(15,23,42,0.06); }
}

/* --- 태블릿 이상: 좁은 휴대폰 폭에 갇혀있던 걸 풀어줌 (아이패드 등, 특히 영상 시청 페이지) --- */
@media (min-width: 768px) {
    .beta-shell { max-width: 900px; }
    .beta-main { padding: 4px 32px 32px; }
    .beta-greeting { font-size: 1.6rem; }
    .beta-card-title { font-size: 1.05rem; }
    .beta-action-card .beta-action-title { font-size: 0.95rem; }
}
