/* style.css - Premium Municipal Waste Portal Custom Styling */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0c2b5c; /* Deep Royal Navy Blue */
    --primary-light: #1e4585;
    --primary-dark: #071c3e;
    --success-color: #1b5e20; /* Darker Eco Green */
    --success-light: #2e7d32;
    --accent-color: #a67c33; /* Royal Gold/Bronze */
    --accent-light: #d4af37; /* Bright Gold */
    --light-bg: #f4f6f9;
    --card-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.05), 0 2px 6px -2px rgba(0, 0, 0, 0.03);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(226, 232, 240, 0.8);
    --text-main: #1e293b;
    --text-muted: #475569;
    --font-heading: 'Sarabun', sans-serif; /* Highly Formal Thai Gov Font */
    --font-body: 'Sarabun', sans-serif;
    --border-radius: 8px; /* More formal, less bubbly */
    --transition-speed: 0.25s;
}

html {
    height: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--light-bg);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ให้ main content ขยายเต็มพื้นที่ ดัน footer ลงล่างสุด */
main, .main-content {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
}

/* Font Size Zoom classes */
html.small-font {
    font-size: 14px;
}
html.large-font {
    font-size: 18px;
}
html.large-font h1, html.large-font h2, html.large-font h3, html.large-font h4, html.large-font h5, html.large-font h6 {
    font-size: 120% !important;
}

/* High Contrast mode classes */
html.high-contrast body {
    background-color: #000000 !important;
    background-image: none !important;
    color: #ffffff !important;
}
html.high-contrast .gov-top-bar {
    background-color: #000000 !important;
    border-bottom: 2px solid #ffffff !important;
}
html.high-contrast :not(.btn-contrast, .btn-contrast *, .gov-top-bar, .gov-top-bar *, .btn-zoom, .btn-zoom *) {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}
html.high-contrast a, html.high-contrast .nav-link {
    color: #00ff00 !important;
}
html.high-contrast .btn-primary-premium, html.high-contrast .btn-success-premium, html.high-contrast .btn-premium {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
}

/* --- Thai Government Top Bar Accent --- */
.gov-top-bar {
    background-color: #0b1a30;
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 0.8rem;
    border-bottom: 2px solid var(--accent-color);
}

.gov-flag-label {
    display: flex;
    align-items: center;
}

.flag-stripe-container {
    display: inline-flex;
    height: 11px;
    width: 20px;
    margin-right: 8px;
    border-radius: 1px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.flag-stripe {
    flex: 1;
}

.flag-stripe.red-stripe { background-color: #D80027; }
.flag-stripe.white-stripe { background-color: #FFFFFF; }
.flag-stripe.blue-stripe { background-color: #002B7F; flex: 2; }

.btn-zoom {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 2px;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 4px;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    font-weight: bold;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.btn-zoom:hover, .btn-zoom.active {
    background-color: var(--accent-color) !important;
    color: #ffffff !important;
    border-color: var(--accent-color) !important;
}

.btn-contrast {
    cursor: pointer;
    color: #ffffff;
    font-size: 0.8rem;
}

.btn-contrast:hover {
    color: var(--accent-light);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--primary-dark);
}

/* --- Header & Navigation --- */
.municipal-header {
    background: #ffffff;
    border-bottom: 2px solid #e2e8f0;
    padding: 15px 0;
}

.logo-section img {
    height: 60px;
    object-fit: contain;
}

.dept-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.2;
}

.muni-title {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

/* Custom Navbar Links */
.navbar-custom {
    background-color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    padding: 0.8rem 1rem;
}

.navbar-custom .nav-link {
    color: var(--text-main);
    font-family: var(--font-heading);
    font-weight: 400;
    padding: 0.5rem 1.2rem !important;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
    margin: 0 3px;
}

.navbar-custom .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(30, 58, 138, 0.05);
}

.navbar-custom .nav-link.active {
    color: #ffffff !important;
    background-color: var(--primary-color);
}

.navbar-custom .dropdown-menu {
    border-radius: 12px;
    padding: 0.5rem;
}

.navbar-custom .dropdown-item {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.navbar-custom .dropdown-item:hover {
    background-color: rgba(30, 58, 138, 0.05);
    color: var(--primary-color);
}

.navbar-custom .dropdown-item.active {
    background-color: var(--primary-color) !important;
    color: #ffffff !important;
}

/* --- Main Layout Sections --- */
.section-tab {
    display: none;
}

.section-tab.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Card Styles & Layout (Home Screen) --- */
.feature-card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    height: 100%;
    cursor: pointer;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -10px rgba(30, 58, 138, 0.12);
}

.feature-card .card-img-wrapper {
    position: relative;
    height: 220px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.feature-card .card-img-wrapper svg,
.feature-card .card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.feature-card:hover .card-img-wrapper svg,
.feature-card:hover .card-img-wrapper img {
    transform: scale(1.05);
}

.feature-card .card-body {
    padding: 1.5rem;
    text-align: center;
}

.feature-card .card-title {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 0;
}

/* Hero Section */
.hero-banner {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: var(--border-radius);
    color: #ffffff;
    padding: 3rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-banner::after {
    content: '';
    position: absolute;
    right: -10%;
    bottom: -30%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.hero-banner h1 {
    font-weight: 700;
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: #ffffff !important;
}

.hero-banner p {
    font-weight: 300;
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 700px;
    color: #ffffff !important;
}

/* --- Stats Badges --- */
.stat-box {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    border-left: 5px solid var(--primary-color);
    transition: transform var(--transition-speed) ease;
}

.stat-box:hover {
    transform: scale(1.02);
}

.stat-box.success {
    border-left-color: var(--success-color);
}

.stat-box.warning {
    border-left-color: var(--accent-color);
}

.stat-icon {
    font-size: 2.5rem;
    margin-right: 1.2rem;
    color: var(--primary-color);
    opacity: 0.8;
}

.stat-box.success .stat-icon {
    color: var(--success-color);
}

.stat-box.warning .stat-icon {
    color: var(--accent-color);
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

/* --- Forms & Inputs --- */
.card-premium {
    background: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 2rem;
}

.form-label-premium {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid #cbd5e1;
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(12, 43, 92, 0.12);
}

.btn-premium {
    font-family: var(--font-heading);
    font-weight: 500;
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
}

.btn-primary-premium {
    background-color: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: #ffffff;
}

.btn-primary-premium:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(12, 43, 92, 0.15);
}

.btn-success-premium {
    background-color: var(--success-color);
    border: 1px solid var(--success-color);
    color: #ffffff;
}

.btn-success-premium:hover {
    background-color: var(--success-light);
    border-color: var(--success-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.15);
}

/* --- Tables --- */
.table-premium {
    background: #ffffff;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid #cbd5e1;
    box-shadow: var(--card-shadow);
}

.table-premium th {
    background-color: var(--primary-color);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 600;
    border-bottom: 2px solid var(--accent-color);
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

.table-premium td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

.table-premium tr:last-child td {
    border-bottom: none;
}

/* --- Badges --- */
.badge-eco {
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.8rem;
}

/* --- Footer --- */
.muni-footer {
    background-color: var(--primary-dark);
    color: rgba(255, 255, 255, 0.8);
    padding: 3rem 0;
    font-size: 0.9rem;
    margin-top: 5rem;
}

.muni-footer h5 {
    color: #ffffff;
    margin-bottom: 1.2rem;
    font-weight: 600;
}

.muni-footer hr {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Modal/Receipt Print Design --- */
.receipt-container {
    padding: 20px;
    font-family: var(--font-body);
}

.receipt-header {
    text-align: center;
    border-bottom: 2px dashed #cbd5e1;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.receipt-logo {
    height: 50px;
    margin-bottom: 10px;
}

.receipt-title {
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.receipt-body table {
    width: 100%;
    margin-top: 15px;
    margin-bottom: 15px;
}

.receipt-body th {
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    padding: 5px 0;
}

.receipt-body td {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.receipt-footer {
    text-align: center;
    border-top: 2px dashed #cbd5e1;
    padding-top: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* สำหรับสั่งพิมพ์ (Print Stylesheet) */
@media print {
    body * {
        visibility: hidden;
    }
    #printReceiptModal, #printReceiptModal * {
        visibility: visible;
    }
    #printReceiptModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .btn-print-hide {
        display: none !important;
    }
}

/* --- Login / Register Split Page Design --- */
.auth-container {
    max-width: 950px;
    margin: 5rem auto;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.1);
    background: #ffffff;
    display: flex;
}

.auth-sidebar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-right: 4px solid var(--accent-color);
    color: #ffffff;
    padding: 4.5rem 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 45%;
    position: relative;
    box-shadow: inset -10px 0 20px -10px rgba(0, 0, 0, 0.3);
}

/* --- Official Thai Government Style Elements --- */
.official-divider {
    height: 2px;
    background: linear-gradient(to right, transparent, var(--accent-color) 15%, var(--accent-color) 85%, transparent);
    margin: 1.75rem 0;
    opacity: 0.85;
}

.text-gold-accent {
    color: #e5c158 !important; /* Elegant Royal Gold */
    font-weight: 600;
    letter-spacing: 0.5px;
}

.official-text {
    font-size: 0.95rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9) !important;
    text-align: justify;
    text-indent: 2.5em;
    margin-bottom: 0;
    font-family: var(--font-body);
}

.auth-form-wrapper {
    padding: 4rem 3.5rem;
    width: 55%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-toggle-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.auth-toggle-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .auth-container {
        flex-direction: column;
        margin: 2rem 1rem;
    }
    .auth-sidebar, .auth-form-wrapper {
        width: 100%;
        padding: 2rem 1.5rem !important;
    }
    .auth-sidebar {
        border-right: none !important;
        border-bottom: 4px solid var(--accent-color) !important;
        text-align: center !important;
    }
    .official-text {
        text-indent: 0 !important;
        text-align: center !important;
    }
}

/* --- Offcanvas Mobile Drawer Custom Styling --- */
@media (max-width: 991.98px) {
    .navbar-custom .offcanvas {
        background-color: #f8fafc; /* Light gray base matching screen mockup */
        width: 290px; /* Sleek width */
        border-right: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.08);
    }
    
    .navbar-custom .offcanvas-header {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        background-color: #ffffff;
        padding: 1.2rem;
    }
    
    .navbar-custom .offcanvas-body {
        padding: 1.5rem 1rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .navbar-custom .navbar-nav {
        gap: 0.5rem;
        width: 100%;
    }
    
    .navbar-custom .nav-link {
        margin: 0 !important;
        padding: 0.8rem 1.2rem !important;
        font-size: 1rem;
        color: #334155;
        border-radius: 10px;
        display: flex;
        align-items: center;
        transition: all 0.2s ease;
    }
    
    .navbar-custom .nav-link:hover {
        background-color: rgba(30, 58, 138, 0.06);
        color: var(--primary-color);
        transform: translateX(4px);
    }
    
    .navbar-custom .nav-link.active {
        background-color: var(--primary-color) !important;
        color: #ffffff !important;
        box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
    }
    
    /* Custom Styling for profile segment in mobile menu drawer */
    .navbar-custom .user-profile-sidebar {
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        padding-top: 1.2rem;
        margin-top: 1.5rem;
        width: 100%;
    }
}

/* --- Premium User Profile Pill & Compact Logout Button --- */
.user-profile-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px 14px 4px 6px;
    border-radius: 50px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.profile-pill:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(30, 58, 138, 0.12);
}

.profile-avatar.admin-avatar {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-light) 100%);
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.12);
}

.profile-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: left;
}

.profile-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.profile-role-badge {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--primary-color);
}

.profile-role-badge.admin-role {
    color: var(--success-color);
}

/* Compact and Sleek Logout Button */
.btn-logout-sleek {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0 12px;
    height: 32px;
    border-radius: 50px;
    border: 1px solid #fecaca; /* red-200 */
    background-color: #fef2f2; /* red-50 */
    color: #dc2626; /* red-600 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn-logout-sleek:hover {
    background-color: #dc2626; /* red-600 */
    border-color: #dc2626;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.12);
}

@media (max-width: 991.98px) {
    .user-profile-wrapper {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 12px;
        padding-top: 1.2rem;
        margin-top: 1.2rem;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }
    
    .profile-pill {
        width: 100%;
        background-color: transparent;
        border: none;
        padding: 0;
    }
    
    .profile-pill:hover {
        background-color: transparent;
    }
    
    .btn-logout-sleek {
        width: 100%;
        height: 38px;
        font-size: 0.85rem;
    }
}

/* --- Large Avatar Styling for Profile Page --- */
.avatar-large-wrapper {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    padding: 5px;
    background-color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}

.avatar-large {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- Pagination Component Styles --- */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.pagination-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #475569;
    margin-right: 5px;
}
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--primary-color);
    background-color: var(--primary-color);
    color: #ffffff;
    text-decoration: none;
    user-select: none;
}
.pagination-btn:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: #ffffff;
}
.pagination-btn.active {
    background-color: #ffffff;
    border-color: var(--primary-color);
    color: var(--primary-color);
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(12, 43, 92, 0.1);
}

/* --- Extra Mobile Responsive Tweaks for Small Viewports --- */
@media (max-width: 576px) {
    .alert.d-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }
    .alert.d-flex button, .alert.d-flex a {
        width: 100% !important;
    }
    .card-premium {
        padding: 1.25rem 1rem !important;
    }
    .hero-banner {
        padding: 1.5rem !important;
    }
    .hero-banner h1 {
        font-size: 1.6rem !important;
    }
    .hero-banner p {
        font-size: 0.95rem !important;
    }
}

/* --- Withdrawn Grayed Out Table Row --- */
.table-premium tr.row-withdrawn td,
.table-premium tr.row-withdrawn td * {
    color: #94a3b8 !important;
    background-color: #f8fafc !important;
    text-decoration: none;
}



