/* ============================================================
   assets/css/style.css
   ธีมระดับมืออาชีพสำหรับระบบราชการ — ฟอนต์ Sarabun
   ============================================================ */

:root {
    --navy:        #0d3b66;
    --navy-700:    #0a2f52;
    --navy-900:    #07223c;
    --teal:        #1b6ca8;
    --sky:         #5fa8d3;
    --gold:        #c9a227;
    --gold-soft:   #e6c65c;
    --ink:         #1f2937;
    --muted:       #6b7280;
    --line:        #e5e8ee;
    --bg:          #eef2f7;
    --card:        #ffffff;
    --success:     #1f8a4c;
    --warning:     #d98a00;
    --danger:      #c0392b;
    --radius:      14px;
    --radius-sm:   10px;
    --shadow-sm:   0 1px 3px rgba(13,59,102,.06), 0 1px 2px rgba(13,59,102,.08);
    --shadow:      0 6px 24px rgba(13,59,102,.08);
    --shadow-lg:   0 18px 48px rgba(13,59,102,.16);
    --grad-navy:   linear-gradient(135deg, #0d3b66 0%, #1b6ca8 100%);
    --grad-head:   linear-gradient(120deg, #07223c 0%, #0d3b66 55%, #1b6ca8 100%);
}

/* ---------------- Typography ---------------- */
* { -webkit-font-smoothing: antialiased; }

body {
    font-family: "Sarabun", "TH Sarabun New", "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.65;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: .2px; color: var(--navy-900); }
.fw-bold, strong { font-weight: 700; }
a { text-decoration: none; }

/* ---------------- Top navbar (public) ---------------- */
.app-navbar {
    background: var(--grad-head);
    box-shadow: 0 2px 16px rgba(7,34,60,.25);
    padding-top: .6rem;
    padding-bottom: .6rem;
}
.app-navbar .navbar-brand { display: flex; align-items: center; gap: .7rem; }
.app-navbar .brand-logo {
    width: 44px; height: 44px; border-radius: 50%;
    background: #fff; padding: 3px; box-shadow: 0 0 0 2px var(--gold-soft);
    object-fit: contain;
}
.app-navbar .brand-text { line-height: 1.1; }
.app-navbar .brand-text .t1 { font-size: 1.05rem; font-weight: 700; color: #fff; }
.app-navbar .brand-text .t2 { font-size: .78rem; color: #cfe3f3; font-weight: 400; }
.app-navbar .nav-link {
    color: #e8f1f9 !important; font-weight: 500; border-radius: 8px;
    padding: .45rem .9rem !important; transition: all .18s ease;
}
.app-navbar .nav-link:hover { background: rgba(255,255,255,.12); color: #fff !important; }
.app-navbar .nav-link.cta { background: var(--gold); color: var(--navy-900) !important; font-weight: 600; }
.app-navbar .nav-link.cta:hover { background: var(--gold-soft); }

/* ---------------- Cards ---------------- */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, transform .2s ease;
}
.card.lift:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.card .card-header {
    font-weight: 600;
    border: none;
    padding: .85rem 1.15rem;
}
.card .card-header.bg-primary,
.section-head {
    background: var(--grad-navy) !important;
    color: #fff;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

/* ---------------- Hero (home) ---------------- */
.hero {
    background: var(--grad-head);
    color: #fff;
    border-radius: var(--radius);
    padding: 2.6rem 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.hero::after {
    content: ""; position: absolute; right: -60px; top: -60px;
    width: 240px; height: 240px; border-radius: 50%;
    background: radial-gradient(circle, rgba(201,162,39,.35), transparent 70%);
}
.hero .seal {
    width: 96px; height: 96px; border-radius: 50%; background: #fff;
    padding: 8px; box-shadow: 0 0 0 4px rgba(201,162,39,.5);
}
.hero h1 { color: #fff; font-weight: 700; }
.hero p { color: #d7e6f3; }

.choice-card { text-align: center; height: 100%; }
.choice-card .icon-wrap {
    width: 74px; height: 74px; margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 20px; font-size: 1.9rem; color: #fff;
}
.icon-navy { background: var(--grad-navy); }
.icon-teal { background: linear-gradient(135deg, #138496, #5fa8d3); }
.icon-gold { background: linear-gradient(135deg, #b8901f, #e6c65c); }

/* ---------------- Buttons ---------------- */
.btn { border-radius: 10px; font-weight: 600; padding: .5rem 1.1rem; transition: all .18s ease; }
.btn-lg { padding: .7rem 1.5rem; }
.btn-primary { background: var(--navy); border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-700); border-color: var(--navy-700); transform: translateY(-1px); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { filter: brightness(.94); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-900); }
.btn-gold:hover { background: var(--gold-soft); color: var(--navy-900); }
.btn-outline-primary { color: var(--navy); border-color: var(--navy); }
.btn-outline-primary:hover { background: var(--navy); }

/* ---------------- Forms ---------------- */
.form-label { font-weight: 600; color: #374151; margin-bottom: .25rem; font-size: .92rem; }
.form-control, .form-select {
    border-radius: 9px; border: 1px solid #d5dbe5; padding: .5rem .75rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--sky);
    box-shadow: 0 0 0 .2rem rgba(95,168,211,.22);
}
.input-group-text { background: #f3f6fa; border-color: #d5dbe5; color: var(--navy); }

/* หัวข้อหมวดในฟอร์ม/มุมมอง */
.view-section-title {
    background: linear-gradient(90deg, rgba(13,59,102,.08), rgba(13,59,102,0));
    border-left: 4px solid var(--gold);
    padding: .55rem .9rem; font-weight: 700; color: var(--navy);
    margin: 1.4rem 0 .7rem; border-radius: 6px;
}

/* ---------------- Badges ---------------- */
.badge { font-weight: 600; padding: .4em .7em; border-radius: 7px; }

/* ---------------- Tables ---------------- */
.table { --bs-table-hover-bg: #f1f6fb; }
.table thead th { background: #f4f7fb; color: var(--navy); font-weight: 600; border-bottom: 2px solid var(--line); }
.table-sm td, .table-sm th { vertical-align: middle; }

/* ---------------- Admin layout ---------------- */
.admin-sidebar {
    background: var(--grad-head);
    width: 260px; min-height: 100vh;
    box-shadow: 2px 0 18px rgba(7,34,60,.2);
    position: sticky; top: 0;
}
.admin-sidebar .brand { display:flex; align-items:center; gap:.6rem; padding: .4rem .2rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 1rem; }
.admin-sidebar .brand img { width: 40px; height: 40px; border-radius: 50%; background:#fff; padding:2px; }
.admin-sidebar .brand div { line-height: 1.1; }
.admin-sidebar .brand .t1 { font-weight: 700; font-size: .98rem; }
.admin-sidebar .brand .t2 { font-size: .72rem; color: #bcd4e8; }
.admin-sidebar .nav-link {
    color: #d7e6f3 !important; border-radius: 9px; padding: .6rem .85rem;
    font-weight: 500; display: flex; align-items: center; transition: all .16s ease;
}
.admin-sidebar .nav-link:hover { background: rgba(255,255,255,.10); color:#fff !important; }
.admin-sidebar .nav-link.active { background: var(--gold); color: var(--navy-900) !important; font-weight: 600; box-shadow: 0 4px 12px rgba(201,162,39,.4); }
.admin-topbar { background:#fff; box-shadow: var(--shadow-sm); }

/* ---------------- Stat cards (dashboard) ---------------- */
.stat-card {
    border: none; border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden; position: relative;
}
.stat-card .card-body { padding: 1.1rem 1.25rem; }
.stat-card .num { font-size: 2.1rem; font-weight: 800; line-height: 1.1; }
.stat-card .stat-ico {
    position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
    font-size: 2.6rem; opacity: .12;
}
.stat-card.tone-navy   { border-top: 4px solid var(--navy); }
.stat-card.tone-green  { border-top: 4px solid var(--success); }
.stat-card.tone-amber  { border-top: 4px solid var(--warning); }
.stat-card.tone-purple { border-top: 4px solid #7e57c2; }

/* ---------------- Auth page ---------------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; }
.auth-card { border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-card .auth-head { background: var(--grad-head); color:#fff; padding: 1.8rem 1.5rem; text-align:center; }
.auth-card .auth-head .seal { width: 64px; height: 64px; border-radius: 50%; background:#fff; padding:6px; box-shadow:0 0 0 3px rgba(201,162,39,.5); }

/* ---------------- Alerts ---------------- */
.alert { border: none; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.alert-danger  { background: #fdecea; color: #922b21; }
.alert-success { background: #e8f6ee; color: #14633a; }
.alert-warning { background: #fef6e7; color: #8a5a00; }
.alert-info    { background: #e9f3fb; color: #1b4f72; }

/* ---------------- Footer ---------------- */
.app-footer { background:#fff; border-top: 3px solid var(--gold); color: var(--muted); }

/* ---------------- Misc ---------------- */
.text-navy { color: var(--navy) !important; }
.bg-navy { background: var(--navy) !important; }
::selection { background: rgba(95,168,211,.3); }

@media (max-width: 768px) {
    .admin-sidebar { width: 100%; min-height: auto; position: static; }
}
