/* ========= THEME ========= */
:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#1b1e28;
  --muted:#6b7280;

  --primary:#0066cc;       /* น้ำเงินหลัก */
  --primary-600:#005bb5;   /* น้ำเงินเข้ม */
  --brand:var(--primary);  /* เผื่อโค้ดเก่าเรียก --brand */

  --ring: rgba(0,102,204,.25);
  --radius:16px;

  --line:#e5e7eb;  /* เส้นคั่น */
}

/* ========= BASE ========= */
*{ box-sizing:border-box }
html,body{ height:100% }
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:'Kanit',system-ui,-apple-system,Segoe UI,Roboto,'Helvetica Neue',Arial,sans-serif;
}
.wrap{ max-width:1200px; margin:0 auto; padding:0 16px }

/* ========= PUBLIC HEADER/FOOTER ========= */
.site-header{
  background:var(--brand);
  color:#fff; padding:28px 0 40px; position:relative;
  border-bottom:1px solid rgba(255,255,255,.15);
  box-shadow:0 8px 24px rgba(11,91,211,.25);
}
.header-flex{ display:flex; align-items:center; gap:18px }
.college-logo{ height:62px; width:auto; filter:drop-shadow(0 6px 12px rgba(0,0,0,.2)) }
.site-header h1{ margin:0; font-weight:800; letter-spacing:.2px }
.site-header p{ margin:4px 0 0; opacity:.95 }

.site-footer{ color:var(--muted); padding:24px 0; text-align:center }

/* ========= CARD & SECTIONS ========= */
.card{
  background:var(--card); border-radius:var(--radius);
  box-shadow:0 12px 32px rgba(17,24,39,.08);
  padding:20px 18px; margin-bottom:24px;
}
.section{ margin-top:6px }
.section-title{
  font-size:18px; font-weight:600; margin:4px 6px 14px;
  color:#111827; border-left:4px solid var(--primary); padding-left:10px;
}

/* ========= FORM LAYOUT ========= */
.form{ display:block }
.grid{
  display:grid; gap:14px;
  grid-template-columns: repeat(12, minmax(0,1fr));
}
.field{ display:flex; flex-direction:column; gap:6px; grid-column: span 6; }
.field.sm{ grid-column: span 3; }
.field label{ font-weight:600; color:#111827 }
.field small{ color:var(--muted) }

/* ========= FORM CONTROLS (ศูนย์กลาง) ========= */
/* ใช้ได้ทั้งแบบใส่คลาส .input หรืออยู่ในฟอร์ม (.form) */
.input,
.form input:not([type=file]),
.form select,
.form textarea{
  appearance:none; width:100%;
  border:1px solid var(--line); border-radius:12px; background:#fff;
  padding:12px 14px; min-height:46px; font-size:16px;
  transition: box-shadow .15s, border-color .15s, transform .02s;
}
.input:focus,
.form input:not([type=file]):focus,
.form select:focus,
.form textarea:focus{
  outline:none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}
.input::placeholder,
.form input::placeholder,
.form textarea::placeholder{ color:#9ca3af }
.form input:active, .input:active{ transform:translateY(0.5px) }

/* select ลูกศร */
.form select, select.input{
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 12px center;
  background-size:16px 16px;
  padding-right:40px;
}

/* input[type=file] แยกสไตล์ */
.form input[type=file]{
  border:1px dashed var(--line); background:#fff;
  padding:10px 12px; min-height:auto;
}

/* ปุ่มส่ง/แอคชันของฟอร์ม */
.actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:6px }

/* ========= BUTTONS ========= */
.btn{
  background:var(--primary); color:#fff; border:0; border-radius:12px;
  padding:10px 14px; font-weight:700; cursor:pointer;
  box-shadow:0 10px 16px rgba(0,102,204,.25);
}
.btn:hover{ background:var(--primary-600) }
.btn:focus{ outline:none; box-shadow:0 0 0 4px var(--ring) }

.btn-soft{ background:#eef6ff; color:#174b93; border:1px solid #dcebff }
.btn-soft:hover{ background:#e3f0ff }
.btn-outline{ background:#fff; color:var(--primary); border:1px solid var(--primary) }
.btn-outline:hover{ background:#f0f7ff }
.btn-danger{ background:#ef4444; border:1px solid #ef4444; color:#fff }
.btn-danger:hover{ background:#dc2626 }
.btn-light{ background:#ffffff; color:#0f172a; border:1px solid #e5e7eb }
.btn-light:hover{ background:#f8fafc }

/* CTA */
.cta-row{ margin-top:10px; display:flex; gap:8px; flex-wrap:wrap }
.btn-status{
  display:inline-block; padding:10px 18px; border-radius:12px;
  background:#3b82f6; color:#fff; font-weight:700; text-decoration:none;
  box-shadow:0 8px 16px rgba(59,130,246,.25); border:1px solid #3b82f6;
}
.btn-status:hover{ background:#2563eb; border-color:#2563eb }
.btn-status:focus{ outline:none; box-shadow:0 0 0 4px rgba(59,130,246,.25) }

/* ========= ADMIN HEADER (แบบเรียบ) ========= */
.admin-header{
  background: linear-gradient(90deg,#1e90ff,#007bff);
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.header-inner{
  max-width:1200px; margin:0 auto; padding:12px 16px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.header-left{ display:flex; align-items:center; gap:10px; }
.header-logo{
  height:38px; width:auto; border-radius:50%;
  background:#fff; padding:3px; box-shadow:0 2px 6px rgba(0,0,0,.2);
  border:2px solid #fff;
}
.header-title{
  color:#fff; font-weight:800; font-size:18px; letter-spacing:.2px;
  display:flex; align-items:center; gap:8px;
}
.badge-count{
  background:rgba(255,255,255,.2);
  padding:3px 8px; border-radius:8px; font-size:14px; font-weight:500; color:#fff;
}
.btn-logout{
  background:#fff; color:#0f172a; text-decoration:none;
  padding:8px 14px; border-radius:10px; font-weight:700;
  border:1px solid #e5e7eb; box-shadow:0 2px 8px rgba(0,0,0,.1);
}
.btn-logout:hover{ background:#f8fafc }
.btn-logout:focus{ outline:none; box-shadow:0 0 0 4px var(--ring) }

/* ========= ADMIN “WOW” HERO (หัวแบบหรู) ========= */
.admin-hero{
  position:relative; color:#fff; padding:26px 0 26px; overflow:hidden;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255,255,255,.15), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(255,255,255,.09), transparent 65%),
    linear-gradient(120deg, #0b5bd3, #2563eb 40%, #7c3aed 95%);
  box-shadow:0 12px 28px rgba(11,91,211,.28);
  isolation:isolate;
}
.admin-hero::before{
  content:""; position:absolute; inset:0;
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size:24px 24px, 24px 24px; mix-blend-mode:overlay; pointer-events:none; opacity:.35;
}
.admin-hero::after{
  content:""; position:absolute; inset:-50%;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='2' stitchTiles='stitch' type='fractalNoise'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0 .05 0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); opacity:.8; pointer-events:none;
}
.hero-bubble{ position:absolute; filter:blur(40px); opacity:.35; pointer-events:none; mix-blend-mode:screen; transform: translateZ(0); }
.hero-bubble.b1{ width:320px; height:320px; left:-60px; top:-40px;
  background:radial-gradient(circle at 30% 30%, #60a5fa, transparent 60%); animation:float1 11s ease-in-out infinite alternate }
.hero-bubble.b2{ width:380px; height:380px; right:-80px; top:-30px;
  background:radial-gradient(circle at 70% 40%, #a78bfa, transparent 60%); animation:float2 13s ease-in-out infinite alternate }
.hero-bubble.b3{ width:260px; height:260px; left:40%; bottom:-120px;
  background:radial-gradient(circle at 50% 50%, #22d3ee, transparent 55%); animation:float3 10s ease-in-out infinite alternate }
@keyframes float1{ to{ transform: translateY(18px) translateX(10px) } }
@keyframes float2{ to{ transform: translateY(12px) translateX(-8px) } }
@keyframes float3{ to{ transform: translateY(-14px) translateX(6px) } }

.hero-inner{ position:relative; z-index:1; max-width:1200px; margin:0 auto; padding:0 16px;
  display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.hero-left{ display:flex; gap:14px; align-items:center; }
.hero-logo{ height:60px; width:auto; flex-shrink:0; filter: drop-shadow(0 8px 18px rgba(0,0,0,.25)); }
.hero-title h1{ margin:0; font-weight:800; letter-spacing:.2px }
.hero-title p{ margin:4px 0 0; opacity:.95 }
.hero-actions{ display:flex; gap:8px; flex-wrap:wrap }
.btn-glass{
  backdrop-filter: blur(8px); background: rgba(255,255,255,.14);
  color:#fff; border:1px solid rgba(255,255,255,.25);
  padding:9px 14px; border-radius:12px; font-weight:800; text-decoration:none;
  box-shadow: 0 8px 16px rgba(0,0,0,.15);
}
.btn-glass:hover{ background:rgba(255,255,255,.22) }
.btn-glass:focus{ outline:none; box-shadow:0 0 0 4px rgba(255,255,255,.25) }
.hero-stats{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px }
.hero-chip{ display:inline-flex; align-items:center; gap:8px; padding:8px 12px; border-radius:999px;
  background: rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.25); font-weight:700 }
.hero-chip small{ opacity:.9; font-weight:700 }
.subnav{ position:relative; z-index:1; max-width:1200px; margin:-24px auto 0; padding:0 16px }
.subnav-inner{
  background:#fff; border:1px solid #e5e7eb; border-radius:14px; padding:10px;
  display:flex; gap:10px; flex-wrap:wrap; box-shadow:0 12px 28px rgba(17,24,39,.12);
}

/* ========= TABLES ========= */
.table-wrap{ overflow:auto; border-radius:12px; border:1px solid var(--line); background:#fff }
.table{ width:100%; border-collapse:separate; border-spacing:0 }
.table thead th{
  background:#f0f5ff; color:#0f172a; text-align:left; font-weight:700;
  padding:12px 14px; position:sticky; top:0; z-index:2; border-bottom:1px solid var(--line);
}
.table tbody td{ padding:12px 14px; border-bottom:1px solid #eef2f7; vertical-align:middle }
.table tbody tr:nth-child(odd){ background:#fcfdff }
.table tbody tr:hover{ background:#f6faff }
.text-right{ text-align:right } .text-center{ text-align:center } .muted{ color:#6b7280 }

/* Badges */
.badge{
  display:inline-block; padding:6px 10px; border-radius:999px;
  background:#eaf3ff; color:#0b5bd3; font-weight:600; border:1px solid #dbe9ff; font-size:13px;
}
.badge-info{ background:#eef9ff; color:#0a6fae; border-color:#d9f0ff }
.badge-blue{ background:#eaf3ff; color:#0b5bd3; border:1px solid #dbe9ff }

/* Actions ในตาราง (ไม่ชนกับ .actions ของฟอร์ม) */
.table .actions, td.actions{ display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap }

/* ========= SEARCH BAR ========= */
.admin-search{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; align-items:center }

/* ========= PAGER + PER-PAGE ========= */
.pager-bottom{ margin:12px 0 30px }
.pager-meta{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px }
.per-form{ display:flex; gap:8px; align-items:center }
.per-form select{ height:36px; border-radius:10px; border:1px solid var(--line); padding:0 10px; background:#fff }

.pager{ display:flex; gap:6px; flex-wrap:wrap; align-items:center }
.pager a,.pager span.page{
  display:inline-flex; align-items:center; justify-content:center;
  height:36px; min-width:36px; padding:0 10px;
  border:1px solid var(--line); border-radius:10px; background:#fff;
  text-decoration:none; color:#0f172a; font-weight:700;
}
.pager span.active{ background:#0b5bd3; color:#fff; border-color:#0b5bd3 }
.pager a.nav{ min-width:auto }
.pager .disabled{ pointer-events:none; opacity:.45 }

/* ========= RESPONSIVE ========= */
@media (max-width: 992px){
  .field{ grid-column: span 12; }
  .field.sm{ grid-column: span 6; }
}
@media (max-width: 640px){
  .card{ padding:16px }
  .section-title{ margin:0 2px 12px }
  .field,.field.sm{ grid-column: span 12; }

  .actions{ justify-content:stretch }
  .actions .btn{ flex:1 1 auto }
  .btn{ width:100% }

  .header-flex{ flex-direction:column; align-items:center; text-align:center }
  .college-logo{ height:64px }

  .header-inner{ flex-direction:column; align-items:flex-start }
  .btn-logout{ width:100%; text-align:center }
}

