/* ========================================
   BGSR6 Website — Main Stylesheet
   M6 Motorway Project — Pre-Opening Phase
   ======================================== */

/* --- CSS Variables --- */
:root {
    --primary: #0a192f;
    --primary-light: #112240;
    --secondary: #1e90ff;
    --accent: #f5a623;
    --accent-green: #2ecc71;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --danger: #dc3545;
    --success: #28a745;
    --warning: #ffc107;
    --font-family: 'Sarabun', 'Prompt', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --container-max: 1200px;
    --transition: 0.3s ease;
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--white);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--secondary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

ul {
    list-style: none;
}

/* --- Container --- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header --- */
.site-header {
    background: var(--primary);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-top .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    padding-bottom: 12px;
}

.header-brand .logo {
    display: flex;
    flex-direction: column;
    color: var(--white);
    text-decoration: none;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.logo-sub {
    font-size: 0.75rem;
    color: var(--gray-500);
    letter-spacing: 1px;
}

/* --- Navigation --- */
.nav-list {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-list > li {
    position: relative;
}

.nav-list a {
    display: block;
    padding: 8px 14px;
    color: var(--gray-300);
    font-size: 0.9rem;
    border-radius: 4px;
    transition: background var(--transition), color var(--transition);
}

.nav-list a:hover,
.nav-list a.active {
    background: var(--primary-light);
    color: var(--white);
}

.nav-list a.active {
    border-bottom: 2px solid var(--secondary);
}

/* Dropdown */
.has-dropdown .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--primary-light);
    min-width: 220px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 100;
}

.has-dropdown:hover .dropdown {
    display: block;
}

.dropdown a {
    padding: 10px 16px;
    border-radius: 0;
    font-size: 0.85rem;
}

.dropdown a:hover {
    background: rgba(255,255,255,0.1);
}

/* Language Switch */
.lang-switch a {
    font-weight: 600;
    border: 1px solid var(--gray-600);
    padding: 6px 12px;
}

.lang-switch a:hover {
    border-color: var(--secondary);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    background: var(--white);
    transition: var(--transition);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Quick Menu */
.mobile-quick-menu {
    display: none;
    background: var(--primary-light);
    padding: 8px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-quick-menu .quick-item {
    display: inline-block;
    padding: 8px 16px;
    color: var(--gray-300);
    font-size: 0.85rem;
    white-space: nowrap;
}

.mobile-quick-menu .quick-item:hover {
    color: var(--white);
}

/* --- Hero Section --- */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #1a3a5c 100%);
    color: var(--white);
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--secondary), var(--accent));
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 16px;
    line-height: 1.3;
}

.hero p {
    font-size: 1.15rem;
    color: var(--gray-400);
    max-width: 700px;
    margin: 0 auto 30px;
}

.hero .pre-opening-badge {
    display: inline-block;
    background: rgba(245, 166, 35, 0.15);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 8px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* --- Page Header --- */
.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 50px 0 40px;
    text-align: center;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--gray-400);
    font-size: 1rem;
}

/* --- Sections --- */
.section {
    padding: 60px 0;
}

.section-alt {
    background: var(--gray-100);
}

.section-title {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 12px;
    text-align: center;
}

.section-subtitle {
    color: var(--gray-600);
    text-align: center;
    margin-bottom: 40px;
    font-size: 1.05rem;
}

/* --- Cards --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background: var(--white);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--gray-200);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.card h3 {
    font-size: 1.15rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.card p {
    color: var(--gray-600);
    font-size: 0.95rem;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background var(--transition), color var(--transition), transform var(--transition);
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--secondary);
    color: var(--white);
}

.btn-primary:hover {
    background: #1873cc;
    color: var(--white);
}

.btn-accent {
    background: var(--accent);
    color: var(--primary);
}

.btn-accent:hover {
    background: #e09515;
    color: var(--primary);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.btn-outline:hover {
    background: var(--secondary);
    color: var(--white);
}

.btn-small {
    padding: 6px 16px;
    font-size: 0.85rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-open {
    background: #d4edda;
    color: #155724;
}

.badge-closed {
    background: #f8d7da;
    color: #721c24;
}

.badge-draft {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    font-size: 0.9rem;
}

tr:hover td {
    background: var(--gray-100);
}

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-700);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.15);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    appearance: auto;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 4px;
}

/* --- Alerts / Flash Messages --- */
.alert {
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --- Pre-opening notice bar --- */
.pre-opening-bar {
    background: var(--accent);
    color: var(--primary);
    text-align: center;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* --- Coming Soon placeholder --- */
.coming-soon {
    background: var(--gray-100);
    border: 2px dashed var(--gray-400);
    border-radius: 12px;
    padding: 60px 30px;
    text-align: center;
    color: var(--gray-600);
}

.coming-soon h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: var(--gray-700);
}

.coming-soon p {
    font-size: 0.95rem;
}

/* --- Job Cards --- */
.job-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
    transition: box-shadow var(--transition);
}

.job-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.job-card .job-title {
    font-size: 1.15rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.job-card .job-title a {
    color: var(--primary);
}

.job-card .job-title a:hover {
    color: var(--secondary);
}

.job-card .job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 12px;
}

.job-card .job-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.job-card .job-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* --- Job Detail --- */
.job-detail-header {
    margin-bottom: 30px;
}

.job-detail-header h1 {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.job-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--gray-600);
}

.job-section {
    margin-bottom: 24px;
}

.job-section h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--gray-200);
}

.job-section ul {
    list-style: disc;
    padding-left: 20px;
}

.job-section li {
    margin-bottom: 4px;
}

/* --- Admin Login --- */
.admin-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    padding: 20px;
}

.admin-login-box {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.admin-login-box h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.5rem;
}

.admin-login-box p {
    text-align: center;
    color: var(--gray-600);
    margin-bottom: 24px;
}

/* --- Admin Layout --- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: var(--primary);
    color: var(--white);
    padding: 20px 0;
    flex-shrink: 0;
}

.admin-sidebar h3 {
    padding: 0 20px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.admin-sidebar a {
    display: block;
    padding: 10px 20px;
    color: var(--gray-300);
    transition: background var(--transition), color var(--transition);
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: var(--primary-light);
    color: var(--white);
}

.admin-sidebar .user-info {
    padding: 0 20px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.admin-content {
    flex: 1;
    padding: 30px;
    background: var(--gray-100);
}

.admin-header {
    margin-bottom: 24px;
}

.admin-header h1 {
    font-size: 1.5rem;
    color: var(--primary);
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* --- Filter / Search Bar --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.filter-bar .form-control {
    width: auto;
    min-width: 180px;
}

.filter-bar .btn {
    flex-shrink: 0;
}

/* --- Footer --- */
.site-footer {
    background: var(--primary);
    color: var(--gray-400);
    padding: 50px 0 20px;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h4 {
    color: var(--white);
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.footer-col p {
    font-size: 0.9rem;
    margin-bottom: 8px;
    line-height: 1.7;
}

.footer-col a {
    color: var(--gray-400);
    font-size: 0.9rem;
}

.footer-col a:hover {
    color: var(--secondary);
}

.footer-col ul li {
    margin-bottom: 6px;
}

.pre-opening-tag {
    font-size: 0.85rem;
    color: var(--accent);
    margin-top: 12px;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.site-version {
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* --- Content Area (for text pages) --- */
.content-area {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.content-area h2 {
    color: var(--primary);
    margin: 30px 0 12px;
    font-size: 1.3rem;
}

.content-area h3 {
    color: var(--gray-700);
    margin: 24px 0 8px;
    font-size: 1.1rem;
}

.content-area p {
    margin-bottom: 12px;
}

.content-area ul {
    list-style: disc;
    padding-left: 24px;
    margin-bottom: 16px;
}

.content-area li {
    margin-bottom: 6px;
}

/* --- Contact Form --- */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.checkbox-group {
    margin-top: 16px;
}

.checkbox-group label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400;
    font-size: 0.9rem;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 4px;
}

/* --- FAQ --- */
.faq-item {
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 0;
}

.faq-question {
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question::after {
    content: '+';
    font-size: 1.3rem;
    color: var(--secondary);
}

.faq-item.open .faq-question::after {
    content: '−';
}

.faq-answer {
    display: none;
    padding-top: 12px;
    color: var(--gray-600);
    line-height: 1.7;
}

.faq-item.open .faq-answer {
    display: block;
}

/* --- Page-specific: Map Section --- */
.map-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.map-placeholder {
    background: var(--gray-200);
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    color: var(--gray-600);
}

.toll-plaza-list {
    display: grid;
    gap: 12px;
}

.toll-plaza-item {
    background: var(--gray-100);
    padding: 16px;
    border-radius: 6px;
    border-left: 4px solid var(--secondary);
}

.toll-plaza-item h4 {
    color: var(--primary);
    margin-bottom: 4px;
}

/* --- Page-specific: Readiness --- */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gray-300);
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--secondary);
    border: 3px solid var(--white);
}

.timeline-item.completed::before {
    background: var(--success);
}

.timeline-item.in-progress::before {
    background: var(--accent);
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0% { box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(245, 166, 35, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 166, 35, 0); }
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
    .map-section {
        grid-template-columns: 1fr;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .nav-list {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary);
        padding: 12px 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }

    .nav-list.show {
        display: flex;
    }

    .nav-list a {
        padding: 12px 20px;
    }

    .has-dropdown .dropdown {
        position: static;
        display: none;
        box-shadow: none;
        background: rgba(0,0,0,0.2);
    }

    .has-dropdown.open .dropdown {
        display: block;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-quick-menu {
        display: flex;
    }

    .hero {
        padding: 50px 0 40px;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .page-header {
        padding: 35px 0 30px;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .section {
        padding: 40px 0;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
    }

    .admin-content {
        padding: 20px;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar .form-control {
        width: 100%;
        min-width: unset;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .job-card .job-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 1.3rem;
    }

    .admin-login-box {
        padding: 24px;
    }
}

/* --- Print Styles --- */
@media print {
    .site-header,
    .site-footer,
    .mobile-quick-menu,
    .btn {
        display: none;
    }
}
