/**
 * Shared base CSS for the PA system.
 * Role-specific accent colors are supplied via CSS custom properties;
 * defaults below match the blue "teacher" theme used by most pages.
 * Pages with a different role color (pa_executive.html, pa_admin.html)
 * override these in a small inline <style>:root{} block.
 */
:root {
    --kn-primary: #2563EB;
    --kn-primary-rgb: 37, 99, 235;
    --kn-secondary: #06B6D4;
    --kn-nav-rgb: 30, 58, 138;
    --kn-hover-bg: #f1f5f9;
}

body { font-family: 'Sarabun', sans-serif; background-color: #F8FAFC; overflow-x: hidden; }

.gradient-text {
    background: linear-gradient(to right, var(--kn-primary), var(--kn-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 1);
    box-shadow: 0 10px 40px -10px rgba(var(--kn-primary-rgb), 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -5px rgba(var(--kn-primary-rgb), 0.15), 0 10px 20px -5px rgba(var(--kn-primary-rgb), 0.1);
    border-color: rgba(var(--kn-primary-rgb), 0.1);
}

.glass-panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.glass-dark {
    background: rgba(var(--kn-nav-rgb), 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg) scale(1); }
    50% { transform: translateY(-20px) rotate(3deg) scale(1.05); }
    100% { transform: translateY(0px) rotate(0deg) scale(1); }
}
.animate-float { animation: float 10s ease-in-out infinite; }
.animate-float-delay { animation: float 12s ease-in-out infinite 3s; }

.swal2-popup { border-radius: 28px !important; font-family: 'Sarabun', sans-serif; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25) !important; padding: 2.5rem 2rem !important; }

.input-modern {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 16px;
    width: 100%;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #1e293b;
}
.input-modern:focus {
    outline: none;
    background-color: #ffffff;
    border-color: var(--kn-primary);
    box-shadow: 0 0 0 4px rgba(var(--kn-primary-rgb), 0.1);
}
.input-modern:disabled {
    background-color: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
    border-color: #e2e8f0;
}
textarea.input-modern { min-height: 100px; line-height: 1.6; }

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.table-row-hover:hover td { background-color: var(--kn-hover-bg); }

.suggestions-list {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #ffffff; border: 1px solid #e2e8f0;
    border-radius: 14px; z-index: 100; max-height: 250px; overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-top: 8px; padding: 6px;
}
.suggestion-item { padding: 10px 14px; cursor: pointer; border-radius: 10px; transition: 0.2s; display: flex; flex-direction: column; }
.suggestion-item:hover { background-color: #f1f5f9; }

.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/**
 * Loading-state skeleton bars. Implemented as plain CSS (not Tailwind utility
 * classes) because these pages ship a prebuilt/purged Tailwind stylesheet
 * that only contains classes already used elsewhere at build time — utility
 * classes introduced later (e.g. bg-slate-200, w-1/2, animate-pulse on some
 * pages) silently render as nothing. Size/shape per instance via inline style.
 */
@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.skeleton { display: block; background-color: #e2e8f0; border-radius: 8px; animation: skeleton-pulse 1.5s ease-in-out infinite; }
.skeleton-card { background-color: #fff; border: 1px solid #f1f5f9; border-radius: 16px; }
.skeleton-card .skeleton { animation-delay: 0s; }

/**
 * Sticky form section-nav + scroll progress bar (pa_profile.html) and modal
 * scroll progress bar (pa_report.html). Written as plain CSS rather than
 * Tailwind utility classes for the same purge-safety reason as .skeleton above.
 */
.pa-progress-nav { position: sticky; top: 76px; z-index: 30; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid rgba(226, 232, 240, 0.7); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.pa-progress-track { height: 4px; background-color: #f1f5f9; }
.pa-progress-fill { height: 100%; background: linear-gradient(to right, var(--kn-primary), var(--kn-secondary)); transition: width 0.15s ease-out; }
.pa-section-nav-list { display: flex; align-items: center; gap: 8px; overflow-x: auto; padding: 10px 0; }
.pa-nav-pill { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 12px; font-size: 13px; font-weight: 700; border: 1px solid transparent; color: #64748b; white-space: nowrap; transition: all 0.2s ease; cursor: pointer; background-color: transparent; }
.pa-nav-pill:hover { background-color: #f1f5f9; }
.pa-nav-pill.active { background-color: var(--kn-primary); color: #fff; border-color: var(--kn-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/**
 * Responsive table stacking for mobile.
 * Add class="responsive-stack" to a <table> and data-label="Column Name"
 * to every <td> (skip only purely decorative/empty cells) to turn rows
 * into labeled cards below 640px instead of relying on horizontal scroll.
 */
@media (max-width: 640px) {
    table.responsive-stack thead { display: none; }
    table.responsive-stack, table.responsive-stack tbody,
    table.responsive-stack tr, table.responsive-stack td {
        display: block; width: 100%;
    }
    table.responsive-stack { min-width: 0 !important; }
    table.responsive-stack tr {
        margin-bottom: 12px; border: 1px solid #e2e8f0; border-radius: 18px;
        padding: 14px 16px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    }
    table.responsive-stack tr:last-child { margin-bottom: 0; }
    table.responsive-stack td {
        padding: 8px 0 !important; border-bottom: 1px dashed #f1f5f9 !important;
        text-align: left !important; white-space: normal !important;
    }
    table.responsive-stack td:last-child { border-bottom: none !important; }
    table.responsive-stack td[data-label]::before {
        content: attr(data-label); display: block; font-weight: 700; font-size: 10px;
        text-transform: uppercase; letter-spacing: 0.06em; color: #94a3b8; margin-bottom: 4px;
    }
    /* Cells without data-label (e.g. full-width empty/loading/error rows) render as-is, unlabeled. */
}
