/**
 * Main Stylesheet for the Contest System
 * This file contains all styles for the project, organized by component.
 * Version: 2.0.0
 */

/*--------------------------------------------------------------
# 1. Variables & Global Styles
--------------------------------------------------------------*/
:root {
    /* Colors */
    --primary-color: #005054;
    --secondary-color: #ffa600;
    --danger-color: #e53935;
    /* สีแดงหลัก (danger) */
    --danger-soft: #fff0f0;
    /* พื้นหลังแดงอ่อน */
    --danger-dark: #b71c1c;
    /* แดงเข้มใช้กับ border/hover */
    --text-color: #444;
    --bg-light: #f8f9fa;
    --color-border: #e8e2d7;
    --color-text-secondary: #666666;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(17, 101, 48, 0.08);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.08);
    /* Font */
    --font-family: "Prompt", sans-serif;
}

/* Base Reset & Globals */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family, "Noto Sans Thai", sans-serif);
}

html,
body {
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-light);
}

/* Disable AOS animation delay on mobile devices */
@media screen and (max-width: 539px) {
    [data-aos-delay] {
        transition-delay: 0 !important;
    }
}

/*--------------------------------------------------------------
# 2. Navigation (Navbar, Dropdown, Sidebar)
--------------------------------------------------------------*/

/* Navbar */
.navbar-custom {
    background-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-bottom: 3px solid var(--secondary-color);
    z-index: 1050;
}

.navbar-custom .nav-link {
    color: #ffffff !important;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: var(--secondary-color) !important;
}

/* Dropdown Menu */
.dropdown-menu {
    background-color: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 0.3rem 0;
}

.dropdown-item {
    color: var(--primary-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: var(--radius-sm);
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item.active {
    background-color: var(--secondary-color) !important;
    color: #000 !important;
}

/* Sidebar (Desktop) */
.sidebar-custom {
    position: fixed;
    top: 60px;
    left: 0;
    width: 240px;
    height: 100vh;
    background-color: var(--primary-color);
    color: #fff;
    padding: 2rem 1rem;
    box-shadow: var(--shadow-md);
    border-right: 3px solid var(--secondary-color);
    overflow-y: auto;

    scrollbar-width: thin;
    z-index: 1040;
}

.main-content-fixed {
    padding-top: 40px;
    /* รองรับ navbar fixed-top */
}

@media (min-width: 992px) {
    .main-content-fixed {
        margin-left: 240px;
        margin-right: auto;
        padding-left: 2rem;
        padding-right: 1rem;
        max-width: calc(100vw - 260px);
        box-sizing: border-box;
    }
}

.sidebar-custom .nav-link {
    color: #fff !important;
    font-weight: 500;
    border-radius: 0.75rem;
    padding: 0.65rem 0.9rem;
    transition: background .15s, color .12s;
    margin-bottom: 2px;
}

.sidebar-custom .nav-link.active-custom,
.sidebar-custom .nav-link:hover:not(.disabled) {
    background: var(--secondary-color);
    color: var(--primary-color) !important;
    font-weight: bold;
}

.sidebar-custom .nav-link.disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.sidebar-custom h4 {
    color: var(--secondary-color);
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 2rem;
    margin-top: 0.2rem;
}

/* Sidebar Mobile (Offcanvas) – ปรับเมนูให้เหมือน Desktop */
.offcanvas {
    background-color: #005054;
    overflow-y: auto;
    max-height: 100vh;
}

.offcanvas-start {
    transition: transform 0.3s ease-in-out;
}

.offcanvas .nav-link {
    color: #fff !important;
    font-weight: 500;
    padding: 0.65rem 0.9rem;
    border-radius: 0.75rem;
    margin-bottom: 2px;
    transition: background 0.15s ease;

}

.offcanvas .nav-link.active-custom,
.offcanvas .nav-link:hover:not(.disabled) {
    background: var(--secondary-color);
    color: var(--primary-color) !important;
    font-weight: bold;
}

.offcanvas .nav-link.disabled {
    color: #ccc !important;
    opacity: 0.6;
    cursor: not-allowed;
}

.offcanvas .nav-link small {
    display: block;
    font-size: 0.7rem;
    color: #aaa;
}

/* Offcanvas Menu Title */
.offcanvas .offcanvas-title {
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    color: #fff !important;
}

/*--------------------------------------------------------------
# 3. Bootstrap Overrides & Components
--------------------------------------------------------------*/

/* Buttons */
.btn-success {
    background-color: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
}

.btn-success:hover {
    background-color: #01423e !important;
    border-color: #01423e !important;
    color: #fff !important;
}

.btn-outline-success {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.btn-outline-success:hover {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

.btn-primary:hover {
    background-color: #01423e !important;
    border-color: #01423e !important;
}

/* Text & Background */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Cards & Blocks */
.section-block {
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s ease;
}

.highlight-card {
    border-radius: 1.25rem;
    transition: transform .16s;
    box-shadow: 0 6px 22px 0 #00505422;
    background: rgba(255, 255, 255, 0.85) !important;
}

.highlight-card:hover {
    transform: translateY(-5px) scale(1.015);
}

/* Contest Divider */
.contest-divider {
    width: 120px;
    height: 6px;
    background: linear-gradient(90deg, #fcb900, #ffc107, #fd7e14);
    border-radius: 4px;
    margin: 1.2rem auto 2.2rem;
}

/*--------------------------------------------------------------
# 4. Page-Specific Styles
--------------------------------------------------------------*/

/* Login & OTP Box */
.bg-login {
    background: linear-gradient(120deg, #f8fafc 0%, #e3f0ff 100%);
    min-height: 100vh;
}

.login-box,
.otp-box {
    background: #fff;
    border-radius: 2rem;
    box-shadow: 0 4px 32px rgba(20, 67, 133, 0.08) !important;
    padding: 2.5rem 2rem 2rem 2rem;
    max-width: 420px;
    margin: auto;
}

.otp-input {
    font-size: 2.1rem !important;
    letter-spacing: 0.6rem;
    text-align: center;
    font-weight: bold;
    border-radius: 1.2rem !important;
    background: #f9fafb;
    border: 2px solid #d1e3df;
    color: var(--primary-color);
}

.otp-input:focus {
    background: #fffbe6;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.15rem #ffecb3;
}

/* Profile Card */
.profile-card {
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px #00505414;
    background: #fff;
    overflow: hidden;
}

.timeline-horizontal {
    position: relative;
    overflow-x: auto;
    padding: 1rem 0;
}

.timeline-line {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    height: 4px;
    background-color: #dee2e6;
    z-index: 0;
}

.timeline-step {
    position: relative;
    z-index: 1;
    min-width: 130px;
}

.timeline-step.is-done .timeline-circle {
    background-color: var(--status-color);
    color: white;
}

.timeline-step.is-active .timeline-circle {
    border: 3px solid var(--status-color);
    background-color: white;
    color: var(--status-color);

}

.timeline-step.is-future .timeline-circle {
    background-color: #e9ecef;
    color: #adb5bd;
}

.timeline-circle {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    font-size: 1.2rem;
}


/* Cookie Consent */
#cookieConsent .alert {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #ddd;
}

#cookieConsent button {
    min-width: 120px;
    font-weight: 600;
    box-shadow: 0 2px 6px 0 rgba(0, 128, 121, 0.07);
}

@media (max-width: 768px) {
    #cookieConsent .alert {
        flex-direction: column;
        text-align: center;
    }

    #cookieConsent .alert>div:last-child {
        margin-top: 1rem;
    }
}

.accordion-item {
    transition: box-shadow .2s, border-color .2s;
    box-shadow: 0 2px 12px #0001;
    border-radius: 1.1rem !important;
    margin-bottom: 1.3rem;
}

.accordion-button {
    font-size: 1.13rem;
    font-weight: bold;
    border-radius: 1.1rem !important;
    transition: background .15s, color .12s;
    box-shadow: none;
}

.accordion-button:not(.collapsed) {
    filter: brightness(0.98);
    box-shadow: 0 4px 16px #0002;
}

.accordion-body {
    padding-top: 1.25rem;
    padding-bottom: 1.2rem;
}

@media (max-width: 576px) {
    td .d-flex.flex-wrap {
        flex-wrap: nowrap !important;
        overflow-x: auto;
    }
}


