/**
 * Royal Theme Custom Stylesheet
 * Responsive and Premium UI
 */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Thai:wght@300;400;600;700&family=Sarabun:wght@200;300;400;500;600;700&display=swap');

:root {
    --royal-gold-light: #FFE082;
    --royal-gold: #D4AF37;
    --royal-gold-dark: #AA7C11;
    --royal-gold-glow: rgba(212, 175, 55, 0.4);
    --royal-blue-dark: #07111e;
    --royal-blue-mid: #0a1b2d;
    --royal-blue-light: #162f4e;
    --glass-bg: rgba(10, 27, 45, 0.75);
    --glass-border: rgba(212, 175, 55, 0.3);
    --font-heading: 'Noto Serif Thai', serif;
    --font-body: 'Sarabun', sans-serif;
}

/* -------------------------------------------------------------------------
 * General Styles & Core Layout
 * ------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--royal-blue-dark) 0%, var(--royal-blue-mid) 50%, var(--royal-blue-light) 100%);
    color: #f8f9fa;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Background Particle & Glow Overlay */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.bg-glow-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.15) 0%, transparent 60%);
    z-index: 2;
    pointer-events: none;
    animation: pulseGlow 10s ease-in-out infinite alternate;
}

.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(var(--royal-gold-glow) 0.5px, transparent 0.5px);
    background-size: 24px 24px;
    opacity: 0.15;
    z-index: 2;
    pointer-events: none;
}

/* Main Container Wrappers */
.main-wrapper {
    position: relative;
    z-index: 10;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* -------------------------------------------------------------------------
 * Typography & Premium Accents
 * ------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6, .royal-title {
    font-family: var(--font-heading);
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-weight: 600;
}

.text-gold {
    background: linear-gradient(to right, var(--royal-gold-light) 0%, var(--royal-gold) 50%, var(--royal-gold-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px var(--royal-gold-glow));
}

.text-gold-solid {
    color: var(--royal-gold);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.royal-glow-text {
    animation: goldGlow 4s infinite alternate;
}

.royal-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem auto;
    width: 100%;
    max-width: 400px;
}

.royal-divider::before,
.royal-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--royal-gold), transparent);
}

.royal-divider-icon {
    color: var(--royal-gold);
    margin: 0 10px;
    font-size: 1.25rem;
    filter: drop-shadow(0 0 5px var(--royal-gold));
    /* animation: rotationGlow 12s linear infinite; */
    animation: rotationGlow 0.1s linear infinite;
}

/* -------------------------------------------------------------------------
 * Premium Cards (Glassmorphism & Gold Borders)
 * ------------------------------------------------------------------------- */
.royal-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6), 
                inset 0 0 20px rgba(212, 175, 55, 0.05);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

.royal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        to right, 
        transparent, 
        rgba(255, 224, 130, 0.1), 
        transparent
    );
    transform: skewX(-30deg);
    transition: 0.75s;
    pointer-events: none;
}

.royal-card:hover::before {
    left: 120%;
}

.royal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.8),
                0 0 25px rgba(212, 175, 55, 0.25);
    border-color: rgba(212, 175, 55, 0.5);
}

/* Card Decorative Corners */
.royal-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--royal-gold);
    pointer-events: none;
    opacity: 0.7;
}

.royal-corner-tl { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.royal-corner-tr { top: 12px; right: 12px; border-left: none; border-bottom: none; }
.royal-corner-bl { bottom: 12px; left: 12px; border-right: none; border-top: none; }
.royal-corner-br { bottom: 12px; right: 12px; border-left: none; border-top: none; }

/* -------------------------------------------------------------------------
 * Form Controls & Input Styling
 * ------------------------------------------------------------------------- */
.form-label {
    color: var(--royal-gold-light);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
    display: inline-block;
    letter-spacing: 0.5px;
}

.royal-input {
    background: rgba(10, 20, 35, 0.8);
    border: 1px solid var(--glass-border);
    color: #ffffff;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    width: 100%;
    transition: all 0.3s;
    font-size: 1rem;
}

.royal-input:focus {
    outline: none;
    border-color: var(--royal-gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.4), inset 0 0 5px rgba(0, 0, 0, 0.5);
    background: rgba(14, 28, 48, 0.9);
}

.royal-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Radio Custom Selection Card */
.blessing-option {
    background: rgba(10, 20, 35, 0.6);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    position: relative;
}

.blessing-option:hover {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.4);
}

.blessing-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--royal-gold);
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    outline: none;
    cursor: pointer;
    flex-shrink: 0;
}

.blessing-option input[type="radio"]:checked::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--royal-gold);
    box-shadow: 0 0 8px var(--royal-gold);
}

.blessing-option.active {
    background: rgba(212, 175, 55, 0.12);
    border-color: var(--royal-gold);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

.blessing-text {
    font-size: 1.05rem;
    line-height: 1.5;
    color: #e2e8f0;
}

/* -------------------------------------------------------------------------
 * Buttons (Ripple & Glow Effects)
 * ------------------------------------------------------------------------- */
.royal-btn {
    background: linear-gradient(135deg, var(--royal-gold-light) 0%, var(--royal-gold) 50%, var(--royal-gold-dark) 100%);
    color: var(--royal-blue-dark);
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 0.9rem 2.2rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.15rem;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4), 
                inset 0 1px 2px rgba(255, 255, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.royal-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 22px rgba(212, 175, 55, 0.6), 
                0 0 15px rgba(212, 175, 55, 0.3);
    color: #000000;
}

.royal-btn:active {
    transform: scale(0.98);
}

.royal-btn-secondary {
    background: transparent;
    color: #ffffff;
    border: 1px solid var(--royal-gold);
    box-shadow: none;
}

.royal-btn-secondary:hover {
    background: rgba(212, 175, 55, 0.15);
    color: var(--royal-gold-light);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

/* Audio Player Trigger Controls */
.music-toggle {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 100;
    background: rgba(10, 27, 45, 0.8);
    border: 1px solid var(--royal-gold);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--royal-gold);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.3s;
}

.music-toggle:hover {
    transform: scale(1.1);
    background: var(--royal-gold);
    color: var(--royal-blue-dark);
    box-shadow: 0 0 15px var(--royal-gold);
}

/* Top Clock Bar */
.clock-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    background: rgba(6, 17, 30, 0.8);
    position: relative;
    z-index: 100;
    color: var(--royal-gold-light);
    font-weight: 500;
}

.clock-item i {
    margin-right: 6px;
    color: var(--royal-gold);
}

/* -------------------------------------------------------------------------
 * Lists & Search Tables
 * ------------------------------------------------------------------------- */
.table-responsive {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.royal-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(6, 17, 30, 0.6);
    color: #e2e8f0;
    text-align: left;
}

.royal-table th {
    background: rgba(212, 175, 55, 0.15);
    color: var(--royal-gold-light);
    padding: 1rem;
    font-family: var(--font-heading);
    font-weight: 600;
    border-bottom: 2px solid var(--royal-gold);
    font-size: 1.05rem;
}

.royal-table td {
    padding: 1.1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.95rem;
}

.royal-table tr:hover {
    background: rgba(212, 175, 55, 0.05);
}

/* Custom Pagination styles */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    gap: 5px;
}

.pagination-btn {
    background: rgba(10, 27, 45, 0.8);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.pagination-btn:hover, .pagination-btn.active {
    background: var(--royal-gold);
    color: var(--royal-blue-dark);
    border-color: var(--royal-gold);
    font-weight: 600;
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* -------------------------------------------------------------------------
 * Transition & Welcome Ceremonial Screen Special Effects
 * ------------------------------------------------------------------------- */
.welcome-container {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    z-index: 10;
}

.king-emblem-container {
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

.king-emblem {
    max-width: 220px;
    height: auto;
    filter: drop-shadow(0 4px 20px rgba(212, 175, 55, 0.6));
    animation: softFloat 4s ease-in-out infinite alternate;
}

.king-emblem-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(212, 175, 55, 0.3) 0%, transparent 70%);
    z-index: -1;
    border-radius: 50%;
    animation: pulseEmblem 4s ease-in-out infinite alternate;
}

/* Page Transition Sweeper */
.transition-sweeper {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
                var(--royal-blue-dark) 0%, 
                var(--royal-gold-dark) 50%, 
                var(--royal-gold-light) 90%, 
                var(--royal-gold) 100%);
    z-index: 9999;
    pointer-events: none;
    box-shadow: 10px 0 50px rgba(212, 175, 55, 0.5);
}

.transition-sweeper.active {
    animation: sweepSlide 1.2s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 17, 30, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid transparent;
    border-top: 3px solid var(--royal-gold);
    border-bottom: 3px solid var(--royal-gold-light);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    position: relative;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 3px solid transparent;
    border-left: 3px solid var(--royal-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite reverse;
}

.loading-text {
    margin-top: 1.5rem;
    font-family: var(--font-heading);
    color: var(--royal-gold-light);
    font-size: 1.15rem;
    letter-spacing: 1px;
    animation: pulseText 2s ease-in-out infinite;
}

/* -------------------------------------------------------------------------
 * Keyframe Animations
 * ------------------------------------------------------------------------- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseGlow {
    0% { opacity: 0.7; }
    100% { opacity: 1.2; }
}

@keyframes goldGlow {
    0% { filter: drop-shadow(0 2px 5px rgba(212, 175, 55, 0.4)); }
    100% { filter: drop-shadow(0 2px 20px rgba(212, 175, 55, 0.85)); }
}

@keyframes rotationGlow {
    0% { transform: rotate(0deg); filter: drop-shadow(0 0 2px var(--royal-gold)); }
    50% { filter: drop-shadow(0 0 8px var(--royal-gold-light)); }
    100% { transform: rotate(360deg); filter: drop-shadow(0 0 2px var(--royal-gold)); }
}

@keyframes softFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

@keyframes pulseEmblem {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

@keyframes pulseText {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes sweepSlide {
    0% { left: -100%; }
    50% { left: 0; }
    100% { left: 100%; }
}

/* Responsive adjust */
@media (max-width: 768px) {
    .royal-card {
        padding: 1.5rem;
    }
    .royal-title {
        font-size: 1.5rem !important;
    }
    .royal-btn {
        padding: 0.8rem 1.6rem;
        font-size: 1.05rem;
    }
    .clock-bar {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}
