:root {
    --color-bg: #faf8f5;
    --color-surface: #ffffff;
    --color-primary: #2d5a4a;
    --color-primary-dark: #1e3d32;
    --color-primary-light: #e8f2ee;
    --color-accent: #c9a227;
    --color-accent-light: #f5ecd4;
    --color-text: #2c2c2c;
    --color-text-muted: #6b6b6b;
    --color-border: #e5e0d8;
    --color-danger: #c0392b;
    --color-success: #27ae60;
    --color-warning: #d68910;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 20px rgba(45,90,74,.1);
    --shadow-lg: 0 8px 40px rgba(45,90,74,.15);
    --radius: 12px;
    --radius-lg: 20px;
    --font-body: 'IBM Plex Sans Thai', sans-serif;
    --font-display: 'Playfair Display', serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Header */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: var(--color-text);
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text strong { font-size: 1rem; color: var(--color-primary-dark); }
.logo-text small { font-size: .75rem; color: var(--color-text-muted); }

.main-nav { display: flex; gap: .5rem; }

.main-nav a {
    text-decoration: none;
    color: var(--color-text-muted);
    padding: .5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: .95rem;
    transition: all .2s;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 2px;
    transition: .3s;
}

/* Main */
.site-main { flex: 1; padding: 2rem 0 4rem; }

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 60%, #3d7a64 100%);
    color: #fff;
    padding: 3.5rem 0;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero .container { position: relative; }

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    margin-bottom: .75rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.1rem;
    opacity: .9;
    max-width: 600px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    text-align: center;
    transition: transform .2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card .stat-number {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: .5rem;
}

.stat-card .stat-label {
    font-size: .9rem;
    color: var(--color-text-muted);
}

.stat-card.highlight {
    border-color: var(--color-accent);
    background: linear-gradient(to bottom, var(--color-accent-light), var(--color-surface));
}

.section-heading {
    font-size: 1.35rem;
    color: var(--color-primary-dark);
    margin-bottom: 1.25rem;
}

.category-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.category-stats-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
}

.category-stats-card h3 {
    font-size: 1.1rem;
    color: var(--color-primary-dark);
    margin-bottom: .5rem;
}

.category-quota {
    font-size: .9rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.category-stats-inner {
    margin-bottom: 0;
}

.category-stats-inner .stat-card {
    padding: 1rem;
}

.category-stats-inner .stat-card .stat-number {
    font-size: 1.75rem;
}

/* Info box */
.info-box {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--color-accent);
    margin-bottom: 2rem;
}

.info-box h2 {
    font-size: 1.25rem;
    color: var(--color-primary-dark);
    margin-bottom: 1rem;
}

.info-box ul {
    list-style: none;
    padding: 0;
}

.info-box li {
    padding: .5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.info-box li::before {
    content: '♪';
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-size: .85rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1.5rem;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: .95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: var(--color-accent);
    color: #fff;
}

.btn-accent:hover { background: #b08f20; }

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: #fff;
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-sm { padding: .4rem .9rem; font-size: .85rem; }

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.cta-section {
    text-align: center;
    padding: 2rem 0;
}

/* Cards */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    background: var(--color-primary-light);
    border-bottom: 1px solid var(--color-border);
}

.card-header h2 {
    font-size: 1.15rem;
    color: var(--color-primary-dark);
}

.card-body { padding: 1.5rem; }

/* Forms */
.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.form-section:last-child { border-bottom: none; margin-bottom: 0; }

.form-section h3 {
    font-size: 1.05rem;
    color: var(--color-primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.form-section h3 .section-num {
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: .4rem;
}

.form-group label .required { color: var(--color-danger); }

.form-control {
    width: 100%;
    padding: .7rem 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45,90,74,.12);
}

select.form-control { cursor: pointer; }

.form-hint {
    font-size: .8rem;
    color: var(--color-text-muted);
    margin-top: .3rem;
}

/* Member cards */
.member-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
}

.member-card .member-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.member-card .member-title {
    font-weight: 600;
    color: var(--color-primary);
    font-size: .95rem;
}

.btn-remove-member {
    background: none;
    border: none;
    color: var(--color-danger);
    cursor: pointer;
    font-size: .85rem;
    font-family: var(--font-body);
    padding: .25rem .5rem;
    border-radius: 6px;
}

.btn-remove-member:hover { background: #fdecea; }

/* YouTube preview */
.youtube-preview {
    margin-top: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--color-border);
    display: none;
}

.youtube-preview.visible { display: block; }

.youtube-preview img {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    display: block;
}

.youtube-preview .preview-info {
    padding: .75rem 1rem;
    background: var(--color-primary-light);
    font-size: .85rem;
    color: var(--color-primary-dark);
}

.youtube-preview.error {
    border-color: var(--color-danger);
}

.youtube-preview.error .preview-info {
    background: #fdecea;
    color: var(--color-danger);
}

/* File upload */
.file-upload {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: var(--color-bg);
}

.file-upload:hover,
.file-upload.dragover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.file-upload input { display: none; }

.file-upload .file-icon { font-size: 2rem; margin-bottom: .5rem; }

.file-upload .file-name {
    margin-top: .75rem;
    font-size: .85rem;
    color: var(--color-primary);
    font-weight: 500;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: .35rem .85rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
}

.status-approved { background: #d5f5e3; color: #1e8449; }
.status-pending { background: #fef9e7; color: #b7950b; }
.status-incomplete { background: #fdebd0; color: #ca6f1e; }
.status-rejected { background: #fadbd8; color: #c0392b; }
.status-draft { background: #eaecee; color: #566573; }

/* Band list */
.band-list { list-style: none; }

.band-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    gap: 1rem;
    flex-wrap: wrap;
}

.band-item:last-child { border-bottom: none; }

.band-item:hover { background: var(--color-bg); }

.band-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
}

.band-category {
    font-size: .8rem;
    color: var(--color-text-muted);
}

/* PDPA Modal */
.pdpa-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.pdpa-modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.pdpa-modal-header {
    padding: 1.5rem;
    background: var(--color-primary);
    color: #fff;
}

.pdpa-modal-header h2 { font-size: 1.2rem; }

.pdpa-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    font-size: .9rem;
    line-height: 1.8;
}

.pdpa-modal-body h3 {
    font-size: 1rem;
    margin: 1rem 0 .5rem;
    color: var(--color-primary-dark);
}

.pdpa-modal-body h3:first-child { margin-top: 0; }

.pdpa-modal-body p {
    margin-bottom: .5rem;
}

.pdpa-modal-body ul {
    margin: .5rem 0 1rem;
    padding-left: 1.25rem;
    list-style-type: disc;
    list-style-position: outside;
}

.pdpa-modal-body li {
    padding-left: .35rem;
    margin-bottom: .35rem;
}

.pdpa-modal-body li:last-child {
    margin-bottom: 0;
}

.pdpa-modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.pdpa-checkbox {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1rem;
    cursor: pointer;
}

.pdpa-checkbox input {
    margin-top: .3rem;
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* Alert */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: .9rem;
}

.alert-info { background: var(--color-primary-light); color: var(--color-primary-dark); border: 1px solid #b8d4c8; }
.alert-warning { background: #fef9e7; color: #7d6608; border: 1px solid #f9e79f; }
.alert-success { background: #d5f5e3; color: #1e8449; border: 1px solid #a9dfbf; }
.alert-danger { background: #fadbd8; color: #922b21; border: 1px solid #f5b7b1; }

/* Page title */
.page-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    color: var(--color-primary-dark);
    margin-bottom: .5rem;
}

.page-subtitle {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

/* Footer */
.site-footer {
    background: var(--color-primary-dark);
    color: rgba(255,255,255,.8);
    padding: 2rem 0;
    text-align: center;
    font-size: .9rem;
}

.footer-note {
    font-size: .8rem;
    opacity: .7;
    margin-top: .5rem;
}

.limited-note {
    text-align: center;
    padding: 1.5rem;
    background: var(--color-accent-light);
    border-radius: var(--radius);
    margin-top: 2rem;
    font-size: .9rem;
    color: #7d6608;
    border: 1px solid #f0dfa0;
}

/* Admin */
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 260px;
    background: var(--color-primary-dark);
    color: #fff;
    padding: 1.5rem;
    flex-shrink: 0;
}

.admin-sidebar h2 {
    font-size: 1rem;
    margin-bottom: 2rem;
    opacity: .9;
}

.admin-sidebar nav a {
    display: block;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    padding: .65rem 1rem;
    border-radius: 8px;
    margin-bottom: .25rem;
    font-size: .9rem;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.admin-content {
    flex: 1;
    padding: 2rem;
    background: var(--color-bg);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.admin-table th,
.admin-table td {
    padding: .85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: .9rem;
}

.admin-table th {
    background: var(--color-primary-light);
    font-weight: 600;
    color: var(--color-primary-dark);
}

.admin-table tr:hover td { background: var(--color-bg); }

.detail-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: .5rem 1rem;
    font-size: .9rem;
    margin-bottom: 1.5rem;
}

.detail-grid dt { font-weight: 600; color: var(--color-text-muted); }
.detail-grid dd { color: var(--color-text); }

.action-bar {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.login-card {
    max-width: 420px;
    margin: 4rem auto;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-muted);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn .3s ease;
    box-shadow: var(--shadow-lg);
}

.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .main-nav {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: var(--color-surface);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-md);
    }

    .main-nav.open { display: flex; }

    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; }

    .detail-grid { grid-template-columns: 1fr; }
    .detail-grid dt { margin-top: .75rem; }

    .band-item { flex-direction: column; align-items: flex-start; }
}
