/* ============================================
   ระบบเรียกบัตรคิว โรงเรียนสวรรค์อนันต์วิทยา
   Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kanit', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #3b82f6 0%, #ec4899 100%);
    overflow-x: hidden;
}

/* Header Styles */
.main-header {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1920px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.school-logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.header-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 300;
}

.datetime-section {
    text-align: right;
    color: white;
}

.current-time {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.current-date {
    font-size: 1rem;
    opacity: 0.9;
}

/* Main Container */
.main-container {
    padding-top: 100px;
    min-height: 100vh;
}

/* Customer Display Layout */
.display-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1920px;
    margin: 0 auto;
    height: calc(100vh - 100px);
}

/* Video Section */
.video-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

.video-container {
    width: 100%;
    height: 100%;
    position: relative;
    padding-bottom: 56.25%;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Queue Display Section */
.queue-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.queue-display {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.queue-display-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.queue-display-title {
    font-size: 1.5rem;
    color: #374151;
    font-weight: 600;
}

.current-queue-box {
    background: linear-gradient(135deg, #3b82f6 0%, #ec4899 100%);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    color: white;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 20px 50px rgba(59, 130, 246, 0.6); }
}

.current-queue-label {
    font-size: 1.2rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.current-queue-number {
    font-size: 5rem;
    font-weight: 800;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.current-counter {
    font-size: 2rem;
    font-weight: 600;
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    display: inline-block;
}

/* Waiting Queue List */
.waiting-queue {
    flex: 1;
    overflow-y: auto;
}

.waiting-queue-title {
    font-size: 1.2rem;
    color: #374151;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.waiting-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.waiting-item {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #6b7280;
    transition: all 0.3s ease;
}

.waiting-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Marquee Section */
.marquee-section {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 1rem;
    overflow: hidden;
    border-radius: 10px;
    margin-top: 1rem;
}

.marquee-content {
    white-space: nowrap;
    animation: marquee 20s linear infinite;
    font-size: 1.2rem;
}

@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Staff Control Page */
.control-container {
    padding: 120px 2rem 2rem;
    max-width: 1920px;
    margin: 0 auto;
    min-height: 100vh;
}

.control-grid {
    display: grid;
    grid-template-columns: 300px 1fr 350px;
    gap: 1.5rem;
    height: calc(100vh - 140px);
}

/* Sidebar */
.sidebar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #3b82f6;
}

.menu-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.menu-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.menu-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.menu-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.menu-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.menu-btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.menu-btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.menu-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.menu-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.menu-btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.menu-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

.menu-btn-info {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.menu-btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

/* Counter Display */
.counter-display {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.status-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.status-card {
    background: linear-gradient(135deg, #f3f4f6 0%, #ffffff 100%);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.status-card.active {
    background: linear-gradient(135deg, #3b82f6 0%, #ec4899 100%);
    color: white;
}

.status-card-title {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.status-card-value {
    font-size: 2.5rem;
    font-weight: 800;
}

/* Counter Buttons */
.counter-buttons-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 1rem;
}

.counter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.counter-btn {
    padding: 2rem;
    border: none;
    border-radius: 16px;
    font-family: 'Kanit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
}

.counter-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.counter-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #ec4899 100%);
    color: white;
    border-color: white;
}

.counter-btn-a { border-color: #3b82f6; color: #3b82f6; }
.counter-btn-b { border-color: #10b981; color: #10b981; }
.counter-btn-c { border-color: #f59e0b; color: #f59e0b; }
.counter-btn-d { border-color: #ef4444; color: #ef4444; }

.counter-label {
    font-size: 3rem;
    font-weight: 800;
}

.counter-name {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: auto;
}

.action-btn {
    padding: 1.5rem;
    border: none;
    border-radius: 12px;
    font-family: 'Kanit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Queue History Panel */
.history-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #ec4899;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f3f4f6;
    border-radius: 10px;
    font-size: 0.95rem;
}

.history-item.called {
    background: linear-gradient(135deg, #dbeafe 0%, #fce7f3 100%);
    border-left: 4px solid #3b82f6;
}

.history-item.completed {
    background: #d1fae5;
    border-left: 4px solid #10b981;
}

.history-queue {
    font-weight: 700;
    color: #374151;
}

.history-counter {
    background: #3b82f6;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.history-time {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Settings Page */
.settings-container {
    padding: 120px 2rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
}

.settings-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.settings-title {
    font-size: 2rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 2rem;
    text-align: center;
}

.settings-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-label {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
}

.form-input {
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-select {
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.settings-actions {
    grid-column: span 2;
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e5e7eb;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .control-grid {
        grid-template-columns: 250px 1fr 300px;
    }
}

@media (max-width: 1024px) {
    .display-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .control-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
    }
    
    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .menu-btn {
        flex: 1;
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .header-title {
        font-size: 1.1rem;
    }
    
    .current-time {
        font-size: 1.3rem;
    }
    
    .current-queue-number {
        font-size: 3rem;
    }
    
    .counter-grid {
        grid-template-columns: 1fr;
    }
    
    .status-cards {
        grid-template-columns: 1fr;
    }
    
    .settings-form {
        grid-template-columns: 1fr;
    }
    
    .form-group.full-width,
    .settings-actions {
        grid-column: span 1;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in {
    animation: slideIn 0.5s ease forwards;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-bounce {
    animation: bounce 1s infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6 0%, #ec4899 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb 0%, #db2777 100%);
}
