/* GoalDay System - Modern CSS Styles */

/* 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: #6EE7B7;
    --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: #FCA5A5;
    --danger-bg: rgba(239, 68, 68, 0.1);

    --info: #06B6D4;
    --info-dark: #0891B2;
    --info-light: #67E8F9;

    /* Neutral Colors */
    --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;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Channel Colors */
    --mt: #8B5CF6;
    --fm-distributor-clmv-mt: #F59E0B;
    --lmt-top50-1-50: #EC4899;
    --top50-51-100: #10B981;
    --clmv: #F97316;
    --border-clmv-2: #14B8A6;
    --top400-sales: #EF4444;
    --export: #3B82F6;
    --online-b2c-domestic: #A855F7;
    --online-b2b-domestic: #06B6D4;
    --online-b2c-international: #F43F5E;
    --online-b2b-international: #0891B2;
    --collection: #8B5CF6;
    --overall: #6366F1;
}

/* 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(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--gray-800);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navbar Modern */
.navbar-modern {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.brand-container:hover {
    transform: translateY(-2px);
}

.brand-logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
}

.brand-text-wrapper {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tagline {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.nav-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-indicator {
    display: none;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-700);
    cursor: pointer;
}

/* Main Container */
.main-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header Section */
.goalday-header {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-title i {
    color: var(--primary);
}

.page-subtitle {
    color: var(--gray-600);
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.days-passed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.current-month {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    min-width: 150px;
    text-align: center;
}

/* Summary Cards */
.summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s ease;
    height: 100%;
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.summary-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
    flex-shrink: 0;
}

.summary-icon.total {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.summary-icon.current {
    background: linear-gradient(135deg, #06B6D4, #0891B2);
}

.summary-icon.achievement {
    background: linear-gradient(135deg, #10B981, #059669);
}

.summary-icon.daily {
    background: linear-gradient(135deg, #F59E0B, #D97706);
}

.summary-content {
    flex: 1;
}

.summary-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin: 0 0 0.25rem 0;
    font-weight: 500;
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    line-height: 1;
}

.summary-unit {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0.25rem 0 0 0;
}

/* Channel Cards */
.channel-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
}

.channel-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.channel-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.channel-header.mt {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.05));
    border-bottom: 3px solid var(--mt);
}

.channel-header.fm-distributor-clmv-mt {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    border-bottom: 3px solid var(--fm-distributor-clmv-mt);
}

.channel-header.lmt-top50-1-50 {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(236, 72, 153, 0.05));
    border-bottom: 3px solid var(--lmt-top50-1-50);
}

.channel-header.top50-51-100 {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border-bottom: 3px solid var(--top50-51-100);
}

.channel-header.clmv {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(249, 115, 22, 0.05));
    border-bottom: 3px solid var(--clmv);
}

.channel-header.border-clmv-2 {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(20, 184, 166, 0.05));
    border-bottom: 3px solid var(--border-clmv-2);
}

.channel-header.top400-sales {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border-bottom: 3px solid var(--top400-sales);
}

.channel-header.export {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
    border-bottom: 3px solid var(--export);
}

.channel-header.online-b2c-domestic {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(168, 85, 247, 0.05));
    border-bottom: 3px solid var(--online-b2c-domestic);
}

.channel-header.online-b2b-domestic {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(6, 182, 212, 0.05));
    border-bottom: 3px solid var(--online-b2b-domestic);
}

.channel-header.online-b2c-international {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.1), rgba(244, 63, 94, 0.05));
    border-bottom: 3px solid var(--online-b2c-international);
}

.channel-header.online-b2b-international {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.1), rgba(8, 145, 178, 0.05));
    border-bottom: 3px solid var(--online-b2b-international);
}

.channel-header.collection {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.05));
    border-bottom: 3px solid var(--collection);
}

.channel-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.channel-header.mt .channel-icon {
    background: linear-gradient(135deg, var(--mt), #7C3AED);
}

.channel-header.fm-distributor-clmv-mt .channel-icon {
    background: linear-gradient(135deg, var(--fm-distributor-clmv-mt), #D97706);
}

.channel-header.lmt-top50-1-50 .channel-icon {
    background: linear-gradient(135deg, var(--lmt-top50-1-50), #DB2777);
}

.channel-header.top50-51-100 .channel-icon {
    background: linear-gradient(135deg, var(--top50-51-100), #059669);
}

.channel-header.clmv .channel-icon {
    background: linear-gradient(135deg, var(--clmv), #EA580C);
}

.channel-header.border-clmv-2 .channel-icon {
    background: linear-gradient(135deg, var(--border-clmv-2), #0D9488);
}

.channel-header.top400-sales .channel-icon {
    background: linear-gradient(135deg, var(--top400-sales), #DC2626);
}

.channel-header.export .channel-icon {
    background: linear-gradient(135deg, var(--export), #2563EB);
}

.channel-header.online-b2c-domestic .channel-icon {
    background: linear-gradient(135deg, var(--online-b2c-domestic), #9333EA);
}

.channel-header.online-b2b-domestic .channel-icon {
    background: linear-gradient(135deg, var(--online-b2b-domestic), #0891B2);
}

.channel-header.online-b2c-international .channel-icon {
    background: linear-gradient(135deg, var(--online-b2c-international), #E11D48);
}

.channel-header.online-b2b-international .channel-icon {
    background: linear-gradient(135deg, var(--online-b2b-international), #0E7490);
}

.channel-header.collection .channel-icon {
    background: linear-gradient(135deg, var(--collection), #7C3AED);
}

.channel-info {
    flex: 1;
}

.channel-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.25rem 0;
}

.channel-desc {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin: 0;
}

.btn-edit-goal {
    background: white;
    border: 2px solid var(--gray-200);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--gray-600);
}

.btn-edit-goal:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: rotate(90deg);
}

.channel-body {
    padding: 1.5rem;
}

.goal-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-value.remaining {
    color: var(--danger);
}

.stat-value.pending {
    color: var(--warning);
    font-weight: 600;
}

.stat-value.target-by-day {
    color: var(--info);
}

/* Custom Progress Bar */
.progress-bar-custom {
    position: relative;
    width: 100%;
    height: 40px;
    background: var(--gray-100);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-target {
    position: absolute;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    border-right: 2px dashed rgba(0, 0, 0, 0.2);
    transition: width 0.6s ease;
    z-index: 1;
}

.progress-fill {
    position: absolute;
    height: 100%;
    transition: width 0.6s ease, left 0.6s ease;
    z-index: 2;
}

/* สีสำหรับยอดขาย (สีเขียว) */
.progress-fill.sales {
    background: linear-gradient(90deg, #10B981, #059669);
    left: 0;
}

/* สีสำหรับยอดค้างส่ง (สีส้ม) */
.progress-fill.pending {
    background: linear-gradient(90deg, #F59E0B, #D97706);
    opacity: 0.85;
}

/* Keep old classes for backward compatibility */
.progress-fill.mt {
    background: linear-gradient(90deg, var(--mt), #7C3AED);
}

.progress-fill.fm-distributor-clmv-mt {
    background: linear-gradient(90deg, var(--fm-distributor-clmv-mt), #D97706);
}

.progress-fill.lmt-top50-1-50 {
    background: linear-gradient(90deg, var(--lmt-top50-1-50), #DB2777);
}

.progress-fill.top50-51-100 {
    background: linear-gradient(90deg, var(--top50-51-100), #059669);
}

.progress-fill.clmv {
    background: linear-gradient(90deg, var(--clmv), #EA580C);
}

.progress-fill.border-clmv-2 {
    background: linear-gradient(90deg, var(--border-clmv-2), #0D9488);
}

.progress-fill.top400-sales {
    background: linear-gradient(90deg, var(--top400-sales), #DC2626);
}

.progress-fill.export {
    background: linear-gradient(90deg, var(--export), #2563EB);
}

.progress-fill.online-b2c-domestic {
    background: linear-gradient(90deg, var(--online-b2c-domestic), #9333EA);
}

.progress-fill.online-b2b-domestic {
    background: linear-gradient(90deg, var(--online-b2b-domestic), #0891B2);
}

.progress-fill.online-b2c-international {
    background: linear-gradient(90deg, var(--online-b2c-international), #E11D48);
}

.progress-fill.online-b2b-international {
    background: linear-gradient(90deg, var(--online-b2b-international), #0E7490);
}

.progress-fill.collection {
    background: linear-gradient(90deg, var(--collection), #7C3AED);
}

.progress-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--gray-700);
    z-index: 3;
}

.daily-requirement {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.daily-requirement i {
    color: var(--warning);
    font-size: 1rem;
}

.status-summary {
    padding: 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.status-summary.status-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    color: var(--success-dark);
    border: 1px solid var(--success-light);
}

.status-summary.status-success i {
    color: var(--success);
    font-size: 1.25rem;
}

.status-summary.status-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    color: var(--warning-dark);
    border: 1px solid var(--warning-light);
}

.status-summary.status-warning i {
    color: var(--warning);
    font-size: 1.25rem;
}

.status-summary.status-info {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.1), rgba(107, 114, 128, 0.05));
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.status-summary.status-info i {
    color: var(--gray-500);
    font-size: 1.25rem;
}

/* Overall Summary Card */
.overall-summary-card {
    background: white;
    border: 2px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.15);
    padding: 1.5rem;
}

/* Add extra padding to internal rows */
.overall-summary-card .row {
    margin-left: 0;
    margin-right: 0;
}

.overall-header {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.overall-header .d-flex {
    gap: 1rem;
}

.overall-header i {
    color: white;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.overall-header h3 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill.overall {
    background: linear-gradient(90deg, var(--overall), #7C3AED);
}

.overall-daily {
    background: white;
    border: 2px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.overall-daily:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.weekly-requirement {
    background: white;
    border: 2px solid rgba(6, 182, 212, 0.3);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.1);
}

.weekly-requirement:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

.weekly-requirement i {
    color: var(--info);
    font-size: 1.5rem;
}

/* Daily Sales Section */
.daily-sales-section {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title i {
    color: var(--primary);
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    position: relative;
}

.daily-sales-table {
    width: 100%;
    margin: 0;
    white-space: nowrap; /* ป้องกันการตัดคำ */
}

.daily-sales-table thead {
    background: var(--gray-50);
}

.daily-sales-table thead th {
    padding: 1rem;
    font-weight: 700;
    color: var(--gray-700);
    text-align: right;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap; /* ป้องกันการตัดคำในหัวตาราง */
    min-width: 120px;
}

.daily-sales-table tbody td {
    padding: 1rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9375rem;
    text-align: right;
    min-width: 120px;
}

.daily-sales-table tbody tr:hover {
    background: var(--gray-50);
}

.daily-sales-table tbody tr:last-child td {
    border-bottom: none;
}

/* Sticky Columns - ตรึงคอลัมน์วันที่และสถานะ */
.daily-sales-table .sticky-col {
    position: sticky;
    background: var(--gray-50);
    z-index: 10;
}

.daily-sales-table thead .sticky-col {
    top: 0;
}

.daily-sales-table .date-col {
    left: 0;
    min-width: 120px;
    text-align: center;
}

.daily-sales-table .status-col {
    left: 120px;
    min-width: 150px;
    text-align: center;
}

.daily-sales-table tbody .sticky-col {
    background: white;
}

.daily-sales-table tbody tr:hover .sticky-col {
    background: var(--gray-50);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-excellent {
    background: rgba(139, 92, 246, 0.1);
    color: var(--modern-trade);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.status-good {
    background: var(--success-bg);
    color: var(--success-dark);
    border: 1px solid var(--success-light);
}

.status-fair {
    background: var(--warning-bg);
    color: var(--warning-dark);
    border: 1px solid var(--warning-light);
}

.status-poor {
    background: var(--danger-bg);
    color: var(--danger-dark);
    border: 1px solid var(--danger-light);
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid var(--gray-200);
    border-radius: 50%;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid var(--primary);
    border-radius: 50%;
    border-top-color: transparent;
    border-right-color: transparent;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.loading-subtext {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.loading-progress {
    margin-top: 1.5rem;
    width: 300px;
    max-width: 90%;
}

.loading-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.loading-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.loading-steps {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.loading-step.active {
    opacity: 1;
    color: var(--primary);
    font-weight: 600;
}

.loading-step.completed {
    opacity: 0.7;
    color: var(--success);
}

.loading-step i {
    width: 20px;
    text-align: center;
}

/* Responsive Design */

/* Desktop (min-width: 1181px) */
@media (min-width: 1181px) {
    .main-container {
        max-width: 1400px;
    }

    .daily-sales-section {
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -47.5vw;
        margin-right: -47.5vw;
        width: 95vw;
        max-width: 95vw;
    }
}

/* iPad & Tablet (768px - 1180px) - รองรับ iPad Air */
@media (max-width: 1180px) and (min-width: 768px) {
    /* Reduce font sizes significantly for tablets */
    body {
        font-size: 11px;
    }

    .page-title {
        font-size: 1rem;
    }

    .current-month {
        font-size: 0.875rem;
    }

    .days-passed-badge {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
    }

    /* Summary cards */
    .summary-card {
        padding: 0.75rem 1rem;
    }

    .summary-label {
        font-size: 0.625rem;
    }

    .summary-value {
        font-size: 1.25rem;
        word-break: break-word;
    }

    .channel-card-header {
        margin-bottom: 0.5rem;
    }

    .channel-card-header h3 {
        font-size: 0.875rem;
    }

    .channel-card-header i {
        font-size: 1rem;
        width: 28px;
        height: 28px;
    }

    .stat-label {
        font-size: 0.625rem;
        white-space: nowrap;
        margin-bottom: 0.25rem;
    }

    .stat-value {
        font-size: 0.75rem;
        word-break: break-word;
    }

    .stat-value.target-by-day {
        font-size: 0.75rem;
    }

    .stat-value.remaining {
        font-size: 0.75rem;
    }

    .daily-requirement {
        font-size: 0.625rem;
        padding: 0.375rem;
        margin-top: 0.5rem;
    }

    .daily-requirement-value {
        font-size: 0.875rem;
    }

    .status-summary {
        font-size: 0.625rem;
        padding: 0.375rem 0.5rem;
        margin-top: 0.5rem;
    }

    .progress-bar-custom {
        height: 18px;
        margin: 0.5rem 0;
    }

    .progress-label {
        font-size: 0.625rem;
    }

    /* Table */
    .daily-sales-table {
        font-size: 0.625rem;
    }

    .daily-sales-table thead th,
    .daily-sales-table tbody td {
        padding: 0.375rem 0.25rem;
        font-size: 0.625rem;
    }

    .status-badge {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
    }

    /* Goal stats - 2 columns for tablet */
    .goal-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.375rem;
    }

    /* Buttons */
    .btn-primary,
    .btn-outline-primary {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    .section-header .btn-primary {
        padding: 0.375rem 0.75rem;
    }

    .section-header {
        margin-bottom: 1rem;
    }

    /* Navbar */
    .navbar-modern {
        padding: 0.5rem 0;
    }

    .brand-name {
        font-size: 1rem;
    }

    .brand-tagline {
        font-size: 0.625rem;
    }
}

/* Tablet Portrait & Large Mobile */
@media (max-width: 992px) {
    .goal-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .goal-stats {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        display: none;
    }

    .nav-menu.active {
        display: flex;
    }

    .main-container {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .month-selector {
        margin-top: 1rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .goal-stats {
        grid-template-columns: 1fr;
    }

    .summary-value {
        font-size: 1.5rem;
    }

    .daily-sales-table {
        font-size: 0.8125rem;
    }

    .daily-sales-table thead th,
    .daily-sales-table tbody td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .brand-name {
        font-size: 1.25rem;
    }

    .brand-tagline {
        font-size: 0.75rem;
    }

    .summary-card {
        flex-direction: column;
        text-align: center;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .current-month {
        font-size: 1rem;
        min-width: 120px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.summary-card,
.channel-card,
.daily-sales-section {
    animation: fadeIn 0.6s ease;
}

/* Sub Cards Styles */
.sub-cards-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-100);
}

.sub-card-header {
    margin-bottom: 1rem;
}

.sub-card-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sub-card-header h5 i {
    color: var(--primary);
}

.sub-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.sub-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.sub-card:hover {
    background: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.sub-card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.sub-card-title span {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
}

.btn-sub-edit {
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.btn-sub-edit:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.sub-card-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.sub-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sub-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    font-weight: 500;
}

.sub-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
}

.sub-value.no-data {
    color: var(--gray-400);
    font-style: italic;
}

/* Responsive for sub-cards */
@media (max-width: 768px) {
    .sub-cards-grid {
        grid-template-columns: 1fr;
    }

    .sub-card-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1180px) and (min-width: 768px) {
    .sub-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sub-card-title span {
        font-size: 0.75rem;
    }

    .sub-label {
        font-size: 0.625rem;
    }

    .sub-value {
        font-size: 0.75rem;
    }
}

/* Notification Modal Styles */
.btn-notification-info {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.25rem;
}

.btn-notification-info:hover {
    background: white;
    color: var(--primary);
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-channel-info {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--gray-700);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-channel-info:hover {
    background: white;
    color: var(--primary);
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-light);
}

.notification-preview-container {
    background: #f8fafc;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    max-height: 400px;
    overflow-y: auto;
}

.notification-message-box {
    margin: 0;
    white-space: pre-wrap;
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--gray-800);
}

#notificationModal .modal-content {
    border-radius: 20px;
    overflow: hidden;
}

#notificationModal .modal-header {
    padding: 1.5rem;
}

#notificationModal .modal-footer {
    padding: 1.5rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal.show .modal-content {
    animation: fadeIn 0.4s ease-out;
}

/* Brand Breakdown Styles */
.brand-breakdown-mini {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 Fixed columns for alignment */
    column-gap: 20px; /* Increased horizontal gap for breathability */
    row-gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--gray-200);
    width: 100%;
    grid-column: 2 / 5;
    justify-items: start; /* Align to left of each cell */
    align-items: center;
}



.brand-item {
    display: flex;
    flex-direction: row; /* Match the preferred 'one-line' look */
    align-items: center;
    font-size: 0.7rem;
    color: var(--gray-600);
    padding: 2px 0;
    line-height: 1.2;
    gap: 4px;
    width: 100%;
}

.brand-name-tag {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    color: var(--gray-700);
}

.brand-name-tag i {
    font-size: 0.5rem;
}

.brand-value-tag {
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
}




/* Overall card brand breakdown should stay larger */
.overall-summary-card .brand-breakdown-mini {
    font-size: 0.9rem;
    gap: 8px;
}

.overall-summary-card .brand-item {
    font-size: 0.9rem;
}

.brand-kpf .brand-name-tag { color: var(--primary); }
.brand-tgs .brand-name-tag { color: var(--warning-dark); }
.brand-other .brand-name-tag { color: var(--gray-500); }


@media (max-width: 768px) {
    .brand-breakdown-mini {
        margin-top: 8px;
        padding-top: 8px;
    }
    .brand-item {
        font-size: 0.75rem;
    }
}
