/* Material Design Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', 'Roboto', sans-serif;
    background: #fafafa;
    color: #212121;
    line-height: 1.6;
}

/* App Bar (Material Design) */
.app-bar {
    background: #1976d2;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-bar-icon {
    font-size: 28px;
}

.app-bar-title {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.15px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Page Header */
.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 34px;
    font-weight: 400;
    margin-bottom: 8px;
    color: #212121;
}

.page-subtitle {
    font-size: 16px;
    color: #757575;
}

/* Info Card (Material) */
.info-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    display: flex;
    align-items: start;
    gap: 16px;
}

.info-card-icon {
    color: #1976d2;
    font-size: 24px;
}

.info-card-content {
    flex: 1;
}

.info-card-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #212121;
}

.info-card-text {
    font-size: 14px;
    color: #757575;
    line-height: 1.5;
}

/* Section Header */
.section-header {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 12px;
    color: #212121;
}

/* Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 22px;
}

/* Material Card */
.material-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    cursor: pointer;
    position: relative;
}

.material-card:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    transform: translateY(-4px);
}

.material-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.material-card.disabled:hover {
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    transform: none;
}

/* Card Header with Color */
.card-header {
    padding: 24px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card-header.blue {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
}

.card-header.teal {
    background: linear-gradient(135deg, #00897b 0%, #00796b 100%);
}

.card-header.purple {
    background: linear-gradient(135deg, #7b1fa2 0%, #6a1b9a 100%);
}

.card-icon {
    font-size: 56px;
    color: white;
    margin-bottom: 12px;
}

.card-level {
    font-size: 18px;
    font-weight: 500;
    color: white;
    margin-bottom: 4px;
}

.card-desc {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
}

/* Card Body */
.card-body {
    padding: 20px;
}

/* Status Chip (Material) */
.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    gap: 6px;
}

.status-chip.open {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-chip.upcoming {
    background: #fff3e0;
    color: #e65100;
}

.status-chip.closed {
    background: #f5f5f5;
    color: #757575;
}

.status-chip .material-icons {
    font-size: 18px;
}

/* Ripple Effect */
.material-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.material-card:active::before {
    width: 300px;
    height: 300px;
}

/* FAB (Floating Action Button) - Material */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1976d2;
    color: white;
    border: none;
    box-shadow: 0 3px 5px rgba(0,0,0,0.2), 0 1px 18px rgba(0,0,0,0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.fab:hover {
    box-shadow: 0 5px 11px rgba(0,0,0,0.2), 0 4px 15px rgba(0,0,0,0.14);
    transform: scale(1.1);
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: #757575;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 12px;          /* เรียงเป็นคอลัมน์เดียวแล้ว 24px ห่างเกินไปบนจอมือถือ */
        margin-bottom: 16px;
    }
    
    .page-title {
        font-size: 28px;
    }
}

/* SweetAlert Material */
.swal2-popup {
    font-family: 'Sarabun', sans-serif;
    border-radius: 8px;
}

.swal2-title {
    font-size: 20px;
    font-weight: 500;
}

.swal2-confirm {
    background: #1976d2 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.swal2-cancel {
    background: #757575 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}


/* ========================================
   Form Styles
======================================== */

/* Form Section */
.form-section {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 500;
    color: #1976d2;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
}

.form-section-title .material-icons {
    font-size: 24px;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Form Label */
.form-label {
    font-size: 14px;
    font-weight: 500;
    color: #424242;
    margin-bottom: 8px;
}

.form-label.required::after {
    content: ' *';
    color: #f44336;
}

/* Form Input */
.form-input {
    padding: 12px;
    font-size: 14px;
    font-family: 'Sarabun', sans-serif;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: all 0.3s;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.form-input::placeholder {
    color: #9e9e9e;
}

.form-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Form Hint */
.form-hint {
    font-size: 12px;
    color: #757575;
    margin-top: 4px;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked {
    accent-color: #1976d2;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
    accent-color: #1976d2;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 32px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Sarabun', sans-serif;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn .material-icons {
    font-size: 20px;
}

.btn-primary {
    background: #1976d2;
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #757575;
    color: white;
}

.btn-secondary:hover {
    background: #616161;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* File Input */
input[type="file"].form-input {
    padding: 8px;
}

/* Select */
select.form-input {
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 12px;
    }
}

/* ========================================
   App Bar Logo Styles
======================================== */

/* Logo Container */
.app-bar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-right: -8px;
}

/* School Logo - ล้น App Bar */
.school-logo {
    height: 64px;                    /* ใหญ่กว่า App Bar */
    width: auto;
    object-fit: contain;
    transition: transform 0.3s;
    position: relative;
    z-index: 101;                    /* อยู่เหนือ App Bar */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));  /* เงา */
}

/* Logo Hover Effect */
.app-bar-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.app-bar-link:hover .app-bar {
    opacity: 0.95;
    cursor: pointer;
}

.app-bar-link:hover .school-logo {
    transform: scale(1.08);
}

/* App Bar ต้องมี overflow visible */
.app-bar {
    background: #1976d2;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;

    /* ✨ ปรับเงาใหม่ */
    box-shadow:
        0 2px 4px rgba(0,0,0,0.14),
        0 3px 6px rgba(0,0,0,0.20);

    overflow: visible !important;
}


.app-bar-content {
    overflow: visible !important;
}

/* Responsive Logo */
@media (max-width: 768px) {
    .school-logo {
        height: 56px;               /* Tablet */
    }
}

@media (max-width: 480px) {
    .school-logo {
        height: 48px;               /* Mobile */
    }
    
    .app-bar-title {
        font-size: 16px;
    }
}

/* ========================================
   Card Header Colors - เพิ่มสีใหม่
======================================== */

/* Pink - สำหรับอนุบาล */
.card-header.pink {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

/* Orange - สีส้ม */
.card-header.orange {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* Green - สีเขียว */
.card-header.green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Indigo - สีน้ำเงินเข้ม */
.card-header.indigo {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

/* Red - สีแดง */
.card-header.red {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Cyan - สีฟ้าอมเขียว */
.card-header.cyan {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

/* Amber - สีเหลืองทอง */
.card-header.amber {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Emerald - สีเขียวมรกต */
.card-header.emerald {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}