/* Custom CSS Design for Charoen Osoth 2518 - Apple Modern Style */

/* CSS Variables for Clean Theme Control */
:root {
    --primary-color: #2e5a44; /* Organic Sage Green */
    --primary-hover: #1e3b2c;
    --success-color: #4a7c59;
    --warning-color: #c88b48;
    --danger-color: #b85241;
    --info-color: #d9743c; /* Terracotta Orange */
    
    /* Light Mode Palette - Leaf & Beans organic warm cream theme */
    --bg-color: #f4f0e6;
    --card-bg: rgba(252, 250, 244, 0.9);
    --card-border: rgba(46, 90, 68, 0.08);
    --text-main: #1e2522;
    --text-muted: #78857f;
    --input-bg: #faf8f4;
    --input-border: #cbd5cd;
    --table-header-bg: #e3e8e4;
    --glass-blur: blur(20px);
    --shadow-sm: 0 2px 8px rgba(46, 90, 68, 0.03);
    --shadow-md: 0 8px 30px rgba(46, 90, 68, 0.06);
    --shadow-lg: 0 12px 40px rgba(46, 90, 68, 0.1);
    
    --mountain-color-1: rgba(46, 90, 68, 0.04);
    --mountain-color-2: rgba(217, 116, 60, 0.06);
    --mountain-path-color: rgba(46, 90, 68, 0.03);
}

.dark-mode {
    /* Dark Mode Palette - Deep forest green/black */
    --bg-color: #0c120f;
    --card-bg: rgba(18, 26, 22, 0.85);
    --card-border: rgba(255, 255, 255, 0.06);
    --text-main: #f0f4f2;
    --text-muted: #82928a;
    --input-bg: #151f1a;
    --input-border: #2e3d35;
    --table-header-bg: #1e2b24;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    
    --mountain-color-1: rgba(255, 255, 255, 0.02);
    --mountain-color-2: rgba(217, 116, 60, 0.04);
    --mountain-path-color: rgba(255, 255, 255, 0.01);
}

/* Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Kanit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Blur Lights */
.bg-glow {
    position: absolute;
    width: 40vw;
    height: 40vw;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.bg-glow-1 {
    top: -10vw;
    left: -10vw;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
}

.bg-glow-2 {
    bottom: -10vw;
    right: -10vw;
    background: radial-gradient(circle, var(--info-color) 0%, transparent 70%);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
    opacity: 0.5;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--input-border);
}

/* Dynamic Toast (Dynamic Island Style) */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #ffffff;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    animation: toast-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.toast-error {
    border: 1px solid rgba(255, 69, 58, 0.3);
}

.toast.toast-success {
    border: 1px solid rgba(52, 199, 89, 0.3);
}

.toast-mascot {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

@keyframes toast-in {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast-out {
    animation: toast-out 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
}

/* Buttons Styling */
.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 90, 68, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--card-border);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: var(--table-header-bg);
    border-color: var(--input-border);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-icon {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
    background-color: var(--table-header-bg);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* ==================== LOGIN SCREEN STYLES ==================== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.login-screen.active {
    display: flex;
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--card-border);
    width: 100%;
    max-width: 420px;
    padding: 40px 32px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: card-appear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes card-appear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo-container {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(46, 90, 68, 0.15);
}

.login-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.login-mascot-container {
    background: rgba(46, 90, 68, 0.05);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    text-align: left;
    border: 1px solid rgba(46, 90, 68, 0.1);
}

.login-mascot {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.mascot-bubble {
    font-size: 0.8rem;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.3;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 6px;
    width: 100%;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.input-group input, 
.input-group select, 
.input-group textarea {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    width: 100%;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(46, 90, 68, 0.12);
}

.btn-login {
    margin-top: 10px;
    height: 48px;
    font-size: 1.05rem;
}

.login-footer {
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==================== MAIN APP STYLES ==================== */
.app-screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
}

.app-screen.active {
    display: flex;
}

/* Header Navbar */
.app-header {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--card-border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--card-border);
}

.header-brand {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 20px;
    border: 1px solid var(--card-border);
}

.dark-mode .user-profile {
    background: rgba(255, 255, 255, 0.03);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--table-header-bg);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.profile-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.btn-logout {
    height: 38px;
    padding: 0 16px;
    font-size: 0.85rem;
}

/* App Main Content Layout */
.app-main-content {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Welcome Banner */
.dashboard-banner {
    background: linear-gradient(135deg, rgba(46, 90, 68, 0.08) 0%, rgba(217, 116, 60, 0.08) 100%);
    border: 1px solid rgba(46, 90, 68, 0.15);
    border-radius: 24px;
    padding: 28px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
    min-height: 140px;
}

.banner-text {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 24px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(46, 90, 68, 0.08);
    max-width: 500px;
}

.banner-text h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    color: #1a3b2b; /* deep sage green for high contrast readability */
}

.banner-text p {
    font-size: 0.95rem;
    color: #2c4a3b; /* high contrast description text */
    margin: 0;
}

.banner-mascot-wrapper {
    height: 100%;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
}

.banner-mascot {
    width: 100px;
    height: 100px;
    object-fit: contain;
    transform: rotate(-5deg);
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.1));
    animation: mascot-float 4s ease-in-out infinite;
}

/* Landscape Mountain and Animated Cat Background */
.banner-landscape-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
    background-image: url('landscape_bg.png?v=3');
    background-size: cover;
    background-position: center 70%; /* Shows more mountains while keeping path visible */
    background-repeat: no-repeat;
}

.walking-cat-container {
    position: absolute;
    bottom: 16px; /* walk directly on the dirt path of landscape_bg.png */
    width: 60px;
    height: 60px;
    z-index: 2;
    animation: cat-walk 28s linear infinite;
}

.walking-cat-sprite {
    width: 60px;
    height: 60px;
    background-image: url('cat_sprite.png?v=3');
    background-size: 360px 60px;
    background-repeat: no-repeat;
    animation: cat-sprite-steps 0.6s steps(6) infinite;
    position: relative;
    z-index: 2;
}

.walking-cat-shadow {
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 5px;
    background: rgba(16, 26, 20, 0.48); /* dark shadow matching environment lighting */
    border-radius: 50%;
    filter: blur(2.5px);
    z-index: 1;
    animation: cat-shadow-pulsate 0.6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cat-shadow-pulsate {
    0%, 100% {
        transform: translateX(-50%) scaleX(1) scaleY(1);
        opacity: 0.95;
    }
    50% {
        transform: translateX(-50%) scaleX(0.8) scaleY(0.8);
        opacity: 0.7;
    }
}

@keyframes cat-sprite-steps {
    from { background-position: 0px 0px; }
    to { background-position: -360px 0px; }
}

@keyframes cat-walk {
    0% {
        left: -80px;
        transform: scaleX(-1); /* Facing right (since sprite sheet faces left, we flip it to face right) */
    }
    48% {
        transform: scaleX(-1);
    }
    50% {
        left: calc(100% + 10px);
        transform: scaleX(1); /* Facing left (original direction of sprite sheet) */
    }
    98% {
        transform: scaleX(1);
    }
    100% {
        left: -80px;
        transform: scaleX(-1); /* Facing right again */
    }
}

/* Dark Mode Overrides for Readable Text */
.dark-mode .banner-text {
    background: rgba(20, 30, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}
.dark-mode .banner-text h2 {
    color: #f4f0e6;
}
.dark-mode .banner-text p {
    color: #a3b899;
}

@keyframes cat-bob {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-5px) rotate(4deg);
    }
    50% {
        transform: translateY(0) rotate(0deg);
    }
    75% {
        transform: translateY(-5px) rotate(-4deg);
    }
}

@keyframes mascot-float {
    0%, 100% {
        transform: translateY(0) rotate(-5deg);
    }
    50% {
        transform: translateY(-8px) rotate(5deg);
    }
}

/* Stats Section Dashboard Cards */
.stats-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.filter-clear-tip {
    font-size: 0.8rem;
    color: var(--primary-color);
    background: rgba(46, 90, 68, 0.08);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    user-select: none;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-card.active-stat {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(46, 90, 68, 0.05) 100%);
    box-shadow: 0 8px 24px rgba(46, 90, 68, 0.06);
}

.stat-info {
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-icon-bg {
    position: absolute;
    right: -10px;
    bottom: -10px;
    opacity: 0.15;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.stat-card:hover .stat-icon-bg {
    opacity: 0.25;
    transform: scale(1.1) rotate(5deg);
}

.stat-card.active-stat .stat-icon-bg {
    opacity: 0.3;
}

.stat-cat-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

/* Actions and Filters Bar */
.actions-filters-section {
    width: 100%;
}

.filter-toolbar {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.left-actions {
    flex-shrink: 0;
}

.btn-add-report {
    height: 44px;
}

.btn-icon-plus {
    font-size: 1.3rem;
    font-weight: 400;
    line-height: 1;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 480px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    padding: 10px 16px 10px 42px;
    border-radius: 12px;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
}

.filter-dropdowns {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    padding: 10px 32px 10px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.select-wrapper::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-30%);
    border-width: 5px 4px 0;
    border-style: solid;
    border-color: var(--text-muted) transparent transparent;
    pointer-events: none;
}

.action-buttons-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-buttons-group .btn-secondary {
    height: 40px;
    padding: 0 14px;
    font-size: 0.85rem;
}

.btn-refresh-animated svg {
    width: 14px;
    height: 14px;
}

.spinning {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* ==================== TABLE SYSTEM ==================== */
.table-section {
    width: 100%;
}

.table-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.table-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background-color: var(--table-header-bg);
    padding: 14px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 16px 20px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
}

tr {
    background-color: transparent;
}

tr:hover {
    background-color: rgba(0, 0, 0, 0.015);
}

.dark-mode tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* Detail expanded style */
.issue-expanded-row {
    background-color: rgba(46, 90, 68, 0.01);
}

.expanded-detail-container {
    padding: 12px 24px 24px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    font-size: 0.85rem;
}

@media(min-width: 768px) {
    .expanded-detail-container {
        grid-template-columns: 2fr 1fr;
        gap: 32px;
    }
}

.expanded-detail-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-bubble-title {
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-bubble-content {
    background: var(--bg-color);
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    line-height: 1.5;
    white-space: pre-line;
}

.expanded-detail-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-img-box {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    max-height: 150px;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.detail-img-box img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: default;
    border: 1px solid transparent;
}

.status-badge.status-pending {
    background-color: rgba(255, 159, 10, 0.1);
    color: var(--warning-color);
    border-color: rgba(255, 159, 10, 0.2);
}

.status-badge.status-completed {
    background-color: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
    border-color: rgba(52, 199, 89, 0.2);
}

/* Admin Column Interactivity */
.admin-action-btn {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.admin-action-btn:hover {
    background-color: var(--primary-hover);
}

.admin-action-btn.btn-action-undo {
    background: var(--table-header-bg);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

.admin-action-btn.btn-action-undo:hover {
    background-color: var(--input-border);
}

.issues-product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-mascot-avatar {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.03);
    padding: 2px;
}

.dark-mode .product-mascot-avatar {
    background-color: rgba(255, 255, 255, 0.03);
}

.product-cell-info {
    display: flex;
    flex-direction: column;
}

.product-code-badge {
    font-size: 0.7rem;
    background: var(--table-header-bg);
    padding: 1px 6px;
    border-radius: 4px;
    width: fit-content;
    font-weight: 700;
    margin-bottom: 2px;
}

.product-name-txt {
    font-weight: 600;
}

.product-note-txt {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.empty-table-msg {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Pagination Control */
.table-pagination {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-pagination {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-pagination:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.table-empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.table-empty-state.active {
    display: flex;
}

.empty-mascot {
    width: 90px;
    height: 90px;
    object-fit: contain;
    margin-bottom: 16px;
}

.table-empty-state h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.table-empty-state p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ==================== MODALS LAYOUT ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-container {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    width: 100%;
    max-width: 640px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(30px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

.modal-small {
    max-width: 440px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header-title-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
}

.modal-header-cat-avatar {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.btn-close-modal:hover {
    color: var(--text-main);
}

.modal-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 80vh;
    overflow-y: auto;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media(min-width: 576px) {
    .form-row-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.static-detail-box {
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Mascot Selector */
.mascot-selector {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 0;
    width: 100%;
}

.mascot-option {
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    border-radius: 10px;
    border: 2px solid transparent;
    padding: 2px;
}

.mascot-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.mascot-option img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 2px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.mascot-option:hover img {
    transform: scale(1.1);
}

.mascot-option input:checked + img {
    border: 2px solid var(--primary-color);
    background-color: rgba(46, 90, 68, 0.05);
}

/* Drag & Drop Zone */
.drop-zone {
    border: 2px dashed var(--input-border);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    background: var(--bg-color);
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s ease;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary-color);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
}

.drop-zone-content p {
    font-size: 0.85rem;
    color: var(--text-main);
}

.drop-zone-content span {
    color: var(--primary-color);
    font-weight: 600;
}

.drop-zone-limit {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.file-input {
    display: none;
}

.preview-container {
    position: relative;
    max-width: 100%;
    margin-top: 10px;
    display: flex;
    justify-content: center;
}

.image-preview {
    max-height: 180px;
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid var(--card-border);
}

.btn-remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 69, 58, 0.85);
    color: #ffffff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-image:hover {
    background: var(--danger-color);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
}

/* Autocomplete Suggestion Dropdown */
.relative-pos {
    position: relative;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid var(--card-border);
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 0 0 12px 12px;
    max-height: 180px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--card-border);
}

.autocomplete-item:hover {
    background-color: var(--table-header-bg);
}

.autocomplete-item strong {
    color: var(--primary-color);
}

/* Footer Styling */
.app-footer {
    padding: 24px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--card-border);
}

/* Danger Button & Admin controls */
.btn-danger {
    background-color: #d93838;
    color: #ffffff !important;
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}
.btn-danger:hover {
    background-color: #bd2c2c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 56, 56, 0.25);
}
.btn-danger:active {
    transform: translateY(0);
}

.btn-success {
    background-color: var(--primary-color, #2e5a44);
    color: #ffffff !important;
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}
.btn-success:hover {
    background-color: #234533;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 90, 68, 0.25);
}
.btn-success:active {
    transform: translateY(0);
}

.is-admin-mode .admin-only-btn {
    display: inline-flex !important;
}

.admin-action-btn.btn-action-delete {
    background-color: #d93838;
    color: #ffffff;
}
.admin-action-btn.btn-action-delete:hover {
    background-color: #bd2c2c;
    box-shadow: 0 4px 12px rgba(217, 56, 56, 0.25);
}

/* ==================== PRINT STYLING ==================== */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    .app-header, 
    .bg-glow, 
    .dashboard-banner,
    .stats-section, 
    .actions-filters-section,
    .table-pagination,
    .modal-overlay,
    .toast-container,
    .app-footer {
        display: none !important;
    }

    .app-screen {
        display: block !important;
    }

    .app-main-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    .table-section {
        margin: 0 !important;
    }

    .table-card {
        border: none !important;
        box-shadow: none !important;
    }

    .table-header {
        border-bottom: 2px solid #000000 !important;
        padding: 10px 0 !important;
    }

    .table-header .table-title {
        font-size: 1.6rem !important;
    }

    table {
        border-collapse: collapse !important;
    }

    th {
        background-color: #f0f0f0 !important;
        color: #000000 !important;
        border-bottom: 1px solid #000000 !important;
    }

    td {
        border-bottom: 1px solid #cccccc !important;
        padding: 12px 8px !important;
        font-size: 0.85rem !important;
    }

    .status-badge {
        border: 1px solid #000000 !important;
        background: none !important;
        color: #000000 !important;
        padding: 2px 6px !important;
    }

    /* Print title banner for Charoen Osoth */
    body::before {
        content: "บริษัท เจริญโอสถ 2518 จำกัด - รายงานสรุปปัญหาสินค้า";
        display: block;
        font-size: 1.4rem;
        font-weight: 700;
        text-align: center;
        margin-bottom: 20px;
    }
}
