/* =====================================================
   ระบบขอทำบัตร สพป.อุบลราชธานี เขต 3
   สไตล์หลัก - โทนสีราชการ
   ===================================================== */

:root {
    --primary: #1a3a6b;
    --primary-light: #2563b0;
    --primary-dark: #0f2547;
    --secondary: #3b82c4;
    --accent: #e8a020;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow: 0 4px 12px rgba(0,0,0,.10);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.15);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --transition: all .25s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Sarabun', 'Prompt', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    font-size: 15px;
    line-height: 1.6;
}

/* ===== NAVBAR ===== */
.navbar-main {
	/*background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);*/
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 0%, var(--primary-light) 100%);
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.navbar-main .navbar-brand {
    color: var(--white) !important;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}
.navbar-main .navbar-brand img { height: 48px; width: 48px; object-fit: contain; }
.navbar-main .brand-text small { font-size: .75rem; opacity: .85; display: block; font-weight: 400; }
.navbar-main .nav-link {
    color: rgba(255,255,255,.88) !important;
    font-weight: 500;
    padding: 1rem .85rem !important;
    transition: var(--transition);
    position: relative;
}
.navbar-main .nav-link:hover,
.navbar-main .nav-link.active {
    color: var(--white) !important;
    background: rgba(255,255,255,.12);
}
.navbar-main .btn-login {
    background: var(--accent);
    color: var(--white) !important;
    border-radius: var(--radius-sm);
    padding: .45rem 1.1rem !important;
    font-weight: 600;
    margin: .6rem .3rem;
    transition: var(--transition);
}
.navbar-main .btn-login:hover { background: #c8880e; transform: translateY(-1px); }
.navbar-main .btn-register {
    background: transparent;
    color: var(--white) !important;
    border: 2px solid rgba(255,255,255,.6);
    border-radius: var(--radius-sm);
    padding: .4rem 1rem !important;
    font-weight: 600;
    margin: .6rem .3rem;
    transition: var(--transition);
}
.navbar-main .btn-register:hover { border-color: var(--white); background: rgba(255,255,255,.1); }

/* ===== HERO / BANNER ===== */
.hero-banner {
    position: relative;
    /*background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));*/
	background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 0%, var(--primary-light) 100%);
    min-height: 260px;
    overflow: hidden;
}
.hero-banner .carousel-item img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    filter: brightness(.85);
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15,37,71,.5) 0%, rgba(15,37,71,.2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    padding: 2rem;
}
.hero-overlay h1 { font-size: 2.2rem; font-weight: 700; text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.hero-overlay p { font-size: 1.1rem; opacity: .9; }

/* ===== CARDS ===== */
.card { border: none; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border-radius: var(--radius) var(--radius) 0 0 !important;
    padding: 1rem 1.5rem;
    font-weight: 600;
}
.card-header-primary .card-icon { font-size: 1.4rem; margin-right: .5rem; }

/* ===== STATS CARDS ===== */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 5px solid;
    transition: var(--transition);
    text-align: center;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card.blue { border-color: var(--primary); }
.stat-card.green { border-color: var(--success); }
.stat-card.orange { border-color: var(--warning); }
.stat-card.red { border-color: var(--danger); }
.stat-card.cyan { border-color: var(--info); }
.stat-card .stat-icon { font-size: 2.2rem; margin-bottom: .5rem; }
.stat-card .stat-number { font-size: 2rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-card .stat-label { font-size: .85rem; color: var(--gray-500); margin-top: .25rem; }

/* ===== VISITOR BADGE ===== */
.visitor-bar {
    background: var(--primary-dark);
    color: rgba(255,255,255,.8);
    font-size: .8rem;
    padding: .3rem 0;
}
.visitor-bar span { margin: 0 .75rem; }
.visitor-bar .badge-visit { background: rgba(255,255,255,.15); padding: .15rem .5rem; border-radius: 20px; }

/* ===== STEPS / PROCESS ===== */
.step-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-top: 4px solid var(--primary);
    text-align: center;
    transition: var(--transition);
    height: 100%;
}
.step-box:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.step-num {
    width: 48px; height: 48px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; font-weight: 700;
    margin: 0 auto 1rem;
}
.step-icon { font-size: 2.5rem; margin-bottom: .75rem; }

/* ===== FORMS ===== */
.form-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}
.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    border-left: 4px solid var(--primary);
    padding-left: .75rem;
    margin-bottom: 1.25rem;
    padding-bottom: .25rem;
}
.form-control, .form-select {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .92rem;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,176,.12);
}
.form-label { font-weight: 500; font-size: .9rem; color: var(--gray-700); margin-bottom: .35rem; }
.required-star { color: var(--danger); }

/* ===== BUTTONS ===== */
.btn-primary-gov {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    padding: .55rem 1.5rem;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary-gov:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,58,107,.3); color: var(--white); }

/* ===== TABLE ===== */
.table-gov th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    font-size: .88rem;
}
.table-gov tbody tr:hover { background: var(--gray-50); }
.table-gov td, .table-gov th { vertical-align: middle; }

/* ===== SIDEBAR (Admin) ===== */
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
}
.admin-sidebar.collapsed { width: 72px; }
.sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    gap: .75rem;
}
.sidebar-brand img { height: 42px; width: 42px; object-fit: contain; flex-shrink: 0; }
.sidebar-brand-text { color: var(--white); font-size: .85rem; font-weight: 600; line-height: 1.3; }
.sidebar-brand-text small { opacity: .7; font-weight: 400; font-size: .75rem; }
.sidebar-menu { padding: 1rem 0; }
.sidebar-menu-item { display: block; }
.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.25rem;
    color: rgba(255,255,255,.8);
    text-decoration: none;
    font-size: .9rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-menu-link:hover,
.sidebar-menu-link.active {
    background: rgba(255,255,255,.12);
    color: var(--white);
    border-left-color: var(--accent);
}
.sidebar-menu-link .menu-icon { font-size: 1.1rem; min-width: 22px; text-align: center; }
.sidebar-menu-label {}
.sidebar-section-title {
    font-size: .72rem;
    font-weight: 700;
    color: rgba(255,255,255,.4);
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: 1rem 1.25rem .3rem;
}
.admin-content {
    margin-left: 260px;
    flex: 1;
    transition: var(--transition);
}
.admin-topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 99;
}
.admin-main { padding: 1.5rem; }

/* ===== STATUS STEPS ===== */
.status-timeline {
    display: flex;
    align-items: flex-start;
    padding: 1.5rem 0;
    overflow-x: auto;
}
.status-step {
    flex: 1;
    text-align: center;
    position: relative;
    min-width: 100px;
}
.status-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: var(--gray-200);
}
.status-step.done::after { background: var(--success); }
.status-step-circle {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: 700;
    margin: 0 auto .5rem;
    position: relative;
    z-index: 1;
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--gray-200);
}
.status-step.done .status-step-circle { background: var(--success); color: var(--white); box-shadow: 0 0 0 2px var(--success); }
.status-step.active .status-step-circle { background: var(--primary); color: var(--white); box-shadow: 0 0 0 2px var(--primary); animation: pulse 2s infinite; }
.status-step.rejected .status-step-circle { background: var(--danger); color: var(--white); box-shadow: 0 0 0 2px var(--danger); }
.status-step-label { font-size: .78rem; color: var(--gray-500); font-weight: 500; }
.status-step.active .status-step-label { color: var(--primary); font-weight: 700; }
.status-step.done .status-step-label { color: var(--success); }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--primary), 0 0 0 5px rgba(37,99,176,.2); }
    50% { box-shadow: 0 0 0 2px var(--primary), 0 0 0 10px rgba(37,99,176,.1); }
}

/* ===== FILE UPLOAD ===== */
.file-upload-box {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 1rem;
    background: var(--gray-50);
    transition: var(--transition);
    position: relative;
}
.file-upload-box:hover { border-color: var(--primary-light); background: #f0f6ff; }
.file-upload-box.has-file { border-color: var(--success); background: #f0fdf4; }
.file-upload-box .file-name { font-size: .82rem; color: var(--gray-500); margin-top: .3rem; }
.file-remove-btn {
    position: absolute;
    top: 6px; right: 6px;
    background: var(--danger);
    color: white;
    border: none;
    width: 22px; height: 22px;
    border-radius: 50%;
    font-size: .75rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}
.file-upload-box.has-file .file-remove-btn { display: flex; }

/* ===== PHOTO UPLOAD / CROP ===== */
.photo-upload-area {
    width: 120px; height: 160px;
    border: 3px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
    background: var(--gray-100);
    position: relative;
}
.photo-upload-area:hover { border-color: var(--primary); }
.photo-upload-area img { width: 100%; height: 100%; object-fit: cover; }
.photo-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .75rem;
}
.photo-controls button {
    font-size: .78rem;
    padding: .25rem .6rem;
}

/* ===== PAGINATION ===== */
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.page-link { color: var(--primary); }
.page-link:hover { color: var(--primary-dark); }

/* ===== ALERTS ===== */
.alert { border-radius: var(--radius-sm); border: none; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ===== FOOTER ===== */
.footer-main {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: rgba(255,255,255,.8);
    padding: 2rem 0 1rem;
    margin-top: auto;
}
.footer-main .footer-brand { color: var(--white); font-weight: 700; font-size: 1.05rem; }
.footer-main a { color: rgba(255,255,255,.7); text-decoration: none; }
.footer-main a:hover { color: var(--white); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.15);
    margin-top: 1.5rem;
    padding-top: 1rem;
    font-size: .82rem;
    text-align: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-260px); }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-content { margin-left: 0; }
    .hero-overlay h1 { font-size: 1.4rem; }
    .hero-banner .carousel-item img { height: 220px; }
}

/* ===== MISC ===== */
.text-primary-gov { color: var(--primary) !important; }
.bg-primary-gov { background: var(--primary) !important; }
.border-primary-gov { border-color: var(--primary) !important; }
.badge-status { font-size: .78rem; padding: .35rem .7rem; border-radius: 20px; font-weight: 600; }
.cursor-pointer { cursor: pointer; }
.transition { transition: var(--transition); }

/* Password toggle */
.password-wrapper { position: relative; }
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0;
    font-size: 1rem;
}
