/* Modern Store Focus Tracking System - Styles */

/* Date Badge Styles */
.date-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    min-width: 80px;
}

.date-recent {
    background: var(--success-bg);
    color: var(--success-dark);
    border: 1px solid var(--success-light);
}

.date-good {
    background: var(--warning-bg);
    color: var(--warning-dark);
    border: 1px solid var(--warning-light);
}

.date-warning {
    background: rgba(245, 101, 101, 0.1);
    color: #DC2626;
    border: 1px solid #FCA5A5;
}

.date-old {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-dark);
    border: 1px solid var(--danger-light);
}

.date-none {
    background: var(--gray-100);
    color: var(--gray-500);
    border: 1px solid var(--gray-300);
}

/* Activity Badge Styles */
.activity-badge,
.plan-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    min-width: 80px;
    cursor: help;
}

.has-activity {
    background: rgba(245, 101, 101, 0.1);
    color: #DC2626;
    border: 1px solid #FCA5A5;
}

.no-activity {
    background: var(--gray-100);
    color: var(--gray-500);
    border: 1px solid var(--gray-300);
}

.has-plan {
    background: var(--success-bg);
    color: var(--success-dark);
    border: 1px solid var(--success-light);
}

.no-plan {
    background: var(--warning-bg);
    color: var(--warning-dark);
    border: 1px solid var(--warning-light);
}

/* Design System Variables */
:root {
    /* Modern Color Palette */
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --primary-bg: rgba(99, 102, 241, 0.1);

    --secondary: #0EA5E9;
    --secondary-dark: #0284C7;
    --secondary-light: #38BDF8;

    --success: #10B981;
    --success-dark: #059669;
    --success-light: #34D399;
    --success-bg: rgba(16, 185, 129, 0.1);

    --warning: #F59E0B;
    --warning-dark: #D97706;
    --warning-light: #FCD34D;
    --warning-bg: rgba(245, 158, 11, 0.1);

    --danger: #EF4444;
    --danger-dark: #DC2626;
    --danger-light: #F87171;

    --info: #3B82F6;
    --info-dark: #2563EB;
    --info-light: #60A5FA;

    --purple: #A855F7;
    --purple-dark: #9333EA;
    --purple-light: #C084FC;

    /* Gray Scale */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    --gradient-secondary: linear-gradient(135deg, #0EA5E9 0%, #6366F1 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #059669 100%);
    --gradient-warning: linear-gradient(135deg, #FCD34D 0%, #F59E0B 100%);
    --gradient-info: linear-gradient(135deg, #60A5FA 0%, #3B82F6 100%);
    --gradient-purple: linear-gradient(135deg, #C084FC 0%, #A855F7 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(180deg, #F0F9FF 0%, #E0F2FE 50%, #F0F9FF 100%);
    color: var(--gray-800);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(14, 165, 233, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Modern Navbar */
.navbar-modern {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all var(--transition-base);
}

.navbar-modern.scrolled {
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 0.95);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.brand-logo:hover {
    transform: scale(1.05) rotate(-5deg);
    box-shadow: var(--shadow-lg);
}

.brand-logo i {
    font-size: 20px;
    color: white;
}

.brand-text-wrapper {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: -2px;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item:hover {
    color: var(--primary);
    background: var(--primary-bg);
    transform: translateY(-2px);
}

.nav-item.active {
    color: var(--primary);
    background: var(--primary-bg);
}

.nav-item i {
    font-size: 18px;
}

.nav-indicator {
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.nav-item.active .nav-indicator {
    width: 30px;
}

.notification-badge {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    margin-left: 4px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--gray-300);
    margin: 0 8px;
}

.user-menu {
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-700);
    cursor: pointer;
}

/* Main Container */
.main-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Glass Card Effect */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

.glass-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

/* Filter Section */
.filter-card {
    padding: 0;
}

.filter-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.filter-title i {
    color: var(--primary);
}

.btn-icon {
    background: white;
    border: 1px solid var(--gray-200);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--gray-600);
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

.filter-body {
    padding: 1.5rem;
}

/* Modern Input Styles */
.search-input-group {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 18px;
    pointer-events: none;
}

.modern-input {
    padding: 12px 40px 12px 42px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    background: white;
    color: var(--gray-800);
    width: 100%;
}

.modern-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.modern-input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0;
    pointer-events: none;
}

.modern-input:not(:placeholder-shown)~.search-clear {
    opacity: 1;
    pointer-events: all;
}

.search-clear:hover {
    color: var(--danger);
}

/* Modern Select */
.modern-select {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    background: white;
    color: var(--gray-800);
    cursor: pointer;
}

.modern-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.modern-select-sm {
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 8px;
}

/* Modern Buttons */
.btn-modern-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.btn-modern-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-modern-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-modern-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    transform: translateY(-2px);
}

/* Advanced Filters */
.advanced-filters {
    display: none;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
    animation: slideDown 0.3s ease;
}

.advanced-filters.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
    display: block;
}

/* Loading Progress Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.progress-circle {
    position: relative;
    margin: 0 auto 2rem;
    width: 100px;
    height: 100px;
}

.progress-ring {
    position: relative;
    width: 100%;
    height: 100%;
}

.progress-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-circle-bg {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 8;
    cx: 50px;
    cy: 50px;
    r: 40px;
}

.progress-circle-fill {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    cx: 50px;
    cy: 50px;
    r: 40px;
    stroke-dasharray: 251.2;
    stroke-dashoffset: 251.2;
    animation: progressAnimation 2s ease-in-out infinite;
}

.progress-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: var(--primary-color);
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-title {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.loading-text {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.loading-steps {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    opacity: 0.5;
}

.step.active {
    opacity: 1;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

.step i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.step span {
    font-size: 0.875rem;
    font-weight: 500;
}

@keyframes progressAnimation {
    0% {
        stroke-dashoffset: 251.2;
    }

    50% {
        stroke-dashoffset: 125.6;
    }

    100% {
        stroke-dashoffset: 251.2;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.7;
    }
}

/* Stats Container */
.stats-container {
    overflow-x: auto;
    margin: 0 -8px;
    display: none;
    /* Hidden by default */
}

.stats-scroll {
    display: flex;
    gap: 16px;
    padding: 0 8px;
    min-width: min-content;
}

/* Stat Cards */
.stat-card {
    flex: 1;
    min-width: 200px;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    color: white;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.gradient-primary {
    background: var(--gradient-primary);
}

.gradient-secondary {
    background: var(--gradient-secondary);
}

.gradient-success {
    background: var(--gradient-success);
}

.gradient-warning {
    background: var(--gradient-warning);
}

.gradient-info {
    background: var(--gradient-info);
}

.gradient-purple {
    background: var(--gradient-purple);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat-icon i {
    font-size: 24px;
    color: white;
}

.stat-content {
    position: relative;
    z-index: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

.stat-trend {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-trend.up {
    color: #10F981;
}

.stat-trend.down {
    color: #FF6B6B;
}

/* Map Section */
.map-section {
    margin-bottom: 2rem;
}

.map-card {
    padding: 0;
}

.map-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-title-section {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
}

.map-view-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-view-select {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    min-width: 220px;
    font-weight: 500;
}

.map-view-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
    outline: none;
}

.map-view-select option {
    background: white;
    color: var(--gray-700);
    padding: 0.5rem;
}

.map-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.map-title i {
    color: var(--primary);
}

.map-controls {
    display: flex;
    gap: 8px;
}

.map-container {
    position: relative;
    height: 500px;
    background: var(--gray-100);
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 400;
}

.legend-toggle {
    background: white;
    border: 1px solid var(--gray-200);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.legend-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.legend-content {
    background: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    display: none;
    animation: fadeInUp 0.3s ease;
}

.legend-content.show {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.legend-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.legend-dot.focus {
    background: var(--warning);
}

.legend-dot.active {
    background: var(--success);
}

.legend-dot.inactive {
    background: var(--gray-400);
}

/* Table Section */
.table-section {
    margin-top: 2rem;
}

.table-card {
    padding: 0;
}

.table-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.table-title i {
    color: var(--primary);
}

.count-badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
}

.table-actions {
    display: flex;
    gap: 8px;
}

/* Modern Table */
.table-responsive {
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    background: white;
    font-size: 0.9rem;
}

.modern-table thead {
    background: var(--gray-50);
}

.modern-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.th-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Sortable Headers */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background-color: rgba(var(--primary-color-rgb), 0.05) !important;
}

.sortable .th-content {
    justify-content: space-between;
}

.sort-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
    opacity: 0.5;
    margin-left: auto;
}

.sortable:hover .sort-icon {
    opacity: 1;
    color: var(--primary-color);
}

.sortable.sort-asc .sort-icon {
    opacity: 1;
    color: var(--primary-color);
}

.sortable.sort-desc .sort-icon {
    opacity: 1;
    color: var(--primary-color);
}

.sortable.sort-asc .sort-icon::before {
    content: '\f0de';
    /* fa-sort-up */
}

.sortable.sort-desc .sort-icon::before {
    content: '\f0dd';
    /* fa-sort-down */
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border-top: 1px solid var(--gray-200);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.pagination-select {
    width: auto;
    min-width: 140px;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.modern-pagination {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 0.25rem;
}

.modern-pagination .page-item {
    display: flex;
}

.modern-pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0.5rem 0.75rem;
    color: var(--text-dark);
    text-decoration: none;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.modern-pagination .page-link:hover {
    background: var(--gray-50);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modern-pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.3);
}

.modern-pagination .page-item.disabled .page-link {
    color: var(--text-muted);
    background: var(--gray-100);
    border-color: var(--gray-200);
    cursor: not-allowed;
    transform: none;
}

.modern-pagination .page-item.disabled .page-link:hover {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--text-muted);
    transform: none;
    box-shadow: none;
}

@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .pagination-info {
        justify-content: space-between;
    }

    .modern-pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Work Tracking Card */
.work-tracking-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.work-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.work-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.work-title i {
    color: #10B981;
    font-size: 1.2rem;
}

.work-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.work-month {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
}

.work-body {
    padding: 0;
    overflow: visible;
    transition: all 0.3s ease;
}

.work-body.collapsed {
    max-height: 0;
    padding: 0;
}

.work-table-container {
    overflow-x: auto;
    overflow-y: visible;
}

.work-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
    background: white;
}

.work-table thead th {
    background: var(--gray-50);
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
}

.work-header-cell {
    width: 200px;
    min-width: 200px;
    text-align: left !important;
    padding-left: 1rem !important;
    background: var(--gray-100) !important;
    border-right: 1px solid var(--gray-200);
}

.work-day-header {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

.work-spacer {
    width: 200px;
    min-width: 200px;
    background: var(--gray-100) !important;
    border-right: 1px solid var(--gray-200);
}

.day-cell {
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.work-table tbody tr {
    transition: background-color 0.2s ease;
}

.work-table tbody tr:hover {
    background: rgba(16, 185, 129, 0.02);
}

.work-row-header {
    background: var(--gray-50);
    padding: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    border-right: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    left: 0;
    z-index: 5;
}

.work-cell {
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    height: 40px;
    text-align: center;
    vertical-align: middle;
    border-right: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
    position: relative;
    background: white;
}

.work-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.work-status:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.status-completed {
    background: #10B981;
}

.status-partial {
    background: #F59E0B;
}

.status-pending {
    background: #E5E7EB;
    color: var(--gray-600);
}

.status-na {
    background: transparent;
}

/* Sunday styling (non-working day) */
.weekend-cell {
    background: rgba(239, 68, 68, 0.05) !important;
}

.weekend-day {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #DC2626 !important;
}

/* Today highlighting */
.today-cell {
    background: rgba(59, 130, 246, 0.1) !important;
    border: 2px solid #3B82F6 !important;
}

.today-day {
    background: #3B82F6 !important;
    color: white !important;
}

@media (max-width: 768px) {
    .work-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .work-controls {
        width: 100%;
        justify-content: space-between;
    }

    .work-header-cell {
        width: 150px;
        min-width: 150px;
    }

    .work-spacer {
        width: 150px;
        min-width: 150px;
    }

    .day-cell {
        width: 25px;
        min-width: 25px;
        max-width: 25px;
    }

    .work-cell {
        width: 25px;
        min-width: 25px;
        max-width: 25px;
        height: 35px;
    }

    .work-status {
        width: 16px;
        height: 16px;
        font-size: 0.625rem;
    }
}

.th-content i {
    color: var(--gray-400);
    font-size: 14px;
}

.modern-table tbody tr {
    transition: all var(--transition-fast);
    cursor: pointer;
}

.modern-table tbody tr:hover {
    background: var(--gray-50);
    transform: translateX(4px);
}

.modern-table tbody tr.selected {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.focus {
    background: var(--warning-bg);
    color: var(--warning-dark);
}

.status-badge.active {
    background: var(--success-bg);
    color: var(--success-dark);
}

.status-badge.inactive {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--gray-600);
}

.action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
}

.action-btn.view:hover {
    background: var(--info);
    border-color: var(--info);
}

.action-btn.call:hover {
    background: var(--success);
    border-color: var(--success);
}

.action-btn.navigate:hover {
    background: var(--secondary);
    border-color: var(--secondary);
}

/* Modern Modal */
.modern-modal .modal-content {
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-2xl);
}

.modern-modal .modal-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem;
}

.modern-modal .modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--gray-800);
}

.modern-modal .modal-title i {
    color: var(--primary);
}

.btn-close-modern {
    background: white;
    border: 1px solid var(--gray-200);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--gray-600);
}

.btn-close-modern:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.modern-modal .modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-label i {
    color: var(--gray-400);
    font-size: 14px;
}

.modern-modal .modal-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Floating Action Button */
.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
}

.fab-main {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
}

.fab-main:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: var(--shadow-xl);
}

.fab-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-base);
}

.fab-menu.show {
    opacity: 1;
    pointer-events: all;
}

.fab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    padding: 12px 16px;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--gray-700);
    font-weight: 500;
    font-size: 0.9rem;
}

.fab-item:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateX(-8px);
}

.fab-label {
    font-size: 0.85rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .stats-scroll {
        overflow-x: auto;
        scrollbar-width: thin;
    }
}

@media (max-width: 768px) {

    /* Mobile Navigation */
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        transform: translateY(-100%);
        opacity: 0;
        transition: all var(--transition-base);
        z-index: 999;
    }

    .nav-menu.show {
        transform: translateY(0);
        opacity: 1;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .nav-divider {
        width: 100%;
        height: 1px;
        margin: 8px 0;
    }

    .nav-item {
        width: 100%;
    }

    /* Main Container */
    .main-container {
        padding: 1rem;
    }

    /* Stats */
    .stat-card {
        min-width: 150px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Map */
    .map-container {
        height: 400px;
    }

    /* Table */
    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-actions {
        width: 100%;
        justify-content: space-between;
    }

    /* FAB */
    .fab-container {
        bottom: 16px;
        right: 16px;
    }

    .fab-main {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

@media (max-width: 576px) {

    /* Filter Cards */
    .filter-actions {
        width: 100%;
    }

    .filter-actions button {
        flex: 1;
    }

    /* Cards */
    .glass-card {
        border-radius: var(--radius-md);
        margin: 0 -0.5rem;
    }

    /* Table */
    .modern-table {
        font-size: 0.8rem;
    }

    .modern-table th,
    .modern-table td {
        padding: 0.75rem 0.5rem;
    }

    .th-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .th-content i {
        display: none;
    }
}

/* Work Tracking Table Styles */
.work-tracking-card {
    margin-bottom: 2rem;
    overflow: visible !important;
}

.work-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
    border-bottom: 1px solid #E5E7EB;
}

.work-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1F2937;
    margin: 0;
}

.work-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.work-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.work-table-container {
    overflow: visible;
    background: white;
    border-radius: 8px;
}

.work-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.work-table thead th {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    color: #6B7280;
    border-bottom: 2px solid #E5E7EB;
    position: sticky;
    top: 0;
    z-index: 10;
}

.work-header-cell {
    text-align: left !important;
    padding-left: 1rem !important;
    width: 200px;
    min-width: 200px;
}

.work-day-cell {
    width: auto;
    font-size: 0.875rem;
    white-space: nowrap;
}

.work-day-cell.weekend {
    background: rgba(239, 68, 68, 0.05);
    color: #DC2626;
}

.work-task-cell {
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: #1F2937;
    background: #F9FAFB;
    border-right: 2px solid #E5E7EB;
    position: sticky;
    left: 0;
    z-index: 5;
    width: 200px;
    min-width: 200px;
}

.work-status-cell {
    padding: 0.5rem;
    text-align: center;
    border-bottom: 1px solid #F3F4F6;
    border-right: 1px solid #F3F4F6;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.work-status-cell:hover {
    background: #F9FAFB;
}

.work-status-cell.weekend {
    background: rgba(239, 68, 68, 0.02);
}

.work-status-cell.today {
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid var(--primary);
    font-weight: 700;
}

.work-status-cell.completed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-dark);
}

.work-status-cell.planned {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-dark);
}

.work-status-cell i {
    font-size: 0.875rem;
}

/* Total cells styling */
.work-total-cell {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    font-weight: 700;
    text-align: center;
    padding: 0.75rem;
    border-left: 2px solid #D1D5DB;
    border-bottom: 1px solid #E5E7EB;
    position: sticky;
    right: 0;
    z-index: 3;
}

.total-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.total-count.grand {
    background: linear-gradient(135deg, #10B981, #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    min-width: 50px;
    height: 50px;
    font-size: 1.3rem;
}

.total-row {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    border-top: 3px solid #D1D5DB;
}

.total-row .work-task-cell {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    font-weight: 700;
    padding: 1rem;
}

.total-row .work-total-cell {
    border-top: 3px solid #D1D5DB;
}

.total-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.total-label i {
    font-size: 1.25rem;
}

.grand-total {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    border: 2px solid #10B981;
}

/* Legend Styles */
.work-legend {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: #F9FAFB;
    border-radius: 8px;
    flex-shrink: 0;
}

.work-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #E5E7EB;
}

.legend-box.completed {
    background: rgba(16, 185, 129, 0.3);
    border-color: var(--success);
}

.legend-box.planned {
    background: rgba(245, 158, 11, 0.3);
    border-color: var(--warning);
}

.legend-box.today {
    background: rgba(99, 102, 241, 0.3);
    border-color: var(--primary);
}

.legend-box.weekend {
    background: rgba(239, 68, 68, 0.1);
    border-color: #DC2626;
}

/* Section visibility */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Truck info styles */
.truck-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.truck-info i {
    font-size: 1.25rem;
}

.truck-info span {
    font-weight: 600;
}

/* Visit count styles */
.visit-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 32px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(var(--gray-200-rgb), 0.3) !important;
    border: 1px solid var(--gray-200);
    color: var(--gray-800);
    padding: 0.25rem 0.6rem;
    gap: 2px;
}

.ratio-total {
    color: var(--gray-600);
}

.ratio-separator {
    color: var(--gray-400);
    font-weight: 400;
}

.ratio-visited {
    color: var(--success-dark);
}

.visit-count.planned {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.2);
}

.visit-count.empty {
    background: transparent !important;
    border: none;
    color: #9CA3AF;
    font-weight: 400;
}

.work-status-cell.today .visit-count {
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.amphur-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    line-height: 1.1;
    color: #6B7280;
    white-space: normal;
    word-break: break-word;
    text-align: center;
}

.amphur-badge {
    display: inline-block;
    background: #F3F4F6;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 500;
}

/* Week navigation */
.week-display {
    font-size: 1rem;
    color: #1F2937;
    min-width: 180px;
    text-align: center;
}

/* Store Modal Styles */
.store-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.store-modal-overlay.closing {
    animation: fadeOut 0.3s ease;
}

.store-modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.store-modal-content .modal-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.store-modal-content .modal-header h5 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1F2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6B7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.modal-body {
    padding: 1.5rem;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

.modal-summary {
    margin-bottom: 1.5rem;
}

.summary-header {
    margin-bottom: 1rem;
}

.summary-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
}

.type-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: #F9FAFB;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
}

.type-summary-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}

.type-summary-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.type-summary-badge i {
    font-size: 0.75rem;
}

.type-summary-badge strong {
    font-weight: 700;
    font-size: 0.9rem;
}

.store-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.store-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #F9FAFB;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    transition: all 0.2s;
    animation: slideInItem 0.3s ease forwards;
    opacity: 0;
}

.store-list-item:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.store-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.store-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #1F2937;
}

.store-name i {
    color: #6B7280;
    flex-shrink: 0;
}

.store-name span {
    flex: 1;
}

.store-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.store-type-badge i {
    font-size: 0.75rem;
}

.store-status {
    flex-shrink: 0;
    font-size: 1.25rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInItem {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Truck Map Styles */
.truck-map-container {
    position: relative;
    background: white;
}

#truckMap {
    height: 500px;
    width: 100%;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.truck-map-legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 250px;
    z-index: 1000;
}

.map-legend-section {
    margin-bottom: 1rem;
}

.map-legend-section:last-child {
    margin-bottom: 0;
}

.legend-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.store-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Custom Marker Icon */
.custom-marker-icon {
    background: transparent !important;
    border: none !important;
}

/* Sequence Marker */
.sequence-marker {
    background: transparent !important;
    border: none !important;
}

/* Marker Popup */
.marker-popup {
    min-width: 200px;
}

.leaflet-popup-content {
    margin: 10px;
}

/* Route Line Styles */
.leaflet-interactive {
    cursor: pointer;
}

.leaflet-interactive:hover {
    opacity: 1 !important;
}

/* Leaflet Pane Z-Index Control */
/* ลำดับ: marker-pane (ล่างสุด) -> overlay-pane (เส้นทาง) -> marker ที่เลือก (บนสุด) */
.leaflet-marker-pane {
    z-index: 400 !important;
}

.leaflet-overlay-pane {
    z-index: 500 !important;
}

.leaflet-shadow-pane {
    z-index: 300 !important;
}

/* Modern Marker Styles */
.modern-marker {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Truck info hover effect */
.truck-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.work-task-cell:hover .truck-info {
    transform: translateX(4px);
}

/* Daily Store List Styles */
.daily-sections-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.daily-section {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: all 0.2s;
}

.daily-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.daily-header {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.daily-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.day-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.daily-count {
    font-size: 0.85rem;
    color: var(--gray-600);
    font-weight: 600;
}

.daily-stores-list {
    padding: 0.5rem;
}

.daily-store-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 2px dashed var(--gray-300);
}

.daily-store-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.daily-store-item:last-child {
    margin-bottom: 0;
}

.daily-store-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.store-order {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.store-name-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.store-name-text {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.9rem;
}

.store-type-badge-small {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.store-type-badge-small i {
    font-size: 0.7rem;
}

/* Responsive adjustments for work table */
@media (max-width: 768px) {
    .work-table {
        font-size: 0.75rem;
    }

    .work-day-cell {
        min-width: 80px;
        padding: 0.5rem 0.25rem;
    }

    .work-task-cell {
        min-width: 150px;
        font-size: 0.8rem;
    }

    .truck-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .visit-count {
        min-width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .week-display {
        font-size: 0.875rem;
        min-width: 150px;
    }

    .work-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Store modal responsive */
    .store-modal-content {
        max-width: 95%;
    }

    .type-summary {
        padding: 0.75rem;
        gap: 0.375rem;
    }

    .type-summary-badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }

    .type-summary-badge strong {
        font-size: 0.8rem;
    }

    .amphur-badge {
        font-size: 0.6rem;
        padding: 1px 4px;
    }

    /* Modal adjustment */
    .modal-dialog {
        margin: 0.5rem;
    }
}

@media (max-width: 1024px) {
    .main-container {
        padding: 0.5rem;
    }

    .work-header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }

    .work-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }

    .week-display {
        grid-column: span 2;
        margin: 0 !important;
        font-size: 1rem;
        text-align: center;
        background: rgba(99, 102, 241, 0.05);
        padding: 0.5rem;
        border-radius: 8px;
    }

    .work-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        background: white;
        border: 1px solid var(--gray-200);
        position: relative;
    }

    .work-table {
        min-width: 1100px;
        /* Force sufficient width for all columns */
        border-collapse: separate;
        border-spacing: 0;
    }

    /* Ensure BOTH cell and header follow sticky rules */
    .sticky-col,
    thead th.sticky-col {
        position: sticky !important;
        left: 0;
        z-index: 50 !important;
        background-color: white !important;
        border-right: 2px solid var(--gray-300) !important;
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.05);
    }

    thead th.sticky-col {
        background-color: #F3F4F6 !important;
        z-index: 60 !important;
        top: 0;
    }

    .sales-col {
        width: 160px;
        min-width: 160px;
        padding: 0.75rem 0.5rem !important;
    }

    .sales-info span {
        white-space: normal;
        font-size: 0.75rem;
        line-height: 1.2;
        display: block;
        color: var(--gray-900);
    }

    .work-day-cell {
        min-width: 110px;
        font-size: 0.8rem !important;
        padding: 0.5rem !important;
    }

    .visit-count {
        min-width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .total-count {
        font-size: 0.85rem;
        padding: 4px 6px;
        min-width: 60px;
        text-align: center;
    }

    .work-total-cell {
        min-width: 80px;
        text-align: center !important;
    }

    .amphur-badge {
        font-size: 0.6rem;
        padding: 1px 3px;
        margin: 1px;
    }

    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}

@media (max-width: 768px) {
    .navbar-modern {
        padding: 0.5rem 0;
    }

    .brand-name {
        font-size: 1.1rem;
    }

    .brand-tagline {
        display: none;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-xl);
        display: none;
        z-index: 999;
    }

    .nav-menu.show {
        display: flex;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .work-title {
        font-size: 1rem;
    }

    .week-display {
        font-size: 0.9rem;
        margin: 0 !important;
    }

    .btn-modern-secondary.btn-sm {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

.store-list-item {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
}

.store-name {
    order: 1;
    width: 100%;
}

.store-type-badge {
    order: 3;
    flex: 1;
    justify-content: center;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

.store-status {
    order: 4;
    font-size: 1rem;
}

/* Truck map responsive */
#truckMap {
    height: 400px;
}

.truck-map-legend {
    position: relative;
    top: 0;
    right: 0;
    max-width: 100%;
    margin: 1rem;
}

.legend-items {
    flex-direction: row;
    flex-wrap: wrap;
}

/* Daily store list responsive */
.daily-sections-container {
    grid-template-columns: 1fr;
}

.daily-store-item {
    padding: 0.5rem;
    gap: 0.5rem;
}

.store-order {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
}

.store-name-text {
    font-size: 0.85rem;
}

.store-type-badge-small {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
}