/* style.css — ธีมหลักของระบบรับสมัครเรียนออนไลน์ */
:root {
  --brand: #7a1f2b;      /* แดงเลือดหมู (ปรับตามสีของสถาบัน) */
  --brand-dark: #56141d;
  --brand-light: #b8434f;
  --gold: #c9a24a;
  --bg-soft: #f6f5f2;
}

html, body {
  height: 100%;
}
body {
  font-family: 'Sarabun', sans-serif;
  background: var(--bg-soft);
  color: #2b2b2b;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* เนื้อหาหลักของแต่ละหน้า (อยู่ระหว่าง header.php กับ footer.php)
   flex: 1 0 auto ทำให้เนื้อหายืดกินพื้นที่ที่เหลือทั้งหมด ดัน footer ให้ชิดขอบล่างเสมอ
   แม้หน้าจะมีเนื้อหาน้อย (เช่นหน้า login) โดยไม่ทิ้งช่องว่างประหลาดไว้ตรงกลาง */
.page-main {
  flex: 1 0 auto;
}

.site-navbar {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  flex-shrink: 0;
}
.site-footer {
  background: var(--brand-dark);
  flex-shrink: 0;
}

.btn-brand, .btn-primary {
  background-color: var(--brand) !important;
  border-color: var(--brand) !important;
}
.btn-brand:hover, .btn-primary:hover { background-color: var(--brand-dark) !important; }

.text-brand { color: var(--brand) !important; }
.bg-brand { background-color: var(--brand) !important; }

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

/* ---------------- Hero / Banner ---------------- */
.hero-banner img { width: 100%; object-fit: cover; border-radius: 0; }
.banner-vertical img { object-fit: cover; height: 100%; }

/* ---------------- Cards ---------------- */
.news-card, .program-card { border: none; box-shadow: 0 2px 10px rgba(0,0,0,.06); border-radius: 14px; overflow: hidden; transition: transform .15s; }
.news-card:hover, .program-card:hover { transform: translateY(-4px); }
.program-card .badge-status { position: absolute; top: 10px; right: 10px; }

/* ---------------- Timeline / Wizard navigator ---------------- */
.wizard-nav { display: flex; list-style: none; padding: 0; margin: 0 0 2rem; overflow-x: auto; }
.wizard-nav li { flex: 1; min-width: 130px; text-align: center; position: relative; padding-top: 8px; }
.wizard-nav li:not(:last-child)::after {
  content: ''; position: absolute; top: 22px; left: 55%; width: 90%; height: 3px; background: #e2ded8; z-index: 0;
}
.wizard-nav li.done:not(:last-child)::after,
.wizard-nav li.active:not(:last-child)::after { background: var(--gold); }
.wizard-nav .circle {
  width: 40px; height: 40px; line-height: 40px; border-radius: 50%;
  background: #e2ded8; color: #777; font-weight: 600; margin: 0 auto 6px; position: relative; z-index: 1;
}
.wizard-nav li.active .circle { background: var(--brand); color: #fff; }
.wizard-nav li.done .circle { background: var(--gold); color: #fff; }
.wizard-nav .label { font-size: .8rem; color: #555; }
.wizard-nav li.active .label { color: var(--brand); font-weight: 600; }

/* ---------------- Admin ---------------- */
.admin-sidebar { min-height: 100vh; background: #1f2430; color: #cfd3dc; width: 250px; }
.admin-sidebar a { color: #cfd3dc; text-decoration: none; display: block; padding: .6rem 1rem; border-radius: 8px; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--brand); color: #fff; }
.admin-topbar { background: #fff; border-bottom: 1px solid #eee; }
.stat-card { border-radius: 16px; border: none; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.table-sm-y td, .table-sm-y th { vertical-align: middle; }

.form-section-title {
  background: #f1ede6; border-left: 4px solid var(--brand); padding: .5rem 1rem; font-weight: 600; margin: 1.5rem 0 1rem;
}

/* ---------------- Quick-link blocks: ระดับการศึกษา / คณะ / สาขา (หน้าแรก) ---------------- */
.quicklink-block {
  background: #fff; border-radius: 16px; padding: 1.1rem 1.1rem 1.3rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.06); height: 100%;
}
.quicklink-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.quicklink-icon {
  width: 40px; height: 40px; min-width: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.quicklink-title { font-weight: 700; font-size: 1.02rem; }
.quicklink-items { display: flex; flex-direction: column; gap: .5rem; }
.quicklink-subheader { font-size: .74rem; font-weight: 700; color: #8a8a8a; text-transform: uppercase; letter-spacing: .03em; margin-top: .4rem; padding-top: .5rem; border-top: 1px dashed #e0dcd3; }
.quicklink-subheader:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.quicklink-subheader-accent { display: flex; align-items: center; gap: .4rem; text-transform: none; font-size: .84rem; letter-spacing: normal; }
.quicklink-subheader-header { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed #e0dcd3; margin-bottom: .9rem; }
.quicklink-subheader-header:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.quicklink-item {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  background: #f6f5f2; border-radius: 10px; padding: .55rem .8rem;
  text-decoration: none; color: #2b2b2b; font-size: .92rem; transition: background .15s, transform .15s;
}
.quicklink-item:hover { background: #ece8e0; transform: translateX(2px); color: #2b2b2b; }
.quicklink-item .quicklink-item-name { display: flex; align-items: flex-start; gap: .5rem; }
.quicklink-item .quicklink-item-name span.name-text { white-space: normal; word-break: break-word; }
.quicklink-item .major-count { font-size: .74rem; color: #8a8a8a; white-space: nowrap; margin-left: .4rem; }
.quicklink-empty { color: #8a8a8a; font-size: .85rem; padding: .4rem 0; }

.quicklink-banner-block { display: flex; flex-direction: column; }
.quicklink-banner-img { border-radius: 10px; overflow: hidden; flex: 1 0 auto; }
.quicklink-banner-img img { width: 100%; height: 100%; min-height: 140px; object-fit: cover; display: block; }
.quicklink-news-caption { margin-top: .6rem; }
.quicklink-news-caption .fw-semibold { font-size: .9rem; line-height: 1.35; }
.quicklink-news-caption:hover .fw-semibold { text-decoration: underline; }

/* ---------------- Sidebar: รายการข่าวสารล่าสุด (news.php ฯลฯ) ---------------- */
.sidebar-news-item {
  display: flex; gap: .6rem; align-items: flex-start; text-decoration: none; color: #2b2b2b;
  padding: .4rem; border-radius: 10px; transition: background .15s;
}
.sidebar-news-item:hover { background: #f6f5f2; color: #2b2b2b; }
.sidebar-news-item img { width: 64px; height: 48px; min-width: 64px; object-fit: cover; border-radius: 8px; }
.sidebar-news-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: .85rem; font-weight: 600; line-height: 1.3;
}
.sidebar-news-date { display: block; font-size: .74rem; color: #8a8a8a; margin-top: .15rem; }

/* ---------------- Auth pages: login.php / register.php ---------------- */
:root {
  --auth-blue: #2563eb;
  --auth-blue-dark: #1d4ed8;
  --auth-blue-light: #3b82f6;
}
.auth-wrap { width: 100%; }
.auth-card {
  border: none; border-radius: 24px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(37,99,235,.14), 0 2px 10px rgba(0,0,0,.05);
}
.auth-card-top { height: 6px; background: linear-gradient(90deg, var(--auth-blue), var(--auth-blue-light)); }
.auth-icon-badge {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--auth-blue), var(--auth-blue-light));
  color: #fff; font-size: 1.6rem;
  box-shadow: 0 8px 20px rgba(37,99,235,.35);
}
.auth-title { font-weight: 700; font-size: 1.3rem; color: #1e293b; }
.auth-subtitle { color: #94a3b8; font-size: .88rem; }

.auth-card .form-label { font-weight: 600; font-size: .88rem; color: #334155; }
.auth-card .form-control {
  border-radius: 12px; padding: .65rem .9rem; border: 1px solid #e2e8f0; background: #f8fafc;
}
.auth-card .form-control:focus {
  border-color: var(--auth-blue-light); box-shadow: 0 0 0 .2rem rgba(59,130,246,.15); background: #fff;
}

.btn-auth-primary {
  background: linear-gradient(135deg, var(--auth-blue), var(--auth-blue-light)) !important;
  border: none !important; color: #fff !important;
  border-radius: 999px; padding: .7rem 1rem; font-weight: 600;
  box-shadow: 0 6px 16px rgba(37,99,235,.32); transition: transform .15s, box-shadow .15s;
}
.btn-auth-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(37,99,235,.4); color: #fff; }

.btn-auth-google {
  border-radius: 999px; padding: .65rem 1rem; font-weight: 600;
  border: 1.5px solid var(--auth-blue) !important; color: var(--auth-blue) !important; background: #eff6ff !important;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-auth-google:hover { background: var(--auth-blue) !important; color: #fff !important; border-color: var(--auth-blue-dark) !important; }

.auth-divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; }
.auth-divider hr { flex: 1; margin: 0; border-top: 1px solid #e2e8f0; }
.auth-divider span { font-size: .78rem; color: #94a3b8; }

.auth-policy-box {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: .8rem 1rem; max-height: 120px; overflow: auto; color: #475569; line-height: 1.5;
}

.auth-footer-link { font-size: .88rem; color: #64748b; }
.auth-footer-link a { color: var(--auth-blue); font-weight: 600; text-decoration: none; }
.auth-footer-link a:hover { color: var(--auth-blue-dark); text-decoration: underline; }

/* ---------------- Program detail page (program_detail.php) ---------------- */
.program-level-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #f1ede6; color: var(--brand); font-weight: 600; font-size: .8rem;
  padding: .35rem .85rem; border-radius: 999px;
}
.program-section-title {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: 1.05rem; color: #2b2b2b; margin-bottom: 1rem;
}
.program-section-title i { color: var(--brand); }

.major-card {
  border: 1px solid #ece8e0; border-radius: 14px; padding: 1rem 1.1rem;
  background: #fff; height: 100%; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.major-card:hover { box-shadow: 0 8px 22px rgba(0,0,0,.08); transform: translateY(-2px); border-color: #e2ded8; }
.major-card .major-name { font-weight: 600; font-size: .95rem; line-height: 1.4; }
.major-card .major-duration {
  display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap;
  background: linear-gradient(135deg, var(--gold), #dfc27b); color: #fff;
  font-size: .72rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px;
}
.major-card .major-fee { font-size: .82rem; color: #8a8a8a; margin-top: .5rem; }
.major-card .major-fee i { color: #b6afa0; }

.program-detail-card {
  border: none; border-radius: 20px; overflow: hidden; background: #fff;
  box-shadow: 0 10px 40px rgba(122,31,43,.12), 0 2px 10px rgba(0,0,0,.05);
}
.program-detail-card-top { height: 6px; background: linear-gradient(90deg, var(--brand-dark), var(--brand), var(--gold)); }
.program-price-badge { font-size: 1.7rem; font-weight: 800; }

.btn-cta-brand {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand)) !important;
  border: none !important; color: #fff !important;
  border-radius: 999px; padding: .75rem 1rem; font-weight: 700;
  box-shadow: 0 8px 20px rgba(122,31,43,.32); transition: transform .15s, box-shadow .15s;
}
.btn-cta-brand:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(122,31,43,.4); color: #fff; }

.btn-cta-outline {
  border-radius: 999px; padding: .7rem 1rem; font-weight: 600;
  border: 1.5px solid #d8d3c8 !important; color: #555 !important; background: #fff !important;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-cta-outline:hover { background: #f6f5f2 !important; border-color: #c7c1b3 !important; color: #2b2b2b !important; }

.program-info-note {
  background: #f6f5f2; border-radius: 12px; padding: .75rem 1rem;
  font-size: .82rem; color: #6b6b6b; line-height: 1.5;
}
.program-info-note i { color: var(--gold); }
