/* =====================================================
   Admin Panel Stylesheet - หมอลำมรดกภูมิปัญญา
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&family=Kanit:wght@400;500;600;700&display=swap');

:root {
    --admin-bg: #120500;
    --admin-sidebar: #1E0800;
    --admin-card: #2D1200;
    --admin-border: rgba(212, 160, 23, 0.2);
    --color-golden: #D4A017;
    --color-gold-light: #F0C040;
    --color-cream: #F5E6C8;
    --color-red: #C8421A;
    --color-red-dark: #9B2335;
    --color-green: #2E7D32;
    --color-amber: #C97D2A;
    --color-blue: #1565C0;

    --gradient-gold: linear-gradient(135deg, #D4A017, #F0C040);
    --gradient-btn: linear-gradient(135deg, #C8421A, #9B2335);
    --gradient-sidebar: linear-gradient(180deg, #1A0600, #2D1000);

    --font-thai: 'Sarabun', sans-serif;
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: var(--font-thai);
    background: var(--admin-bg);
    color: var(--color-cream);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
}

/* ====== Scrollbar ====== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--admin-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-golden);
    border-radius: 3px;
}

a {
    color: var(--color-golden);
    text-decoration: none;
    transition: var(--transition);
}

/* ====== Login Page ====== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(200, 66, 26, 0.25) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 70%, rgba(200, 66, 26, 0.15) 0%, transparent 60%),
        linear-gradient(180deg, #1A0600, #300E00, #1A0600);
    padding: 24px;
}

.login-box {
    background: rgba(45, 18, 0, 0.9);
    border: 1px solid rgba(212, 160, 23, 0.25);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(212, 160, 23, 0.1);
    backdrop-filter: blur(10px);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 16px;
    box-shadow: 0 8px 25px rgba(212, 160, 23, 0.4);
}

.login-title {
    font-family: 'Kanit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-gold-light);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: rgba(245, 230, 200, 0.55);
}

/* ====== Form Styles ====== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-cream);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(212, 160, 23, 0.25);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--color-cream);
    font-family: var(--font-thai);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--color-golden);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15);
    background: rgba(0, 0, 0, 0.45);
}

.form-control::placeholder {
    color: rgba(245, 230, 200, 0.3);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

select.form-control option {
    background: #2D1200;
    color: var(--color-cream);
}

/* ====== Buttons ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 8px;
    font-family: var(--font-thai);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-btn);
    color: white;
    box-shadow: 0 4px 15px rgba(200, 66, 26, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 66, 26, 0.55);
    color: white;
}

.btn-gold {
    background: var(--gradient-gold);
    color: var(--admin-bg);
    font-weight: 700;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 160, 23, 0.4);
    color: var(--admin-bg);
}

.btn-success {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #C62828, #8B0000);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--color-golden);
    border: 1px solid rgba(212, 160, 23, 0.4);
}

.btn-outline:hover {
    background: rgba(212, 160, 23, 0.1);
    color: var(--color-gold-light);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
    border-radius: 10px;
}

/* ====== Alert ====== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid;
}

.alert-danger {
    background: rgba(198, 40, 40, 0.15);
    border-color: rgba(198, 40, 40, 0.4);
    color: #FFCDD2;
}

.alert-success {
    background: rgba(46, 125, 50, 0.15);
    border-color: rgba(46, 125, 50, 0.4);
    color: #C8E6C9;
}

.alert-warning {
    background: rgba(245, 127, 23, 0.15);
    border-color: rgba(245, 127, 23, 0.4);
    color: #FFE082;
}

.alert-info {
    background: rgba(21, 101, 192, 0.15);
    border-color: rgba(21, 101, 192, 0.4);
    color: #B3E5FC;
}

/* ====== Admin Layout ====== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ====== Sidebar ====== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gradient-sidebar);
    border-right: 1px solid rgba(212, 160, 23, 0.15);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(212, 160, 23, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    background: var(--gradient-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(212, 160, 23, 0.3);
}

.sidebar-brand {
    font-family: 'Kanit', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-cream);
    line-height: 1.3;
}

.sidebar-nav {
    padding: 12px 12px;
    flex: 1;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(245, 230, 200, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 8px 12px 6px;
    margin-top: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: rgba(245, 230, 200, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: rgba(212, 160, 23, 0.1);
    color: var(--color-gold-light);
}

.sidebar-link.active {
    background: rgba(212, 160, 23, 0.15);
    color: var(--color-gold-light);
    border-left: 3px solid var(--color-golden);
}

.sidebar-link .link-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(212, 160, 23, 0.15);
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.admin-info {
    overflow: hidden;
}

.admin-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-cream);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-role {
    font-size: 0.75rem;
    color: var(--color-golden);
}

/* ====== Main Content ====== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ====== Top Header ====== */
.top-header {
    height: var(--header-height);
    background: rgba(26, 6, 0, 0.95);
    border-bottom: 1px solid rgba(212, 160, 23, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.page-title {
    font-family: 'Kanit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-gold-light);
}

.breadcrumb {
    font-size: 0.8rem;
    color: rgba(245, 230, 200, 0.5);
    margin-top: 2px;
}

.breadcrumb a {
    color: rgba(245, 230, 200, 0.5);
}

.breadcrumb a:hover {
    color: var(--color-golden);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ====== Page Content ====== */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ====== Dashboard Cards ====== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--admin-card);
    border: 1px solid rgba(212, 160, 23, 0.2);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(212, 160, 23, 0.4);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.stat-icon.gold {
    background: rgba(212, 160, 23, 0.2);
}

.stat-icon.red {
    background: rgba(200, 66, 26, 0.2);
}

.stat-icon.green {
    background: rgba(46, 125, 50, 0.2);
}

.stat-icon.blue {
    background: rgba(21, 101, 192, 0.2);
}

.stat-value {
    font-family: 'Kanit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-gold-light);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: rgba(245, 230, 200, 0.65);
    margin-top: 4px;
}

/* ====== Data Tables ====== */
.table-card {
    background: var(--admin-card);
    border: 1px solid rgba(212, 160, 23, 0.15);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(212, 160, 23, 0.15);
    flex-wrap: wrap;
    gap: 12px;
}

.table-title {
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-gold-light);
}

.table-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 160, 23, 0.2);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--color-cream);
    font-family: var(--font-thai);
    font-size: 0.88rem;
    outline: none;
    width: 220px;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--color-golden);
}

.search-input::placeholder {
    color: rgba(245, 230, 200, 0.3);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: rgba(212, 160, 23, 0.08);
    color: var(--color-gold-light);
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(212, 160, 23, 0.15);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid rgba(212, 160, 23, 0.08);
    transition: var(--transition);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(212, 160, 23, 0.06);
}

tbody td {
    padding: 12px 16px;
    color: rgba(245, 230, 200, 0.85);
    vertical-align: middle;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-active {
    background: rgba(46, 125, 50, 0.2);
    color: #A5D6A7;
    border: 1px solid rgba(46, 125, 50, 0.4);
}

.badge-inactive {
    background: rgba(200, 66, 26, 0.2);
    color: #FFAB91;
    border: 1px solid rgba(200, 66, 26, 0.35);
}

.badge-national {
    background: rgba(212, 160, 23, 0.2);
    color: var(--color-gold-light);
    border: 1px solid rgba(212, 160, 23, 0.35);
}

.badge-region {
    background: rgba(21, 101, 192, 0.2);
    color: #90CAF9;
    border: 1px solid rgba(21, 101, 192, 0.35);
}

.badge-province {
    background: rgba(46, 125, 50, 0.15);
    color: #C8E6C9;
    border: 1px solid rgba(46, 125, 50, 0.3);
}

.badge-local {
    background: rgba(97, 97, 97, 0.2);
    color: #E0E0E0;
    border: 1px solid rgba(97, 97, 97, 0.3);
}

/* ====== Pagination ====== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    flex-wrap: wrap;
}

.page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    background: rgba(212, 160, 23, 0.08);
    color: rgba(245, 230, 200, 0.7);
    border: 1px solid rgba(212, 160, 23, 0.15);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.page-btn:hover,
.page-btn.active {
    background: var(--gradient-gold);
    color: var(--admin-bg);
    border-color: transparent;
}

/* ====== Form Cards ====== */
.form-card {
    background: var(--admin-card);
    border: 1px solid rgba(212, 160, 23, 0.15);
    border-radius: var(--border-radius);
    padding: 28px;
    margin-bottom: 24px;
}

.form-card-title {
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-gold-light);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(212, 160, 23, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row-2 {
    grid-template-columns: 1fr 1fr;
}

.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

/* ====== Photo Upload ====== */
.upload-zone {
    border: 2px dashed rgba(212, 160, 23, 0.3);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.2);
}

.upload-zone:hover {
    border-color: rgba(212, 160, 23, 0.6);
    background: rgba(212, 160, 23, 0.05);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 0.9rem;
    color: rgba(245, 230, 200, 0.6);
}

#previewPhoto {
    border-radius: 12px;
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border: 2px solid rgba(212, 160, 23, 0.3);
    display: none;
    margin: 12px auto 0;
}

/* ====== Responsive ====== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .form-row-2,
    .form-row-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .page-content {
        padding: 16px;
    }

    .stat-cards {
        grid-template-columns: 1fr 1fr;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-input {
        width: 100%;
    }
}