/* Global theme definitions */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700;900&display=swap');

:root {
  --navy: #0b2345;
  --green: #0a7a3d;
  --red: #b00020;
  --ff: 'Pretendard','Apple SD Gothic Neo','Noto Sans KR','Malgun Gothic',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--ff);
  background: #fff;
  color: var(--navy);
}

/* Force all UI elements to share the same font (SimpleCSS can override some elements) */
body, button, input, select, textarea, h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff) !important;
}

a {
  color: var(--navy);
}

header {
  /* Force header to use a white background regardless of third‑party CSS */
  background: #fff !important;
  color: var(--navy) !important;
  border-bottom: 1px solid #eee;
}

header .brand {
  margin: .6rem 0;
  font-size: 1.6rem;
}

/* Page titles (e.g., '나의 윤클래스 강의실'): slightly larger than lesson code */
.page-title{
  margin:0 0 12px 0;
  text-align:center;
  font-size:1.62rem;
  font-weight:900;
  line-height:1.25;
  letter-spacing:.01em;
}


header nav a {
  color: var(--navy);
  margin-right: .5rem;
}

/* 학생 화면 상단: 로그아웃 버튼만 가운데 정렬 + 동일 폭 */
header nav.student-nav{
  display:flex;
  justify-content:center;
  gap:.5rem;
}
header nav.student-nav a.nav-logout{
  min-width: 120px;
  text-align:center;
  margin-right: 0;
}

/* 학생 화면 상단에서 '비밀번호 변경' 버튼도 동일 폭으로 맞춤 */
header nav.student-nav a:not([class]){
  min-width: 120px;
  text-align:center;
  margin-right: 0;
}

/* Ensure navigation buttons (login/signup) share consistent width and alignment */
header nav a.nav-btn {
  min-width: 80px;
  text-align: center;
}

main {
  max-width: 960px;
  margin: auto;
  padding: 1rem;
}

fieldset {
  border: 1px solid #d6e0f5;
  padding: .75rem;
  border-radius: .5rem;
}

legend {
  padding: 0 .4rem;
  font-weight: 600;
}

select {
  min-width: 140px;
  font-size: 1rem;
}

button, .btn { background: var(--navy); color:#fff; border:none; padding:.6rem 1rem; border-radius:.5rem; text-decoration:none; display:inline-block; }

/* 요청: 버튼 색상을 모두 동일 네이비(수업 영상 버튼과 동일)로 통일 */
.btn-outline { background: var(--navy); border:1px solid var(--navy); color: #fff; padding:.5rem .8rem; border-radius:.5rem; text-decoration:none; }

.badge-green {
  color: var(--green);
  font-weight: 700;
}

.badge-red {
  color: var(--red);
  font-weight: 700;
}

.footer-copy {
  text-align: center;
  color: #777;
  margin: 1rem 0 .5rem;
  font-size: .9rem;
}

#resultCard {
  background: #fff;
  padding: 1rem;
  border: 1px solid #e8eef9;
  border-radius: .75rem;
}

details > summary {
  cursor: pointer;
  padding: .4rem .6rem;
  border-radius: .5rem;
}

details[open] > summary {
  font-weight: 600;
}

@media (max-width: 768px) {
  main {
    padding: .75rem;
  }
  .page-title{font-size:1.45rem;}

  fieldset {
    padding: .5rem;
  }
  header nav a {
    display: inline-block;
    margin-right: .5rem;
  }
  select {
    width: 100%;
  }
  h2 {
    font-size: 1.35rem;
  }
}

/* Sign-up form customisations */
/* Ensure all inputs, selects and primary buttons in the signup form fill the available width */
#signupForm input[type="text"],
#signupForm input[type="password"],
#signupForm select,
#signupForm button.btn { background: var(--navy); color:#fff; border:none; padding:.6rem 1rem; border-radius:.5rem; text-decoration:none; display:inline-block; }

/* Add a top margin to the primary action button to separate it from preceding fields */
#signupForm button.btn { background: var(--navy); color:#fff; border:none; padding:.6rem 1rem; border-radius:.5rem; text-decoration:none; display:inline-block; }

#signupForm .field-group {
  margin-bottom: 0.75rem;
}

/* 모바일에서도 동일한 네이비 버튼 유지 (색상 통일 요구사항) */

/* === Custom patch: requested minimal styling === */

/* 1) Login screen bottom "회원가입" button -> full width, navy background, white text */
main a.btn-outline[href="/signup/"]{
  background: var(--navy) !important;
  color: #fff !important;
  border-color: var(--navy) !important;
  display: block !important;
  width: 100% !important;
}

/* 2) When user is logged in, header "내 시험", "로그아웃" (these anchors have no class) -> navy background, white text */
header nav a:not([class]){
  background: var(--navy) !important;
  color: #fff !important;
  border: 1px solid var(--navy) !important;
  padding: .5rem .8rem;
  border-radius: .5rem;
  text-decoration: none;
}
header nav a:not([class]):hover{ filter: brightness(0.92); }

/* 로그아웃 버튼(nav-logout)은 class가 있어 위 규칙에 포함되지 않으므로 동일 스타일 적용 */
header nav a.nav-logout{
  background: var(--navy) !important;
  color: #fff !important;
  border: 1px solid var(--navy) !important;
  padding: .5rem .8rem;
  border-radius: .5rem;
  text-decoration: none;
}
header nav a.nav-logout:hover{ filter: brightness(0.92); }



/* === Minimal patch per request === */

/* 1) 로그인 화면: 로그인 버튼(제출 버튼) 네이비/흰색 */
main form button.btn[type="submit"]{
  background: var(--navy) !important;
  color: #fff !important;
  border-color: var(--navy) !important;
}

/* 2) 사용자 화면: '응시하기' 버튼 네이비/흰색 */
main a.btn[href^="/exam/"]{
  background: var(--navy) !important;
  color:#fff !important;
  border-color: var(--navy) !important;
}
main a.btn[href^="/exam/"]:hover{ filter: brightness(0.92); }



/* Mobile-optimized widths for primary actions */
@media (max-width: 768px) {
  .btn, .btn-outline, a.btn { background: var(--navy); color:#fff; border:none; padding:.6rem 1rem; border-radius:.5rem; text-decoration:none; display:inline-block; }
  table { display: table; width: 100%; }
  th, td { padding: .45rem; }
}

/* Navy variable fallback if not present */
:root { --navy: #0b2345; }

/* Attendance/result alt-row styles are handled inline to meet exact color spec. */


/* === Login page: background photo + minimal UI (mobile responsive) === */
body.login-page {
  min-height: 100vh;
  background-color: var(--navy);
  background-image:
    linear-gradient(rgba(11, 35, 69, 0.70), rgba(11, 35, 69, 0.70)),
    url('/static/core/img/login_bg.png');
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: cover;
}

.login-wrap {
  max-width: 420px;
  margin: 2.5rem auto 1.5rem;
  padding: 0 1rem;
}

.login-card {
  background: rgba(255,255,255,0.90);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 16px;
  padding: 1.4rem 1.2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

.login-title {
  text-align: center;
  margin: 0 0 1rem;
  font-size: 2.1rem;
  letter-spacing: 0.06em;
  color: var(--navy);
}

.login-error {
  margin: 0 0 0.8rem;
  color: var(--red);
  text-align: center;
}

.login-form {
  display: grid;
  gap: 0.75rem;
}

.login-field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--navy);
  font-weight: 600;
}

.login-card input[type="text"],
.login-card input[type="password"],
.login-card input[type="email"],
.login-card input[type="tel"],
.login-card input[type="number"] {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid #cfd7ea;
  background: #fff;
}

.login-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-weight: 700;
}

/* Make images and tables adapt on mobile across the app */
img {
  max-width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  .login-wrap {
    margin-top: 1.5rem;
  }
  .login-title {
    font-size: 1.9rem;
  }
  body.login-page {
    background-position: center bottom;
  }
}

/* === Login page (minimalize) === */
body.login-page {
  min-height: 100vh;
  background-color: #071a3a;
  background-image:
    linear-gradient(rgba(7, 26, 58, 0.72), rgba(7, 26, 58, 0.72)),
    url('/static/core/img/login_bg.png');
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: cover;
}

/* Center the login card and keep it comfortable on mobile */
.login-wrap {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 0.75rem;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.90);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 18px;
  padding: 1.4rem 1.25rem;
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
  backdrop-filter: blur(6px);
}

.login-title {
  margin: 0 0 1rem 0;
  text-align: center;
  color: var(--navy);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.login-error {
  margin: 0 0 0.85rem 0;
  color: var(--red);
  font-weight: 700;
  text-align: center;
}

.login-field {
  margin-bottom: 0.85rem;
}

.login-field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--navy);
  font-weight: 700;
}

.login-field input {
  width: 100%;
  max-width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid #cbd6ea;
  background: #fff;
}

.login-btn {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
}

/* Mobile-first tweaks for all screens */
img { max-width: 100%; height: auto; }

@media (max-width: 768px) {
  header .brand { font-size: 1.25rem; }
  .login-card { padding: 1.2rem 1rem; }
  .login-title { font-size: 1.85rem; }
}

/* Make wide tables usable on mobile (horizontal scroll) */
@media (max-width: 768px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { white-space: nowrap; }
}

/* === Login page hotfix (2026-02): requested UI tweaks === */

/* 1) "minimalize"는 이탤릭 해제 + 굵게 */
body.login-page .login-title {
  font-style: normal !important;
  font-weight: 900 !important;
}

/* 2) 로그인 버튼 폭을 입력칸과 동일하게 강제 */
body.login-page .login-form .login-btn {
  width: 100% !important;
  display: block !important;
}

/* 입력칸도 동일하게 100% 강제(브라우저/기본CSS 간 충돌 방지) */
body.login-page .login-card input,
body.login-page .login-card select,
body.login-page .login-card textarea {
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
}

/* 3) 배경 사진이 main/header의 흰 배경에 가려지지 않게 */
body.login-page header {
  background: transparent !important;
  border-bottom: none !important;
}
body.login-page header .brand {
  color: #fff !important;
}
body.login-page main {
  max-width: none !important;
  background: transparent !important;
  padding: 0 !important;
}
body.login-page .footer-copy {
  color: rgba(255,255,255,0.85) !important;
}

/* 4) 사진(투명 PNG)도 잘 보이도록 배경 설정을 contain으로 조정 */
body.login-page {
  background-position: center bottom !important;
  background-size: contain !important;
}


/* === Mobile text wrapping hardening (2026-03) ===
   Prevent CJK text from breaking per-character on narrow buttons/nav.
*/

/* Defensive: keep UI text horizontal and wrap by words (not characters) */
button, .btn, .btn-outline, header nav a, input[type="submit"]{
  writing-mode: horizontal-tb;
  word-break: keep-all;
  overflow-wrap: normal;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
}

/* Make header navigation behave well on small screens (no ultra-narrow buttons) */
@media (max-width: 520px){
  header nav.student-nav{
    flex-wrap: wrap;
  }
  header nav.student-nav a{
    flex: 1 1 160px;
    min-width: 140px;
  }
  header nav a.nav-btn{
    min-width: 120px;
  }
}
