/*
 * style.css
 * Theme CSS สำหรับระบบทดสอบการอ่านและเขียน
 * (ปรับเป็นโทนเขียว 70% - เหลือง 30%)
 */

/* ---------------------------------- */
/* 1. Global & Typography
/* ---------------------------------- */

body {
    font-family: 'Sarabun', sans-serif;
    background-color: #f8f9fa; /* สีพื้นหลังเทาอ่อน */
    color: #343a40;
    line-height: 1.6;
}

a {
    color: #28a745; /* สีเขียวหลักสำหรับลิงก์ */
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: #1e7e34; /* เขียวเข้มขึ้นเมื่อ hover */
    text-decoration: none;
}

/* ---------------------------------- */
/* 2. Section Helpers
/* ---------------------------------- */

.section-title {
    font-weight: 700;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    font-size: 1.15rem;
    color: #6c757d;
}

/* ---------------------------------- */
/* 3. Navbar (จาก nav_public.php)
/* ---------------------------------- */

.navbar-custom {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: background 0.3s ease;
}

.navbar-custom .navbar-brand {
    font-weight: 600;
    color: #343a40;
}

.navbar-custom .nav-link {
    font-weight: 500;
}

/* ---------------------------------- */
/* 4. Hero Section
/* ---------------------------------- */

.hero-section {
    /* Gradient เขียว 70% - เหลือง 30% */
    background: linear-gradient(135deg, #28a745 70%, #ffc107 100%); 
    color: white;
    padding: 6rem 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-content {
    animation: fadeInUp 0.8s ease;
}

.hero-title {
    font-size: 3.2rem;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.4rem;
    font-weight: 300;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.hero-buttons .btn-hero {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
}

.btn-hero-primary {
    background-color: white;
    color: #28a745; /* สีเขียวหลัก */
}

.btn-hero-primary:hover {
    background-color: #f0f0f0;
    color: #1e7e34; /* เขียวเข้มขึ้น */
    transform: translateY(-2px);
}

.btn-hero-secondary {
    background-color: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.btn-hero-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
}

/* ---------------------------------- */
/* 5. Statistics Section (Stats Card)
/* ---------------------------------- */

.stats-section {
    padding: 5rem 0;
    background-color: #f8f9fa; /* สีเทาอ่อน */
}

.stats-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.stats-icon {
    font-size: 3rem;
    color: #28a745; /* สีเขียวหลัก */
    margin-bottom: 1.5rem;
}

.stats-number {
    font-size: 2.8rem;
    font-weight: 700;
    color: #212529;
    line-height: 1.2;
}

.stats-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.stats-desc {
    font-size: 0.9rem;
    color: #6c757d;
}

/* ---------------------------------- */
/* 6. Competitions Section (Comp. Card)
/* ---------------------------------- */

.competitions-section {
    padding: 5rem 0;
    background-color: #ffffff; /* สีขาว */
}

.competition-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.competition-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.07);
}

.competition-title {
    font-weight: 600;
    font-size: 1.2rem;
    color: #343a40;
}

.competition-desc {
    font-size: 0.95rem;
    color: #6c757d;
    margin-bottom: 1rem;
    flex-grow: 1; /* ดัน Footer ลงล่าง */
}

.badge-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4em 0.8em;
    border-radius: 50px;
    color: white;
}

/* Badge สำหรับ "อ่านรู้เรื่อง" */
.competition-section .col-lg-6 .competition-card .badge-status {
    background-color: #28a745 !important; /* เขียว */
}

/* Badge สำหรับ "อ่านออกเสียง" */
.competitions-section .col-md-6 .competition-card .badge-status {
    background-color: #ffc107 !important; /* เหลือง */
    color: #333 !important; /* สีตัวอักษรดำสำหรับพื้นหลังเหลือง */
}

/* Badge สำหรับ "การเขียน" ใน Top Teachers Section */
#top-teachers .competition-card .badge-status {
    background-color: #17a2b8 !important; /* ใช้สีฟ้าเทอร์ควอยซ์สำหรับเขียน หรือจะปรับเป็นเหลืองเข้มก็ได้ */
    color: white !important;
}


.competition-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    border-top: 1px solid #f1f1f1;
    padding-top: 1rem;
}

.info-item {
    font-size: 0.9rem;
}

.info-label {
    color: #6c757d;
}

.info-value {
    font-weight: 600;
    color: #343a40;
}

.competition-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f1f1;
    padding-top: 1rem;
    margin-bottom: 1rem;
}

.date-info {
    font-size: 0.9rem;
}

.countdown-badge {
    background-color: #fff0f0;
    color: #dc3545;
    padding: 0.4em 0.8em;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8rem;
}

.competition-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: #f8f9fa;
    border-radius: 12px;
    color: #6c757d;
    border: 1px dashed #ced4da;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #adb5bd;
}

/* ---------------------------------- */
/* 7. Buttons (สำคัญ)
/* ---------------------------------- */

/* ปุ่ม Gradient หลัก */
.btn-gradient {
    /* Gradient เขียว 70% - เหลือง 30% */
    background: linear-gradient(135deg, #28a745 70%, #ffc107 100%);
    color: white;
    border: 0;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.2); /* เงาสีเขียว */
}

.btn-gradient:hover {
    color: white;
    opacity: 0.9;
    box-shadow: 0 6px 15px rgba(40, 167, 69, 0.3); /* เงาสีเขียวเข้มขึ้น */
    transform: translateY(-2px);
}

/* ปุ่ม Outline */
.btn-outline-custom {
    border-color: #ced4da;
    color: #495057;
    font-weight: 500;
}

.btn-outline-custom:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}

/* ขนาดปุ่ม (จาก Theme) */
.btn-sm-custom {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}


/* ---------------------------------- */
/* 8. Login Banner
/* ---------------------------------- */

.login-banner {
    /* Gradient เขียว 70% - เหลือง 30% (เข้ม) */
    background: linear-gradient(135deg, #218838 70%, #e0a800 100%);
    color: white;
    padding: 3rem;
    border-radius: 16px;
    margin: 2rem 0; /* เว้นระยะจาก section บนล่าง */
    box-shadow: 0 10px 30px rgba(33, 136, 56, 0.2); /* เงาสีเขียวเข้ม */
}

.login-banner-content {
    animation: fadeInUp 0.8s ease;
}

.banner-title {
    font-weight: 700;
    font-size: 1.8rem;
}

.banner-text {
    font-weight: 300;
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

.banner-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-banner {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.btn-banner-primary {
    background-color: white;
    color: #218838; /* สีเขียวเข้ม */
}

.btn-banner-primary:hover {
    background-color: #f0f0f0;
    color: #1e7e34; /* เขียวเข้มขึ้น */
    transform: translateY(-2px);
}

.btn-banner-secondary {
    background-color: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.btn-banner-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
}

/* ---------------------------------- */
/* 9. Top Schools (School Rank)
/* ---------------------------------- */

.school-rank {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.school-rank:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.07);
}

.rank-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #28a745; /* สีเขียวหลัก */
    min-width: 40px;
    text-align: center;
    margin-right: 1.25rem;
}

.school-info h6 {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.school-type {
    font-size: 0.9rem;
    color: #6c757d;
}

.school-stats {
    font-size: 0.9rem;
    font-weight: 600;
    color: #28a745; /* สีเขียวหลัก */
    margin-top: 0.25rem;
}

/* ---------------------------------- */
/* 10. Footer
/* ---------------------------------- */

footer {
    background-color: #343a40;
    color: #adb5bd;
    padding: 3rem 0;
    margin-top: 3rem;
}

.footer-title {
    color: #ffffff;
    font-weight: 600;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.footer-text {
    font-size: 0.95rem;
    margin-bottom: 0;
}

.footer-copyright {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.footer-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ---------------------------------- */
/* 11. Floating Login Button
/* ---------------------------------- */

.floating-login {
    position: fixed;
    bottom: 20px;
    right: 20px;
    /* Gradient เขียว 70% - เหลือง 30% */
    background: linear-gradient(135deg, #28a745 70%, #ffc107 100%);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3); /* เงาสีเขียว */
    font-weight: 600;
    z-index: 100;
    transition: all 0.3s ease;
}

.floating-login:hover {
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.4); /* เงาสีเขียวเข้มขึ้น */
}

/* ---------------------------------- */
/* 12. Keyframes (from JS)
/* ---------------------------------- */

/* สำหรับ Animation การ์ดเลื่อนขึ้น */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* สำหรับ Ripple Effect บนปุ่ม */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}