/**
 * =============================================
 * CSS Styles - ระบบแบบประเมินผลการพัฒนางานตามข้อตกลง (PA)
 * สีโรงเรียน: น้ำเงิน (#1e3a8a) - เหลือง (#fbbf24)
 * =============================================
 */

/* =============================================
   Base Styles & Color Variables
   ============================================= */
:root {
    --primary-color: #1e3a8a;
    --secondary-color: #1e40af;
    --success-color: #198754;
    --info-color: #3b82f6;
    --warning-color: #fbbf24;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #1e3a8a;
    --school-blue: #1e3a8a;
    --school-blue-light: #3b82f6;
    --school-yellow: #fbbf24;
    --school-yellow-light: #fde047;
    --font-family-th: 'Sarabun', 'Prompt', 'Noto Sans Thai', sans-serif;
}

body {
    font-family: var(--font-family-th);
    background-color: #f5f7fa;
    min-height: 100vh;
}

/* =============================================
   Global Theme Colors - น้ำเงินเหลือง
   ============================================= */
.bg-primary,
.btn-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
    border-color: #1e3a8a !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%) !important;
    border-color: #1e40af !important;
}

.btn-outline-primary {
    color: #1e3a8a !important;
    border-color: #1e3a8a !important;
}

.btn-outline-primary:hover {
    background-color: #1e3a8a !important;
    border-color: #1e3a8a !important;
    color: white !important;
}

.text-primary {
    color: #1e3a8a !important;
}

.btn-warning {
    background: linear-gradient(135deg, #fbbf24 0%, #fde047 100%) !important;
    border-color: #fbbf24 !important;
    color: #1e3a8a !important;
    font-weight: 600;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%) !important;
    border-color: #f59e0b !important;
    color: #1e3a8a !important;
}

.badge.bg-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, #fbbf24 0%, #fde047 100%) !important;
    color: #1e3a8a !important;
}

/* =============================================
   Typography
   ============================================= */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

/* =============================================
   Navbar
   ============================================= */
.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(251, 191, 36, 0.2);
    border-radius: 5px;
}

.navbar-nav .nav-link.active {
    background-color: rgba(251, 191, 36, 0.3);
    border-radius: 5px;
}

/* =============================================
   Hero Section
   ============================================= */
.hero-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 100%);
}

.hero-section h1 {
    font-size: 2.5rem;
    color: #1e3a8a;
}

/* =============================================
   Cards
   ============================================= */
.card {
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

.card-header.bg-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
}

/* Stat Cards */
.stat-card {
    border-radius: 16px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Aspect Cards */
.aspect-card .card-header {
    border-bottom: none;
}

.aspect-card .card-header h5 {
    font-size: 1.1rem;
}

/* Quick Link Cards */
.quick-link-card {
    border-radius: 16px;
    transition: all 0.3s ease;
}

.quick-link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

.quick-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.quick-link-card:hover .quick-icon {
    transform: scale(1.1);
}

/* =============================================
   Forms
   ============================================= */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.625rem 1rem;
    border: 1px solid #dee2e6;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Score Buttons */
.score-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.score-buttons .btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: 600;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-buttons .btn-check:checked + .btn {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* =============================================
   Tables
   ============================================= */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* =============================================
   Buttons
   ============================================= */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all 0.3s ease;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

/* =============================================
   Badges
   ============================================= */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
    border-radius: 6px;
}

/* =============================================
   Progress Bar
   ============================================= */
.progress {
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    font-weight: 600;
    font-size: 0.9rem;
}

/* =============================================
   Alerts
   ============================================= */
.alert {
    border-radius: 10px;
    border: none;
}

/* =============================================
   Footer
   ============================================= */
footer {
    margin-top: auto;
    background-color: #1e3a8a !important;
    background-image:
        linear-gradient(0deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) !important;
    background-size: 28px 28px !important;
    background-position: center !important;
    color: #fff;
}

footer a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    border-bottom: none !important;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #fff !important;
}

footer p,
footer span,
footer div,
footer a,
footer .text-muted {
    color: #fff !important;
}

footer p {
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.footer-blue {
    background-color: #1e3a8a;
    background-image:
        linear-gradient(0deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 28px 28px;
    background-position: center;
}

.footer-title {
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.footer-credit {
    margin-top: 12px;
    font-size: 0.9em;
    font-weight: 600;
    font-family: var(--font-family-th);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.footer-credit-label {
    margin-right: 6px;
}

.footer-credit-link {
    color: #fff;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.footer-blue a,
.footer-blue a:hover {
    color: #fff !important;
}

/* =============================================
   Animations
   ============================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Stagger animation */
.aspect-card:nth-child(1) { animation-delay: 0.1s; }
.aspect-card:nth-child(2) { animation-delay: 0.2s; }
.aspect-card:nth-child(3) { animation-delay: 0.3s; }

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
    }
    
    .quick-icon {
        width: 60px;
        height: 60px;
    }
    
    .score-buttons .btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
}

/* =============================================
   Print Styles
   ============================================= */
@media print {
    body {
        background-color: #fff !important;
    }
    
    .no-print {
        display: none !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    
    .card:hover {
        transform: none !important;
    }
    
    .table {
        font-size: 10pt;
    }
    
    .badge {
        border: 1px solid #333;
    }
    
    a {
        text-decoration: none !important;
        color: #000 !important;
    }
}

/* =============================================
   Custom Scrollbar
   ============================================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* =============================================
   Loading Spinner
   ============================================= */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================
   Tooltips
   ============================================= */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background-color: #333;
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* =============================================
   Quality Level Colors
   ============================================= */
.quality-excellent {
    color: var(--success-color);
}

.quality-good {
    color: var(--info-color);
}

.quality-fair {
    color: var(--warning-color);
}

.quality-poor {
    color: var(--danger-color);
}

/* =============================================
   Chart Container
   ============================================= */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* =============================================
   Sidebar (for future use)
   ============================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background-color: var(--dark-color);
    padding-top: 60px;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-hidden {
    transform: translateX(-100%);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
}
