/* =====================================================
   ระบบเรียกคิว — Design System
   =====================================================
   สี, ฟอนต์, เลย์เอาต์, การ์ด, ปุ่ม, ภาพเคลื่อนไหว
   ===================================================== */

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

/* ─── CSS Variables ─── */
:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #8B83FF;
    --secondary: #00D9FF;
    --secondary-dark: #00B4D8;
    --success: #00E676;
    --success-dark: #00C853;
    --warning: #FFD600;
    --danger: #FF5252;
    --danger-dark: #D32F2F;

    --bg-dark: #0F0E17;
    --bg-card: #1A1A2E;
    --bg-card-alt: #16213E;
    --bg-hover: #232946;
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --text-primary: #E4E4E7;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(108, 99, 255, 0.3);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    --font-th: 'Kanit', sans-serif;
    --font-en: 'Outfit', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-th);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ─── Background Pattern ─── */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 217, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0, 230, 118, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Typography ─── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

/* ─── Glass Card ─── */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 2rem;
    transition: all var(--transition-normal);
}
.glass-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-th);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}


.kiosk-btn {
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}
.btn:active::after {
    width: 300px;
    height: 300px;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}
.btn-primary:hover { box-shadow: 0 8px 25px rgba(108, 99, 255, 0.4); }

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: white;
}
.btn-secondary:hover { box-shadow: 0 8px 25px rgba(0, 217, 255, 0.4); }

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: #0F0E17;
}
.btn-success:hover { box-shadow: 0 8px 25px rgba(0, 230, 118, 0.4); }

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #FFC107);
    color: #0F0E17;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
}
.btn-danger:hover { box-shadow: 0 8px 25px rgba(255, 82, 82, 0.4); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: var(--bg-glass);
    border-color: var(--primary);
}

.btn-lg {
    padding: 18px 36px;
    font-size: 1.25rem;
    border-radius: var(--radius-lg);
}

.btn-xl {
    padding: 28px 48px;
    font-size: 1.5rem;
    border-radius: var(--radius-xl);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ─── Form Inputs ─── */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-th);
    font-size: 1rem;
    transition: all var(--transition-fast);
    outline: none;
}
.form-input:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}
.form-input::placeholder {
    color: var(--text-muted);
}
.form-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ─── Layout ─── */
.page-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(15, 14, 23, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}
.navbar-brand .icon {
    font-size: 1.5rem;
}
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ─── Queue Number Display ─── */
.queue-number {
    font-family: var(--font-en);
    font-weight: 900;
    letter-spacing: 2px;
}
.queue-number-xl {
    font-size: 14rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    line-height: 1;
}
.queue-number-lg {
    font-size: 4rem;
    color: var(--text-primary);
    line-height: 1;
}
.queue-number-md {
    font-size: 2rem;
    color: var(--text-primary);
}
.queue-number-sm {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* ─── Counter Badge ─── */
.counter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
}
.counter-badge-primary {
    background: rgba(108, 99, 255, 0.15);
    color: var(--primary-light);
    border: 1px solid rgba(108, 99, 255, 0.3);
}
.counter-badge-success {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, 0.3);
}
.counter-badge-warning {
    background: rgba(255, 214, 0, 0.15);
    color: var(--warning);
    border: 1px solid rgba(255, 214, 0, 0.3);
}
.counter-badge-danger {
    background: rgba(255, 82, 82, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 82, 82, 0.3);
}

/* ─── Status Badge ─── */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}
.status-waiting {
    background: rgba(255, 214, 0, 0.15);
    color: var(--warning);
}
.status-called {
    background: rgba(0, 217, 255, 0.15);
    color: var(--secondary);
}
.status-completed {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success);
}
.status-skipped {
    background: rgba(255, 82, 82, 0.15);
    color: var(--danger);
}

/* ─── Promo Video ─── */
.promo-video {
    width: 100%;
    max-height: 40vh;
    aspect-ratio: 16/9;
    object-fit: contain;
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--border-glass);
    margin-bottom: 1.5rem;
    background: #000;
}

@media (orientation: landscape) {
    .promo-video {
        max-height: 85vh; /* ขยายความสูงเมื่อเป็นแนวนอน */
        margin-bottom: 0.5rem;
    }
}

/* ─── Table ─── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background var(--transition-fast);
}
.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}
.data-table tr:last-child td {
    border-bottom: none;
}

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
}
.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-fast);
}
.modal-close:hover {
    color: var(--text-primary);
}

/* ─── Toast / Notification ─── */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 500;
    min-width: 280px;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.4s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast-success { background: linear-gradient(135deg, #00C853, #00E676); color: #0F0E17; }
.toast-error { background: linear-gradient(135deg, #D32F2F, #FF5252); }
.toast-info { background: linear-gradient(135deg, #5A52D5, #6C63FF); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ─── Animations ─── */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(108, 99, 255, 0.3); }
    50% { box-shadow: 0 0 40px rgba(108, 99, 255, 0.6); }
}
@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.animate-pulse { animation: pulse 2s infinite; }
.animate-fadeIn { animation: fadeIn 0.5s ease; }
.animate-slideInUp { animation: slideInUp 0.5s ease; }
.animate-glow { animation: glow 2s infinite; }
.animate-flash { animation: flash 1s infinite; }
.animate-bounceIn { animation: bounceIn 0.5s ease; }

/* ─── Grid ─── */
.grid {
    display: grid;
    gap: 1.5rem;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Stats Card ─── */
.stat-card {
    text-align: center;
    padding: 1.5rem;
}
.stat-card .stat-value {
    font-family: var(--font-en);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
}
.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ─── Kiosk Specific ─── */
.kiosk-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    gap: 2rem;
}
.kiosk-title {
    text-align: center;
}
.kiosk-title h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.kiosk-title p {
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin-top: 0.5rem;
}
.kiosk-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 3rem;
    max-width: 95%; /* ปลดล็อกขีดจำกัด ให้ขยายเต็มจอ */
    width: 100%;
    margin: 0 auto;
}
.kiosk-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 2rem 2.5rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.bg-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    color: rgba(255, 255, 255, 0.08); /* สีขาวจางๆ */
    opacity: 0.6; /* ตามคำขอ 60% */
    z-index: 0;
    pointer-events: none;
    transition: all 0.5s ease;
}
.kiosk-btn:hover .bg-icon {
    transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
    color: rgba(108, 99, 255, 0.15);
}
.kiosk-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(108,99,255,0.1), rgba(0,217,255,0.1));
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.kiosk-btn:hover::before {
    opacity: 1;
}
.kiosk-btn:hover {
    transform: translateY(-8px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.3);
}
.kiosk-btn:active {
    transform: translateY(-2px) scale(0.98);
}
.kiosk-btn .prefix {
    font-family: var(--font-en);
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
}
.kiosk-btn-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.kiosk-btn-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.kiosk-btn-icon {
    width: 1.5em; /* Fixed width relative to font-size to ensure perfect alignment */
    text-align: center;
    font-size: 1.2em;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    z-index: 1;
}
.kiosk-btn .type-name {
    font-family: var(--font-th);
    font-size: 2.6rem;
    font-weight: 600;
    letter-spacing: 0px;
    background: linear-gradient(135deg, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
    white-space: nowrap; /* ป้องกันคำตกบรรทัด */
    text-align: left;
}
.kiosk-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: rgba(255, 82, 82, 0.3);
    background: rgba(255, 82, 82, 0.05);
}
.kiosk-btn.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(255, 82, 82, 0.3);
}
.kiosk-btn.disabled .prefix {
    background: var(--text-muted);
    -webkit-text-fill-color: var(--text-muted);
}
.kiosk-btn .waiting-count {
    font-family: var(--font-th);
    font-size: clamp(1.5rem, 3vw, 4rem); /* ใหญ่ขึ้นตามจอ */
    color: #e2e8f0;
    margin-top: 1.5rem;
    padding: 12px 36px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

/* Kiosk Ticket Modal */
.ticket-modal {
    text-align: center;
}
.ticket-modal .ticket-number {
    font-family: var(--font-en);
    font-size: 6rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin: 1rem 0;
    animation: bounceIn 0.5s ease;
}
.ticket-modal .ticket-type {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.ticket-modal .ticket-info {
    color: var(--text-muted);
    font-size: 1rem;
}
.ticket-modal .ticket-waiting {
    margin-top: 1rem;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    background: rgba(255, 214, 0, 0.1);
    color: var(--warning);
    display: inline-block;
    font-weight: 600;
}

.monitor-queue-item .q-number {
    font-family: var(--font-en);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
}
.monitor-queue-item .q-counter {
    color: var(--secondary);
    font-weight: 600;
    font-size: 1rem;
}
.monitor-queue-item.active {
    background: rgba(108, 99, 255, 0.1);
    border-left: 4px solid var(--primary);
}
.monitor-queue-item.new {
    animation: flash 1s ease 3;
}

/* ─── Monitor Header Bar ─── */
.monitor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(15, 14, 23, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    grid-column: 1 / -1;
}
.monitor-header .org-name {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.monitor-header .datetime {
    color: var(--text-secondary);
    font-family: var(--font-en);
    font-size: 1.1rem;
}

/* ─── User/Staff Specific ─── */
.staff-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: calc(100vh - 60px);
}
.staff-sidebar {
    background: rgba(255,255,255,0.02);
    border-right: 1px solid var(--border-glass);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.staff-main {
    padding: 1.5rem 2rem;
    overflow-y: auto;
}
.current-serving {
    text-align: center;
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.current-serving .label {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.current-serving .actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}
.queue-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.02);
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}
.queue-list-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--border-glass);
}
.queue-list-item .q-num {
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 1.1rem;
}
.queue-list-item .q-time {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ─── Admin Specific ─── */
.admin-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: calc(100vh - 60px);
}
.admin-sidebar {
    background: rgba(255,255,255,0.02);
    border-right: 1px solid var(--border-glass);
    padding: 1rem 0;
}
.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-th);
    font-size: 0.95rem;
}
.admin-nav-item:hover, .admin-nav-item.active {
    color: var(--text-primary);
    background: rgba(108, 99, 255, 0.1);
    border-right: 3px solid var(--primary);
}
.admin-main {
    padding: 2rem;
    overflow-y: auto;
}
.admin-main h2 {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ─── Login Page ─── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}
.login-card {
    max-width: 420px;
    width: 100%;
    text-align: center;
}
.login-card h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-card .subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    .staff-layout, .admin-layout {
        grid-template-columns: 1fr;
    }
    .staff-sidebar, .admin-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
    }
    .admin-sidebar {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
    }
    .admin-nav-item {
        white-space: nowrap;
        border-right: none !important;
        border-bottom: 3px solid transparent;
        padding: 10px 16px;
    }
    .admin-nav-item:hover, .admin-nav-item.active {
        border-right: none !important;
        border-bottom: 3px solid var(--primary);
    }
    .monitor-wrapper {
        grid-template-columns: 1fr;
    }
    .monitor-main {
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
        min-height: 50vh;
    }
    .queue-number-xl {
        font-size: 5rem;
    }
    .kiosk-title h1 {
        font-size: 2rem;
    }
    .kiosk-buttons {
        grid-template-columns: 1fr;
    }
    .navbar {
        padding: 0.75rem 1rem;
    }
}

/* ─── Kiosk Responsive: แนวตั้ง (Portrait) ─── */
@media (orientation: portrait) {
    .kiosk-wrapper {
        padding: 3vh 2vw;
        gap: 2vh;
        justify-content: flex-start;
        padding-top: 5vh;
        min-height: 100vh;
        max-height: 100vh;
        overflow: hidden;
    }
    .kiosk-title h1 {
        font-size: 4.5vh;
    }
    .kiosk-title p {
        font-size: 2vh;
        margin-top: 1vh;
    }
    .kiosk-buttons {
        grid-template-columns: 1fr;
        gap: 1.5vh;
        max-width: 90%;
        margin: 0 auto;
        padding-bottom: 2vh;
    }
    .kiosk-btn {
        padding: 2vh 3vw;
        border-radius: var(--radius-xl);
        min-height: 0;
    }
    .kiosk-btn-inner {
        align-items: center;
    }
    .kiosk-btn .type-name {
        font-size: 4vh;
    }
    .kiosk-btn-icon {
        font-size: 1.2em;
        width: 1.5em;
    }
    .kiosk-btn .waiting-count {
        font-size: 2vh;
        margin-top: 0;
    }
}

/* แนวตั้ง — จอใหญ่พิเศษ (Kiosk 31 นิ้ว แนวตั้ง สูง 27 นิ้ว) */
@media (orientation: portrait) and (min-height: 1200px) {
    .kiosk-wrapper {
        padding-top: 6vh;
        gap: 3vh;
    }
    .kiosk-title h1 {
        font-size: 6vh;
    }
    .kiosk-title p {
        font-size: 2.5vh;
    }
    .kiosk-buttons {
        max-width: 90%;
        gap: 1.5vh;
        margin-top: 1vh;
    }
    .kiosk-btn {
        padding: 2.5vh 3vw;
        border-radius: var(--radius-xl);
    }
    .kiosk-btn .type-name {
        font-size: 5vh;
    }
    .kiosk-btn .waiting-count {
        font-size: 2.5vh;
        margin-top: 0;
    }
}

/* แนวตั้ง — จอเล็กมาก (มือถือ) */
@media (orientation: portrait) and (max-width: 480px) {
    .kiosk-buttons {
        grid-template-columns: 1fr;
    }
    .kiosk-btn {
        padding: 1.5rem 1rem;
    }
    .kiosk-btn .prefix {
        font-size: 2.5rem;
    }
}

/* ─── Kiosk Responsive: แนวนอน (Landscape) ─── */
@media (orientation: landscape) {
    .kiosk-wrapper {
        padding: 1rem 2rem;
        gap: 1rem;
        justify-content: center;
    }
    .kiosk-title h1 {
        font-size: clamp(1.5rem, 4vh, 2.5rem);
    }
    .kiosk-title p {
        font-size: clamp(0.85rem, 2vh, 1.1rem);
    }
    .kiosk-buttons {
        grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
        gap: 2.5rem;
        max-width: 1400px; /* ความกว้างที่สวยงามพอดี */
        margin: 2rem auto 0; /* เพิ่มระยะห่างจากวิดีโอด้านบน */
    }
    .kiosk-btn {
        padding: clamp(2rem, 3vh, 3.5rem) clamp(1rem, 2vw, 2rem);
    }
    .kiosk-btn .type-name {
        font-size: clamp(1.8rem, 2.5vw, 2.6rem); /* ขนาดกำลังสวย ไม่อึดอัด */
    }
    .kiosk-btn .waiting-count {
        font-size: clamp(1rem, 1.2vw, 1.2rem);
    }
}

/* แนวนอน — จอกว้างมาก (TV, Large Monitor) */
@media (orientation: landscape) and (min-width: 1400px) {
    .kiosk-buttons {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        max-width: 1600px;
    }
    .kiosk-btn .type-name {
        font-size: clamp(2.2rem, 3vw, 3rem);
    }
}

/* แนวนอน — จอใหญ่พิเศษ (Kiosk 31 นิ้วขึ้นไป 1920px+) */
@media (orientation: landscape) and (min-width: 1900px) {
    .kiosk-buttons {
        grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
        max-width: 2200px;
        gap: 4rem;
        margin-top: 4rem;
    }
    .kiosk-btn {
        padding: 5rem 3rem;
        border-radius: var(--radius-xl);
    }
    .kiosk-btn .type-name {
        font-size: 4.5rem;
    }
    .kiosk-btn .waiting-count {
        font-size: 2rem;
    }
    .kiosk-title h1 {
        font-size: 4rem;
    }
    .kiosk-title p {
        font-size: 2rem;
    }
}

/* แนวนอน — จอเตี้ย (แถบ Landscape แคบๆ) */
@media (orientation: landscape) and (max-height: 500px) {
    .kiosk-wrapper {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }
    .kiosk-title {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
    .kiosk-title h1 {
        font-size: 1.3rem;
        margin: 0;
    }
    .kiosk-title p {
        font-size: 0.8rem;
        margin: 0;
    }
    .kiosk-buttons {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.5rem;
    }
    .kiosk-btn {
        padding: 0.75rem;
    }
    .kiosk-btn .prefix {
        font-size: 1.5rem;
    }
    .kiosk-btn .type-name {
        font-size: 0.75rem;
    }
}

/* ─── Monitor Modern Layout ─── */
.monitor-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.monitor-media-section {
    flex: 6; /* สัดส่วน 60% */
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-right: 2px solid var(--border-glass);
}
.promo-video-full {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.monitor-no-video {
    text-align: center;
    color: var(--text-muted);
}
.monitor-no-video .icon { font-size: 5rem; margin-bottom: 1rem; opacity: 0.2; }
.monitor-no-video .text { font-size: 1.5rem; font-weight: 300; opacity: 0.5; }

.monitor-board-section {
    flex: 4; /* สัดส่วน 40% */
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.02);
}
.board-header {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--primary);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 2;
}
.board-header .col-number { flex: 2; text-align: center; }
.board-header .col-type { flex: 2; text-align: center; border-left: 1px solid rgba(255,255,255,0.1); }
.board-header .col-counter { flex: 1.5; text-align: center; border-left: 1px solid rgba(255,255,255,0.1); }

.board-list {
    flex: 1;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
}
.board-item {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    flex: 1 1 0;
    max-height: 14%;
}
.board-item .col-number {
    flex: 2;
    text-align: center;
    font-family: var(--font-en);
    font-size: 3.5rem;
    font-weight: 900;
    color: #FFFFFF;
}
.board-item .col-type {
    flex: 2;
    text-align: center;
    font-family: var(--font-th);
    font-size: 1.8rem;
    font-weight: 600;
    color: #A0AEC0;
}
.board-item .col-counter {
    flex: 1.5;
    text-align: center;
    font-family: var(--font-en);
    font-size: 2.5rem;
    font-weight: 700;
    color: #E2E8F0;
}

/* Ticker */
.monitor-ticker {
    display: flex;
    background: #111;
    color: white;
    align-items: center;
    height: 60px;
    border-top: 1px solid var(--border-glass);
}
.ticker-label {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 1.25rem;
    white-space: nowrap;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    z-index: 2;
}
.ticker-content {
    flex: 1;
    font-size: 1.5rem;
    padding: 0 1rem;
    overflow: hidden;
    white-space: nowrap;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* ─── Utility ─── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ─── Animations ─── */
@keyframes flash {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0; }
}
.animate-flash {
    animation: flash 1s ease-in-out 3;
}

@keyframes pulseInfinite {
    0% { box-shadow: 0 0 0 0 rgba(255, 51, 51, 0.4); transform: scale(1.02); }
    70% { box-shadow: 0 0 0 20px rgba(255, 51, 51, 0); transform: scale(1.02); }
    100% { box-shadow: 0 0 0 0 rgba(255, 51, 51, 0); transform: scale(1.02); }
}
.animate-flash-infinite {
    background: rgba(255, 51, 51, 0.15);
    border: 2px solid #ff3333;
    animation: pulseInfinite 1.5s infinite;
}
.animate-flash-infinite .col-number {
    color: #ff3333;
    font-size: 5rem;
}
.animate-flash-infinite .col-type {
    color: #ff3333;
    opacity: 1;
    font-size: 2.2rem;
}
.animate-flash-infinite .col-counter {
    color: #ff3333;
    font-size: 3.5rem;
}

/* ─── Kiosk Full Screen Strict Layout (1080x1920 & 1920x1080) ─── */
.kiosk-page {
    overflow: hidden !important;
    width: 100vw;
    height: 100vh;
}
.kiosk-page .page-wrapper {
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}
.kiosk-page .kiosk-wrapper {
    height: 100vh;
    min-height: 100vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    gap: 2rem;
}

.kiosk-page .kiosk-buttons {
    display: flex;
    flex: 1;
    width: 100%;
    gap: 2rem;
    max-width: 100%;
    margin: 0;
    align-content: stretch;
}

.kiosk-header-title {
    text-align: center;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 1rem;
    margin-bottom: 0;
}

/* Base button styles to stretch */
.kiosk-page .kiosk-btn {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0 4rem;
    margin: 0;
    height: auto;
}

.kiosk-btn-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}
.kiosk-btn-left {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.kiosk-btn-icon {
    color: rgba(255,255,255,0.9);
}
.kiosk-btn-inner .type-name {
    position: static;
    transform: none;
    font-weight: 700;
}
.kiosk-btn-inner .waiting-count {
    margin-top: 0;
    font-weight: 600;
}

/* Portrait (1080x1920) */
@media (orientation: portrait) {
    .kiosk-page .kiosk-buttons {
        flex-direction: column;
    }
    .kiosk-btn-icon {
        font-size: 8vw;
    }
    .kiosk-btn-inner .type-name {
        font-size: 6vw;
    }
    .kiosk-btn-inner .waiting-count {
        font-size: 4vw;
        padding: 2vw 4vw;
        border-radius: 60px;
    }
    .kiosk-header-title {
        font-size: 4vw;
    }
}

/* Landscape (1920x1080) */
@media (orientation: landscape) {
    .kiosk-page .kiosk-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 1fr;
    }
    .kiosk-page .kiosk-btn {
        padding: 0 3rem;
    }
    .kiosk-btn-icon {
        font-size: 4vw;
    }
    .kiosk-btn-inner .type-name {
        font-size: 3vw;
    }
    .kiosk-btn-inner .waiting-count {
        font-size: 2vw;
        padding: 1vw 2vw;
        border-radius: 40px;
    }
    .kiosk-header-title {
        font-size: 2vw;
    }
}

/* Print Area (80mm Thermal Printer) */
.print-area { display: none; }

@media print {
    @page {
        margin: 0;
    }
    html, body {
        width: 80mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
        min-height: 0 !important;
        height: fit-content !important;
        overflow: hidden !important;
    }
    body::before, body::after {
        display: none !important;
    }
    body > *:not(#print-area) {
        display: none !important;
    }
    #print-area {
        display: block !important;
        visibility: visible !important;
        width: 100%;
        margin: 0 !important;
        padding: 0 !important;
        color: #000 !important;
        background: #fff !important;
        text-align: center;
        font-family: 'Tahoma', 'Arial', sans-serif !important;
        position: static !important;
        overflow: visible !important;
    }
    #print-area * {
        color: #000 !important;
        visibility: visible !important;
    }
}
