/* ตั้งค่าตัวแปรสี และขนาดต่างๆ */
:root {
    --primary: #537188;
    --primary-dark: #3d5266;
    --secondary: #CBB279;
    --secondary-dark: #a89357;
    --light: #EEEEEE;
    --light-alt: #E1D4BB;
    --dark: #333333;
    --success: #4BB543;
    --warning: #FFC107;
    --danger: #FF5252;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 15px 25px rgba(0, 0, 0, 0.05), 0 5px 10px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

/* รีเซ็ตค่า CSS พื้นฐาน */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* สไตล์พื้นฐานของหน้าเว็บ */
body {
    font-family: 'Prompt', sans-serif;
    background: linear-gradient(150deg, var(--primary) 15%, var(--primary-dark) 100%);
    color: var(--light);
    padding: 0;
    text-align: center;
    animation: fadeIn 1s ease-in-out;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* พื้นหลังลายจุด */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,%3Csvg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z" fill="rgba(255,255,255,0.03)" fill-rule="evenodd"/%3E%3C/svg%3E');
    pointer-events: none;
    z-index: -1;
}

/* คอนเทนเนอร์หลัก */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* ส่วนหัวของเว็บไซต์ */
.header {
    margin-bottom: 30px;
    padding: 20px 0;
    position: relative;
    animation: fadeIn 1.2s ease-in-out;
}

.header::after {
    content: '';
    display: block;
    width: 120px;
    height: 4px;
    background: var(--secondary);
    margin: 15px auto 0;
    border-radius: 2px;
}

h1 {
    color: var(--light);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-weight: 700;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

h2 {
    color: var(--light-alt);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 400;
    font-size: 1.5rem;
}

/* สไตล์สำหรับแสดงวันที่ */
.current-date {
    color: var(--light-alt);
    font-size: 1.2rem;
    margin-top: 10px;
    font-weight: 400;
    display: inline-block;
    background: rgba(0, 0, 0, 0.1);
    padding: 5px 15px;
    border-radius: 30px;
    animation: fadeIn 1.5s ease-in-out;
}

/* แผงควบคุม */
.control-panel {
    background: var(--light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
    position: relative;
    animation: slideUp 0.8s ease-in-out forwards;
    transition: var(--transition);
}

.control-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
}

.control-header {
    background: var(--primary);
    padding: 15px 20px;
    color: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 500;
}

.control-body {
    padding: 25px;
}

/* นาฬิกาแสดงเวลาปัจจุบัน */
.current-time {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
    display: inline-block;
}

.current-time::after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background: var(--secondary);
    margin: 5px auto 0;
    border-radius: 2px;
    transform: scaleX(0);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scaleX(0.5); opacity: 0.5; }
    50% { transform: scaleX(1); opacity: 1; }
    100% { transform: scaleX(0.5); opacity: 0.5; }
}

/* ส่วนเปิด/ปิดระบบอัตโนมัติ */
.auto-play {
    margin: 25px 0;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 10px 20px;
    background: var(--primary-dark);
    border-radius: var(--radius-sm);
    color: var(--light);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle-switch:hover {
    background: var(--primary);
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 50px;
    height: 26px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 13px;
    position: relative;
    transition: var(--transition);
    margin-right: 12px;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    background-color: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    font-size: 1rem;
    font-weight: 500;
}

/* แท็บเลือกวัน */
.day-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.day-tab {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    background-color: var(--light-alt);
    color: var(--primary-dark);
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.day-tab:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.day-tab::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: var(--secondary);
    transform: scaleX(0);
    transition: var(--transition);
}

.day-tab:hover::before {
    transform: scaleX(0.7);
}

.day-tab.active {
    background: var(--primary);
    color: var(--light);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.day-tab.active::before {
    transform: scaleX(1);
    background: var(--secondary);
}

.day-tab i {
    font-size: 1.2rem;
}

/* ส่วนแสดงข้อความประกาศ */
.message-display {
    background: linear-gradient(120deg, var(--secondary), var(--secondary-dark));
    color: var(--light);
    padding: 18px 25px;
    border-radius: var(--radius-md);
    margin: 25px 0;
    font-size: 1.2rem;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.5s, transform 0.3s;
    box-shadow: var(--shadow-md);
    text-align: left;
    position: relative;
    overflow: hidden;
    padding-left: 60px;
}

.message-display::before {
    content: '\f0a1';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.8rem;
    opacity: 0.9;
}

.message-display.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* กล่องตารางเสียงออด */
.bell-schedule-container {
    background: var(--light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 1s 0.3s ease-in-out forwards;
    position: relative;
}

.bell-schedule-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    z-index: 1;
}

.schedule-header {
    background: var(--primary);
    padding: 15px 20px;
    color: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 500;
}

/* ตารางเสียงออด */
.bell-schedule {
    width: 100%;
    border-collapse: collapse;
    background: var(--light);
}

.bell-schedule th,
.bell-schedule td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--dark);
}

.bell-schedule th {
    background: var(--primary);
    color: var(--light);
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 15px;
}

.bell-schedule tr:last-child td {
    border-bottom: none;
}

.bell-schedule tr:hover td {
    background: rgba(203, 178, 121, 0.1);
}

.bell-schedule td:first-child {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.time-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.time-indicator {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 30px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

/* ปุ่มเล่นเสียง */
.play-button {
    background: var(--secondary);
    color: var(--light);
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 8px;
}

.play-button:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.play-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.sound-button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: var(--primary);
    transition: transform 0.2s ease-in-out;
    padding: 6px;
}

.sound-button:hover {
    transform: scale(1.1);
    color: var(--secondary);
}

/* ส่วนท้ายเว็บไซต์ */
.footer {
    margin-top: auto;
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* สถานะแถวในตาราง */
.now-playing {
    background: rgba(76, 175, 80, 0.1);
    border-left: 4px solid var(--success);
}

.upcoming {
    position: relative;
}

.upcoming::after {
    content: 'กำลังจะเริ่ม';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--warning);
    color: var(--dark);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 30px;
    font-weight: 500;
    animation: blink 1.5s infinite alternate;
}

/* ตัวแสดงสถานะระบบอัตโนมัติ */
.status-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: var(--light);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
    font-weight: 500;
    transition: var(--transition);
    transform: translateY(100px);
}

.status-indicator.active {
    transform: translateY(0);
}

.status-indicator.auto-on {
    background: var(--success);
}

.status-indicator i {
    font-size: 1.2rem;
}

/* สไตล์สำหรับปุ่มแอดมิน */
.admin-link {
    text-align: center;
    margin-bottom: 30px;
}

.admin-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    background: var(--primary-dark);
    color: var(--light);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.admin-button:hover {
    background: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* อนิเมชั่น */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* สำหรับการแสดงผลเมื่อกำลังโหลดข้อมูล */
.loading {
    text-align: center;
    padding: 40px 0;
    color: var(--primary);
}

.spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(83, 113, 136, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* สำหรับแสดงข้อความเมื่อไม่มีข้อมูล */
.no-data {
    text-align: center;
    padding: 30px;
    color: var(--primary-dark);
    font-size: 1.1rem;
}

.no-data i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* รองรับการแสดงผลบนมือถือ */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }
    h2 {
        font-size: 1.2rem;
    }
    .current-time {
        font-size: 2.5rem;
    }
    .current-date {
        font-size: 1rem;
        margin-top: 5px;
    }
    .day-tab {
        width: 100%;
        max-width: none;
    }
    .control-body, .bell-schedule th, .bell-schedule td {
        padding: 12px 10px;
    }
    .message-display {
        padding: 15px 15px 15px 50px;
        font-size: 1rem;
    }
    .message-display::before {
        left: 15px;
        font-size: 1.5rem;
    }
    .admin-button {
        width: 100%;
        justify-content: center;
    }
}

/* เพิ่มเติมสไตล์สำหรับฟอร์มลงทะเบียนและล็อกอิน */

/* กลุ่มปุ่ม */
.btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

@media (max-width: 576px) {
    .btn-group {
        flex-direction: column;
    }
}

/* ปุ่มรอง */
.btn-secondary {
    background-color: var(--gray-400);
    color: var(--dark);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    font-family: 'Prompt', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    background-color: var(--gray-500);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* สไตล์ alert */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    position: relative;
    padding-left: 3rem;
    text-align: left;
    color: var(--dark);
}

.alert i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

/* สไตล์สำหรับฟอร์ม */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-family: 'Prompt', sans-serif;
    transition: var(--transition);
    color: var(--dark);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(83, 113, 136, 0.2);
    outline: none;
}

/* ข้อความช่วยเหลือสำหรับฟอร์ม */
.form-help {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.3rem;
    display: block;
}

/* ส่วนท้ายของฟอร์ม */
.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--dark);
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.form-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.form-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* สไตล์สำหรับการเลือกจดจำฉัน */
.remember-me {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    user-select: none;
    color: var(--dark);
}

.remember-me input {
    margin-right: 8px;
}

/* สไตล์สำหรับช่องกรอกข้อมูลกับไอคอน */
.form-group-icon {
    position: relative;
}

.form-group-icon i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    opacity: 0.7;
}

.form-group-icon .form-control {
    padding-left: 2.5rem;
}

/* การแสดงผลสำหรับอุปกรณ์ที่มีขนาดหน้าจอเล็ก */
@media (max-width: 576px) {
    .control-body {
        padding: 15px;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 0.7rem 1rem;
    }
}

/* เพิ่ม class สำหรับแจ้งเตือนล่วงหน้า */
.status-indicator.warning {
    background: var(--warning);
    color: var(--dark);
    animation: blink 1s infinite alternate;
}

/* เพิ่ม animation กระพริบเตือน */
@keyframes blink {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

/* ปรับปรุง message-display เมื่อแสดงการแจ้งเตือนล่วงหน้า */
.message-display.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    z-index: 99;
}

/* เพิ่ม icon กระพริบเตือนที่แถวใน 1 นาที */
.upcoming::after {
    content: 'กำลังจะเริ่ม';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--warning);
    color: var(--dark);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 30px;
    font-weight: 500;
    animation: blink 1.5s infinite alternate;
}