/* ============================================================
   theme.css — ธีมสีส้มเพื่อการศึกษา
   เว็บไซต์พื้นที่นวัตกรรมการศึกษาจังหวัดกระบี่
   ============================================================ */
:root {
  --orange:       #f97316;
  --orange-dark:  #ea580c;
  --orange-deep:  #c2410c;
  --orange-soft:  #ffedd5;
  --amber:        #fbbf24;
  --cream:        #fff7ed;
  --ink:          #431407;
  --gray:         #78716c;
  --line:         #fde8d4;
  --white:        #ffffff;
  --shadow:       0 4px 18px rgba(234, 88, 12, .10);
  --shadow-lg:    0 12px 34px rgba(234, 88, 12, .18);
  --radius:       16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Prompt', 'Sarabun', sans-serif;
  background: linear-gradient(180deg, var(--cream) 0%, #fffdf9 40%, var(--cream) 100%);
  color: var(--ink);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ---------- แถบบนสุด ---------- */
.topbar {
  background: linear-gradient(135deg, var(--orange-deep), var(--orange) 55%, var(--amber));
  color: #fff;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.55);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; backdrop-filter: blur(4px);
}
.brand-name { font-size: 1.15rem; font-weight: 700; line-height: 1.25; }
.brand-sub  { font-size: .8rem; opacity: .92; font-weight: 300; }
.topbar-right { font-size: .8rem; opacity: .95; text-align: right; font-weight: 300; }

/* ---------- เมนูหลัก ---------- */
.mainnav {
  background: var(--white);
  box-shadow: 0 3px 14px rgba(234,88,12,.12);
  position: sticky; top: 0; z-index: 900;
}
.nav-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: stretch; flex-wrap: wrap;
}
.nav-link, .nav-item > .nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 18px;
  font-size: .95rem; font-weight: 500; color: var(--ink);
  background: none; border: 0; cursor: pointer; font-family: inherit;
  border-bottom: 3px solid transparent;
  transition: all .25s ease;
}
.nav-link:hover, .nav-item:hover > .nav-btn {
  color: var(--orange-dark);
  border-bottom-color: var(--orange);
  background: var(--orange-soft);
}
.nav-item { position: relative; }
.nav-item .caret { font-size: .6rem; transition: transform .25s; }
.nav-item:hover .caret { transform: rotate(180deg); }
.dropdown {
  position: absolute; top: 100%; left: 0; min-width: 240px;
  background: var(--white); border-radius: 0 0 14px 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: all .28s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden; z-index: 950;
  border-top: 3px solid var(--orange);
}
.nav-item:hover .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown a {
  display: block; padding: 12px 18px; font-size: .9rem;
  border-bottom: 1px solid var(--line);
  transition: all .2s;
}
.dropdown a:last-child { border-bottom: 0; }
.dropdown a:hover { background: var(--orange-soft); color: var(--orange-deep); padding-left: 26px; }
.nav-admin { margin-left: auto; }
.nav-admin > .nav-btn { color: var(--orange-dark); font-weight: 600; }

/* ---------- Banner 728x90 ---------- */
.banner-wrap { display: flex; justify-content: center; padding: 26px 14px 8px; }
.banner-728 {
  width: min(728px, 100%); height: 90px;
  border-radius: 14px; position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--orange-deep) 0%, var(--orange) 45%, #fb923c 75%, var(--amber) 100%);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-align: center; padding: 10px 60px;
}
.banner-728::before, .banner-728::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.14);
}
.banner-728::before { width: 150px; height: 150px; top: -70px; left: -40px; }
.banner-728::after  { width: 110px; height: 110px; bottom: -55px; right: -25px; }
.banner-text b { display: block; font-size: 1.15rem; font-weight: 700; text-shadow: 0 2px 6px rgba(0,0,0,.18); }
.banner-text span { font-size: .78rem; font-weight: 300; opacity: .95; }
.banner-icon {
  position: absolute; font-size: 26px; opacity: .85;
  animation: float 3.5s ease-in-out infinite;
}
.banner-icon.b1 { left: 18px;  top: 50%; margin-top: -15px; }
.banner-icon.b2 { right: 18px; top: 50%; margin-top: -15px; animation-delay: 1.6s; }
@keyframes float { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-7px);} }

/* ---------- โครงหน้า ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 10px 16px 40px; }
.section { margin-top: 34px; }
.section-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.section-title {
  font-size: 1.3rem; font-weight: 700; color: var(--orange-deep);
  display: flex; align-items: center; gap: 10px;
  position: relative; padding-left: 14px;
}
.section-title::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 5px; border-radius: 4px;
  background: linear-gradient(180deg, var(--orange), var(--amber));
}
.section-head .spacer { flex: 1; }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-radius: 999px;
  font-family: inherit; font-size: .9rem; font-weight: 500;
  border: 0; cursor: pointer; transition: all .22s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff; box-shadow: 0 4px 14px rgba(234,88,12,.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(234,88,12,.45); }
.btn-outline {
  background: var(--white); color: var(--orange-dark);
  border: 1.6px solid var(--orange);
}
.btn-outline:hover { background: var(--orange-soft); transform: translateY(-2px); }
.btn-sm { padding: 6px 13px; font-size: .8rem; }
.btn-danger { background: #fee2e2; color: #b91c1c; border: 1.4px solid #fca5a5; }
.btn-danger:hover { background: #fecaca; }
.btn-ghost { background: #f5f5f4; color: var(--gray); border: 1.4px solid #e7e5e4; }
.btn-ghost:hover { background: #e7e5e4; }

/* ---------- การ์ดข่าว ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.news-card {
  background: var(--white); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: all .28s ease; border: 1px solid var(--line);
}
.news-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.news-thumb {
  height: 140px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #ffedd5, #fed7aa 60%, #fdba74);
  display: flex; align-items: center; justify-content: center;
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.news-card:hover .news-thumb img { transform: scale(1.07); }
.news-thumb .thumb-icon { font-size: 44px; opacity: .8; }
.news-date-chip {
  position: absolute; top: 10px; left: 10px;
  background: rgba(255,255,255,.94); color: var(--orange-deep);
  font-size: .72rem; font-weight: 600;
  padding: 4px 11px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.news-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.news-title { font-size: .95rem; font-weight: 600; line-height: 1.45; color: var(--ink); }
.news-excerpt { font-size: .8rem; color: var(--gray); line-height: 1.55; flex: 1; }
.news-more { font-size: .78rem; color: var(--orange-dark); font-weight: 600; }

/* ---------- สองคอลัมน์ (คำสั่ง/ประกาศ + ข่าวสารนวัตกรรม) ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.panel {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 20px; display: flex; flex-direction: column;
}
.panel .list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; margin: 6px 0 16px; }
.list-item {
  display: flex; flex-direction: column; gap: 5px;
  padding: 11px 13px; border-radius: 12px;
  background: #fffaf4; border: 1px solid var(--line);
  transition: all .22s;
}
.list-item:hover { background: var(--orange-soft); border-color: var(--orange); transform: translateX(4px); }
.list-date {
  font-size: .68rem; color: var(--orange-dark); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.list-title { font-size: .82rem; font-weight: 500; line-height: 1.4; }

/* ---------- การ์ดเอกสาร ---------- */
.doc-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 18px 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  transition: all .26s;
}
.doc-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--orange); }
.doc-icon {
  width: 56px; height: 56px; border-radius: 16px; font-size: 27px;
  background: linear-gradient(135deg, var(--orange-soft), #fed7aa);
  display: flex; align-items: center; justify-content: center;
}
.doc-title { font-size: .85rem; font-weight: 600; line-height: 1.4; }
.doc-date { font-size: .72rem; color: var(--gray); }

/* ---------- ส่วนที่ยังไม่เปิดใช้ ---------- */
.placeholder-box {
  background: repeating-linear-gradient(-45deg, #fffaf4, #fffaf4 14px, #fff3e4 14px, #fff3e4 28px);
  border: 2px dashed var(--orange); border-radius: var(--radius);
  padding: 46px 20px; text-align: center; color: var(--orange-deep);
}
.placeholder-box .ph-icon { font-size: 46px; margin-bottom: 10px; }
.placeholder-box p { font-weight: 500; }
.placeholder-box small { color: var(--gray); font-weight: 300; }

/* ---------- ฟอร์ม ---------- */
.page-wrap { max-width: 1080px; margin: 0 auto; padding: 30px 16px 50px; }
.page-head { text-align: center; margin-bottom: 26px; }
.page-head .page-icon {
  width: 74px; height: 74px; margin: 0 auto 12px; border-radius: 22px;
  background: linear-gradient(135deg, var(--orange), var(--amber));
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; box-shadow: var(--shadow-lg);
}
.page-head h1 { font-size: 1.5rem; color: var(--orange-deep); font-weight: 700; }
.page-head p { color: var(--gray); font-size: .88rem; font-weight: 300; margin-top: 4px; }
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 26px; margin-bottom: 26px;
}
.card h2 { font-size: 1.05rem; color: var(--orange-deep); margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
label .req { color: #dc2626; }
input[type=text], input[type=date], input[type=tel], input[type=password], select, textarea {
  width: 100%; padding: 11px 14px;
  border: 1.6px solid var(--line); border-radius: 11px;
  font-family: inherit; font-size: .9rem; color: var(--ink);
  background: #fffdfa; transition: all .2s; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3.5px rgba(249,115,22,.15);
  background: #fff;
}
input[type=file] {
  width: 100%; padding: 9px; font-family: inherit; font-size: .85rem;
  border: 1.6px dashed var(--orange); border-radius: 11px;
  background: var(--orange-soft); color: var(--orange-deep); cursor: pointer;
}
textarea { resize: vertical; }

.alert {
  padding: 13px 18px; border-radius: 12px; margin-bottom: 20px;
  font-size: .9rem; font-weight: 500;
  display: flex; align-items: center; gap: 9px;
}
.alert-ok  { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-err { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* ---------- ตาราง ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--white); }
table.data { width: 100%; border-collapse: collapse; min-width: 700px; }
table.data thead th {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff; font-size: .85rem; font-weight: 600;
  padding: 13px 14px; text-align: left; white-space: nowrap;
}
table.data thead th:first-child { border-radius: 0; }
table.data tbody td { padding: 12px 14px; font-size: .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:nth-child(even) { background: #fffaf4; }
table.data tbody tr:hover { background: var(--orange-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.nowrap { white-space: nowrap; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(67,20,7,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; padding: 18px; backdrop-filter: blur(3px);
}
.modal-backdrop.open { display: flex; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--white); border-radius: 20px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
  padding: 26px; box-shadow: 0 24px 60px rgba(0,0,0,.28);
  animation: pop .26s cubic-bezier(.34,1.4,.64,1);
}
.modal.modal-lg { max-width: 760px; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h3 { color: var(--orange-deep); font-size: 1.08rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.modal .modal-desc { font-size: .83rem; color: var(--gray); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.verify-result { margin-top: 12px; }
.verify-ok {
  background: #dcfce7; border: 1px solid #86efac; color: #15803d;
  padding: 12px 15px; border-radius: 12px; font-size: .9rem;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.verify-fail {
  background: #fee2e2; border: 1px solid #fca5a5; color: #b91c1c;
  padding: 12px 15px; border-radius: 12px; font-size: .88rem;
}
.preview-frame { width: 100%; height: 480px; border: 0; border-radius: 12px; background: #f5f5f4; }
.preview-img { width: 100%; border-radius: 12px; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 50px;
  background: linear-gradient(135deg, #7c2d12, var(--orange-deep) 55%, var(--orange-dark));
  color: #ffedd5; padding: 40px 24px 0;
}
.footer-grid {
  max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px;
  padding-bottom: 28px;
}
.footer-grid h4 {
  color: #fff; font-size: 1rem; margin-bottom: 13px;
  padding-bottom: 8px; border-bottom: 2px solid rgba(255,255,255,.25);
  display: inline-block;
}
.footer-grid p, .footer-grid a { font-size: .84rem; line-height: 1.9; font-weight: 300; opacity: .95; display: block; }
.footer-grid a:hover { color: var(--amber); padding-left: 5px; transition: all .2s; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.18);
  text-align: center; padding: 15px; font-size: .78rem; font-weight: 300; opacity: .85;
}

/* ---------- เมนูสองฝั่ง (menu.php) ---------- */
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .two-col, .split-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .panel .list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .banner-728 { height: auto; min-height: 90px; padding: 14px 48px; }
  .nav-admin { margin-left: 0; }
}
