/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* CSS Variables for Themes */
:root {
    /* Dark Theme Default - Minimal Blue Slate */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent: #3b82f6;
    --accent-gradient: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-soft: rgba(59, 130, 246, 0.12);
    
    /* Global Card Shadow & Rounded */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: none;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* Common Status Colors */
    --clr-pending: #64748b;
    --clr-pending-bg: rgba(100, 116, 139, 0.15);
    --clr-progress: #3b82f6;
    --clr-progress-bg: rgba(59, 130, 246, 0.15);
    --clr-completed: #10b981;
    --clr-completed-bg: rgba(16, 185, 129, 0.15);
    --clr-overdue: #ef4444;
    --clr-overdue-bg: rgba(239, 68, 68, 0.15);
    --clr-today: #ec4899;
    --clr-today-bg: rgba(236, 72, 153, 0.15);
    
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --sidebar-width: 260px;
    --transition-speed: 0.2s;
}

body.light-theme {
    /* Light Theme - Minimal Blue Slate */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent: #2563eb;
    --accent-gradient: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.08);
    
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-glow: none;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Main Layout */
.app-container {
    display: flex;
    width: 100%;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-speed), background-color var(--transition-speed);
}

.logo-section {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 20px;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    padding: 24px 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-size: 15px;
}

.nav-item a svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: stroke 0.2s ease;
}

.nav-item.active a {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.nav-item a:hover:not(.active) {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Theme Toggle Button next to logo */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.theme-toggle-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

.theme-toggle-btn .sun-icon {
    display: none;
}

body.light-theme .theme-toggle-btn .moon-icon {
    display: none;
}

body.light-theme .theme-toggle-btn .sun-icon {
    display: block;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 32px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 32px;
    transition: margin-left var(--transition-speed);
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.page-title-area h1 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-title-area p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* Filter Badge Count styling */
.filter-count-badge {
    font-size: 14px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background-color: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s, background-color var(--transition-speed);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

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

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-icon-wrapper svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
}

/* Colors for Stat Cards Icon Backgrounds */
.total-card .stat-icon-wrapper { background: var(--accent-soft); color: var(--accent); }
.pending-card .stat-icon-wrapper { background: var(--clr-pending-bg); color: var(--clr-pending); }
.progress-card .stat-icon-wrapper { background: var(--clr-progress-bg); color: var(--clr-progress); }
.completed-card .stat-icon-wrapper { background: var(--clr-completed-bg); color: var(--clr-completed); }
.overdue-card .stat-icon-wrapper { background: var(--clr-overdue-bg); color: var(--clr-overdue); }

/* Dashboard Analytics Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

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

.chart-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 340px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s, background-color var(--transition-speed);
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.chart-card h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-container {
    position: relative;
    flex-grow: 1;
    width: 100%;
    height: 100%;
    min-height: 250px;
}

/* Dashboard Pages Container */
.page-container {
    display: none;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.4s ease;
}

.page-container.active {
    display: flex;
}

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

/* Action Filters Bar */
/* Action Filters Bar */
.filter-action-bar {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex: 1 1 640px;
    align-items: center;
}

.filter-actions-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
}

.filter-input-wrapper {
    position: relative;
    flex: 1 1 180px;
    min-width: 160px;
}

.filter-input-wrapper.filter-search-wrapper {
    flex: 2 1 240px;
    min-width: 200px;
}

.filter-input-wrapper.filter-select-wrapper {
    flex: 1 1 160px;
    min-width: 150px;
}

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

.form-control {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 9px 14px;
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-body);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-input-wrapper .form-control,
.filter-input-wrapper .filter-input {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 9px 14px 9px 38px;
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-body);
}

.filter-input-wrapper.filter-select-wrapper .form-control {
    padding: 9px 14px;
}

.filter-input-wrapper .filter-input:focus,
.filter-input-wrapper .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Date Range Filter Group */
.date-range-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    flex: 1 1 auto;
    min-width: 250px;
}

.date-range-group span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.date-range-group input[type="date"] {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    font-family: var(--font-body);
}

@media (max-width: 992px) {
    .filter-action-bar {
        padding: 14px;
        gap: 12px;
    }
    .filter-group {
        flex: 1 1 100%;
        gap: 10px;
    }
    .filter-actions-group {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 576px) {
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-input-wrapper,
    .filter-input-wrapper.filter-search-wrapper,
    .filter-input-wrapper.filter-select-wrapper,
    .date-range-group {
        width: 100%;
        min-width: 100%;
    }
    .date-range-group {
        justify-content: space-between;
    }
}

/* Buttons Styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: var(--font-body);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-danger {
    background-color: var(--clr-overdue-bg);
    color: var(--clr-overdue);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: var(--clr-overdue);
    color: white;
}

.btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.clear-btn {
    padding: 10px 12px;
}

/* Card Wrapper for Tables */
.table-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.table-responsive,
.table-wrapper {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar,
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track,
.table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb,
.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.active-today-filter {
    background: var(--accent-gradient) !important;
    color: white !important;
    border-color: var(--accent) !important;
    box-shadow: var(--shadow-glow) !important;
    font-weight: 700 !important;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.custom-table th {
    background-color: rgba(0, 0, 0, 0.08);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    user-select: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.2s;
}

.custom-table th:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.custom-table th .sort-icon {
    display: inline-flex;
    margin-left: 4px;
    vertical-align: middle;
}

.custom-table th .sort-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
}

.custom-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: background-color 0.15s ease;
}

.custom-table tbody tr:hover {
    background-color: var(--bg-hover);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.badge-pending {
    background-color: var(--clr-pending-bg);
    color: var(--clr-pending);
}

.badge-progress {
    background-color: var(--clr-progress-bg);
    color: var(--clr-progress);
}

.badge-completed {
    background-color: var(--clr-completed-bg);
    color: var(--clr-completed);
}

.badge-overdue {
    background-color: var(--clr-overdue-bg);
    color: var(--clr-overdue);
    animation: pulseGlow 2s infinite;
}

.badge-today {
    background-color: var(--clr-today-bg);
    color: var(--clr-today);
}

@keyframes pulseGlow {
    0% { opacity: 0.9; }
    50% { opacity: 0.6; }
    100% { opacity: 0.9; }
}

/* Actions Column Buttons */
.table-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.action-btn-remark {
    position: relative;
}

.action-btn-remark:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.remark-highlight {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
    animation: pulseGlow 1.8s infinite;
}

.remark-pulse-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--bg-secondary);
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.action-btn-edit:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.action-btn-delete:hover {
    border-color: var(--clr-overdue);
    color: var(--clr-overdue);
}

.action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Table Footer / Pagination */
.table-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

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

.pagination-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.pagination-pages {
    display: flex;
    gap: 4px;
}

.page-num {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.page-num.active {
    background-color: var(--accent);
    color: white;
    font-weight: 600;
}

.page-num:hover:not(.active) {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Master Data Page Grid Layout */
.master-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 32px;
}

.master-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--shadow-sm);
}

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

.master-card-header h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.master-add-form {
    display: flex;
    gap: 12px;
}

/* Modal Popup Window */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 550px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.modal-close-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.modal-close-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: rgba(0, 0, 0, 0.08);
}

/* Modal Form Fields */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group-full {
    grid-column: span 2;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

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

/* Page Footer styling */
.page-footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 12px;
}

.page-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.page-footer a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1010;
}

.toast {
    min-width: 300px;
    max-width: 400px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.3s, transform 0.3s;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.toast-success {
    border-left-color: var(--clr-completed);
}

.toast.toast-error {
    border-left-color: var(--clr-overdue);
}

.toast.toast-warning {
    border-left-color: var(--clr-progress);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.toast-success .toast-icon { color: var(--clr-completed); }
.toast-error .toast-icon { color: var(--clr-overdue); }
.toast-warning .toast-icon { color: var(--clr-progress); }

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
}

.toast-message {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Empty, Loading, and Error States */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.empty-state-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state-desc {
    font-size: 13px;
    max-width: 300px;
}

/* Loading Skeletons */
.skeleton-loader {
    animation: skeletonPulse 1.5s ease-in-out infinite;
    background-color: var(--bg-hover);
    border-radius: var(--radius-sm);
    height: 18px;
    width: 100%;
}

@keyframes skeletonPulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

.skeleton-row td {
    padding: 16px 20px;
}

/* Responsive Rules */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .sidebar-toggle-btn {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .filter-action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
    }
    
    .filter-input-wrapper, .form-control {
        width: 100%;
    }
    
    .date-range-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group-full {
        grid-column: span 1;
    }
    
    .master-grid {
        grid-template-columns: 1fr;
    }
}

/* Hamburger Sidebar Toggle for Mobile */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

/* Alerts and Status Info Panels */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.5;
    transition: all var(--transition-speed) ease;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.12);
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: var(--clr-completed);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.12);
    color: var(--clr-overdue);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Validation row highlights */
.row-brand-exists {
    background-color: rgba(16, 185, 129, 0.08) !important;
}
.row-brand-exists:hover {
    background-color: rgba(16, 185, 129, 0.12) !important;
}
.row-brand-exists td {
    color: #047857 !important;
    font-weight: 500;
}
body.dark-theme .row-brand-exists {
    background-color: rgba(16, 185, 129, 0.15) !important;
}
body.dark-theme .row-brand-exists td {
    color: #34d399 !important;
}

.row-brand-new {
    background-color: rgba(239, 68, 68, 0.08) !important;
}
.row-brand-new:hover {
    background-color: rgba(239, 68, 68, 0.12) !important;
}
.row-brand-new td {
    color: #b91c1c !important;
    font-weight: 500;
}
body.dark-theme .row-brand-new {
    background-color: rgba(239, 68, 68, 0.15) !important;
}
body.dark-theme .row-brand-new td {
    color: #fca5a5 !important;
}

.today-validation-actions {
    display: flex;
    gap: 8px;
}
.today-validation-actions .btn-add-val {
    background-color: #10b981;
    color: white;
    padding: 4px 8px;
    font-size: 11px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.today-validation-actions .btn-add-val:hover {
    background-color: #059669;
}
.today-validation-actions .btn-exclude-val {
    background-color: #ef4444;
    color: white;
    padding: 4px 8px;
    font-size: 11px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.today-validation-actions .btn-exclude-val:hover {
    background-color: #dc2626;
}

.badge-similar-brand {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    background-color: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.3);
    margin-right: 4px;
    margin-bottom: 2px;
}

body.dark-theme .badge-similar-brand {
    background-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.45);
}
