/* ==========================================================================
   CSS DESIGN SYSTEM - TEXTILE PLANNING & KANBAN DASHBOARD
   ========================================================================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Theme Variables - Dark Mode (Default) */
    --bg-primary: #090d16;
    --bg-secondary: rgba(17, 24, 39, 0.65);
    --bg-sidebar: #060910;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.4);
    --shadow-glow: rgba(59, 130, 246, 0.15);
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 16px;
    
    /* Common UI Gradients & Brand Colors */
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --primary-hover: #2563eb;
    --accent-blue: #3b82f6;
    
    /* Department Custom Colors (Textile) */
    /* 👕 Raw Fabric (เตรียมผ้าดิบ) - Warm Gold/Beige */
    --dept-raw-primary: #d97706;
    --dept-raw-gradient: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    --dept-raw-bg: rgba(217, 119, 6, 0.12);
    --dept-raw-border: rgba(217, 119, 6, 0.3);
    
    /* 🎨 Fabric Dyeing (ย้อมผ้า) - Deep Royal Blue/Indigo */
    --dept-dye-primary: #3b82f6;
    --dept-dye-gradient: linear-gradient(135deg, #60a5fa 0%, #1d4ed8 100%);
    --dept-dye-bg: rgba(37, 99, 235, 0.12);
    --dept-dye-border: rgba(37, 99, 235, 0.3);
    
    /* 🌡️ Fabric Drying (อบผ้า) - Warm Coral/Terracotta */
    --dept-dry-primary: #ea580c;
    --dept-dry-gradient: linear-gradient(135deg, #ff7e40 0%, #c2410c 100%);
    --dept-dry-bg: rgba(234, 88, 12, 0.12);
    --dept-dry-border: rgba(234, 88, 12, 0.3);

    /* Task Status Colors */
    --color-todo: #6b7280;
    --color-todo-bg: rgba(107, 114, 128, 0.15);
    --color-todo-border: rgba(107, 114, 128, 0.3);
    
    --color-progress: #0ea5e9;
    --color-progress-bg: rgba(14, 165, 233, 0.15);
    --color-progress-border: rgba(14, 165, 233, 0.3);
    
    --color-review: #a855f7;
    --color-review-bg: rgba(168, 85, 247, 0.15);
    --color-review-border: rgba(168, 85, 247, 0.3);
    
    --color-done: #10b981;
    --color-done-bg: rgba(16, 185, 129, 0.15);
    --color-done-border: rgba(16, 185, 129, 0.3);
    
    /* Priority Colors */
    --priority-high: #ef4444;
    --priority-high-bg: rgba(239, 68, 68, 0.12);
    --priority-medium: #eab308;
    --priority-medium-bg: rgba(234, 179, 8, 0.12);
    --priority-low: #10b981;
    --priority-low-bg: rgba(16, 185, 129, 0.12);

    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Override */
[data-theme="light"] {
    --bg-primary: #f3f4f6;
    --bg-secondary: rgba(255, 255, 255, 0.85);
    --bg-sidebar: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.06);
    --shadow-glow: rgba(59, 130, 246, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
    
    /* Light Mode Status Overrides for better contrast */
    --color-todo: #4b5563;
    --color-todo-bg: rgba(75, 85, 99, 0.1);
    --color-todo-border: rgba(75, 85, 99, 0.2);
    
    --color-progress: #0284c7;
    --color-progress-bg: rgba(2, 132, 199, 0.1);
    --color-progress-border: rgba(2, 132, 199, 0.2);
    
    --color-review: #7e22ce;
    --color-review-bg: rgba(126, 34, 206, 0.1);
    --color-review-border: rgba(126, 34, 206, 0.2);
    
    --color-done: #047857;
    --color-done-bg: rgba(4, 120, 87, 0.1);
    --color-done-border: rgba(4, 120, 87, 0.2);
}

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

body {
    font-family: 'Plus Jakarta Sans', 'Noto Sans Thai', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================================================
   APP CONTAINER & SIDEBAR LAYOUT
   ========================================================================== */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
    position: relative;
}

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

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

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 10px var(--shadow-glow);
}

.logo-text h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #3b82f6, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.menu-category {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 16px 0 8px 12px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-item:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--glass-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.nav-item .icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
}

.nav-item.active .icon {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Sidebar Footer & Theme Toggle */
.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    width: 100%;
    border-radius: var(--border-radius-md);
    background-color: var(--border-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
    background-color: var(--text-muted);
    color: #ffffff;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    min-height: 100vh;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    transition: margin 0.3s ease;
}

/* View Header */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.view-title h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

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

.view-actions {
    display: flex;
    gap: 12px;
}

/* Content Views Router */
.content-view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.content-view.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

/* ==========================================================================
   DASHBOARD COMPONENTS & GLASS CARDS
   ========================================================================== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: 0 8px 32px 0 var(--shadow-color);
}

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

.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-radius: var(--border-radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-glow);
}

.stat-info h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.stat-info .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.total {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}
.stat-icon.todo {
    background: rgba(107, 114, 128, 0.12);
    color: var(--color-todo);
}
.stat-icon.progress {
    background: rgba(14, 165, 233, 0.12);
    color: var(--color-progress);
}
.stat-icon.review {
    background: rgba(168, 85, 247, 0.12);
    color: var(--color-review);
}
.stat-icon.done {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-done);
}

/* ==========================================================================
   LEADER OVERVIEW PAGE
   ========================================================================== */
.leader-dashboard-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 1200px) {
    .leader-dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Department Circular Progress Chart Widget */
.progress-widgets {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.progress-widget-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
}

/* SVG Circular Progress Ring */
.progress-ring-container {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-circle-bg {
    fill: transparent;
    stroke: var(--border-color);
    stroke-width: 8;
}

.progress-ring-circle {
    fill: transparent;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    position: absolute;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.progress-widget-info {
    flex-grow: 1;
}

.progress-widget-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.progress-widget-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Global Progress bar */
.global-progress-container {
    margin-bottom: 24px;
}

.global-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.global-progress-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.global-progress-percentage {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-blue);
}

.global-progress-bar-bg {
    width: 100%;
    height: 10px;
    background-color: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.global-progress-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    border-radius: 5px;
    transition: width 0.8s ease-in-out;
}

/* Deadline Alerts (Critical Warning) */
.alert-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.warning-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 8px #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.5; }
}

.alert-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border-radius: var(--border-radius-md);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    animation: slideIn 0.3s ease-out;
}

.alert-badge {
    background: #ef4444;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.alert-details {
    flex-grow: 1;
}

.alert-details h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.alert-details p {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Master Table Styling */
.table-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.search-wrapper {
    position: relative;
    min-width: 250px;
    flex-grow: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    outline: none;
    font-size: 14px;
    transition: var(--transition-smooth);
}

.search-input:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 10px var(--shadow-glow);
}

.search-wrapper .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-wrapper {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.custom-select {
    padding: 10px 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-sidebar);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.custom-select:focus {
    border-color: var(--accent-blue);
}

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

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

.master-table th {
    padding: 16px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.master-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
}

.master-table tbody tr {
    transition: var(--transition-smooth);
}

.master-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   PLANNING & ALLOCATION PAGE
   ========================================================================== */
.planning-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
}

@media (max-width: 992px) {
    .planning-layout {
        grid-template-columns: 1fr;
    }
}

.task-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.task-form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition-smooth);
}

.task-form-control:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
}

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

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

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: #ffffff;
    font-weight: 600;
    padding: 12px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

/* Allocation List Card Row */
.alloc-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.allocation-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

.allocation-card:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(3px);
}

.allocation-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alloc-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.alloc-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.allocation-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition-smooth);
}

.btn-icon.edit {
    color: #eab308;
}
.btn-icon.edit:hover {
    background: rgba(234, 179, 8, 0.1);
    border-color: #eab308;
}
.btn-icon.delete {
    color: #ef4444;
}
.btn-icon.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

/* ==========================================================================
   KANBAN BOARDS PAGE (DEPARTMENT-SPECIFIC)
   ========================================================================== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: start;
    flex-grow: 1;
}

@media (max-width: 1100px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}

.kanban-column {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 500px;
    transition: var(--transition-smooth);
}

[data-theme="light"] .kanban-column {
    background: rgba(0, 0, 0, 0.02);
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.column-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-count-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

/* Specific Column Header Colors */
.todo-col {
    border-bottom-color: var(--color-todo);
    color: var(--text-primary);
}
.todo-col .task-count-badge {
    background-color: var(--color-todo-bg);
    color: var(--color-todo);
}

.progress-col {
    border-bottom-color: var(--color-progress);
    color: var(--text-primary);
}
.progress-col .task-count-badge {
    background-color: var(--color-progress-bg);
    color: var(--color-progress);
}

.review-col {
    border-bottom-color: var(--color-review);
    color: var(--text-primary);
}
.review-col .task-count-badge {
    background-color: var(--color-review-bg);
    color: var(--color-review);
}

.done-col {
    border-bottom-color: var(--color-done);
    color: var(--text-primary);
}
.done-col .task-count-badge {
    background-color: var(--color-done-bg);
    color: var(--color-done);
}

/* Kanban Column Cards Container */
.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 400px;
}

/* Task Card Styling */
.task-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 10px var(--shadow-color);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.task-card:hover {
    transform: translateY(-2px);
    border-color: var(--text-muted);
    box-shadow: 0 8px 20px var(--shadow-color);
}

/* Color Accent Bars (Top edge of card depending on Department) */
.task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.task-card.dept-raw::before {
    background: var(--dept-raw-gradient);
}
.task-card.dept-dye::before {
    background: var(--dept-dye-gradient);
}
.task-card.dept-dry::before {
    background: var(--dept-dry-gradient);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.task-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.priority-tag {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.priority-tag.high {
    background: var(--priority-high-bg);
    color: var(--priority-high);
}
.priority-tag.medium {
    background: var(--priority-medium-bg);
    color: var(--priority-medium);
}
.priority-tag.low {
    background: var(--priority-low-bg);
    color: var(--priority-low);
}

.task-card-body {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

.task-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-top: 4px;
    font-size: 11px;
}

.task-assignee {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.avatar-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
}

.task-date {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
}

.task-date.urgent {
    color: var(--priority-high);
    animation: flashAlert 2s infinite;
    font-weight: 600;
}

@keyframes flashAlert {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ==========================================================================
   QUICK MOVE MENU (MOBILE & ACCESSIBILITY)
   ========================================================================== */
.quick-move-wrapper {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.quick-move-btn {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 4px;
}

.quick-move-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.quick-move-btn.next {
    background: var(--color-progress-bg);
    color: var(--color-progress);
    border-color: var(--color-progress-border);
}
.quick-move-btn.next:hover {
    background: var(--color-progress);
    color: #ffffff;
}

/* ==========================================================================
   BADGES & UI LABELS
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge.dept-raw {
    background-color: var(--dept-raw-bg);
    color: var(--dept-raw-primary);
    border: 1px solid var(--dept-raw-border);
}
.badge.dept-dye {
    background-color: var(--dept-dye-bg);
    color: var(--dept-dye-primary);
    border: 1px solid var(--dept-dye-border);
}
.badge.dept-dry {
    background-color: var(--dept-dry-bg);
    color: var(--dept-dry-primary);
    border: 1px solid var(--dept-dry-border);
}

.badge.status-todo {
    background-color: var(--color-todo-bg);
    color: var(--color-todo);
    border: 1px solid var(--color-todo-border);
}
.badge.status-progress {
    background-color: var(--color-progress-bg);
    color: var(--color-progress);
    border: 1px solid var(--color-progress-border);
}
.badge.status-review {
    background-color: var(--color-review-bg);
    color: var(--color-review);
    border: 1px solid var(--color-review-border);
}
.badge.status-done {
    background-color: var(--color-done-bg);
    color: var(--color-done);
    border: 1px solid var(--color-done-border);
}

/* ==========================================================================
   MODAL COMPONENT (TASK DETAILS & EDIT)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.modal-window {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-window {
    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: var(--bg-sidebar);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
}

.modal-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-meta-item .meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.modal-meta-item .meta-value {
    font-size: 13px;
    font-weight: 600;
}

.modal-desc-section h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.modal-desc-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-line;
}

/* Comments/Activity Section */
.modal-comments-section {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.modal-comments-section h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding-right: 6px;
}

.comment-item {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

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

.comment-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 4px;
}

.comment-user {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-time {
    color: var(--text-muted);
}

.comment-text {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.comment-input-wrapper {
    display: flex;
    gap: 10px;
}

.comment-input {
    flex-grow: 1;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.comment-input:focus {
    border-color: var(--accent-blue);
}

.btn-secondary {
    background: var(--border-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    padding: 10px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition-smooth);
}

.btn-secondary:hover {
    background: var(--text-muted);
    color: #ffffff;
}

/* ==========================================================================
   TOAST SYSTEM (NOTIFICATIONS)
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 300;
}

.toast {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    min-width: 250px;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.toast.warning {
    border-left: 4px solid #eab308;
}

/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS
   ========================================================================== */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
    }
    
    .sidebar-header {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
        gap: 8px;
    }
    
    .nav-item {
        padding: 8px 12px;
        white-space: nowrap;
    }
    
    .menu-category {
        display: none;
    }
    
    .sidebar-footer {
        flex-direction: row;
        border-top: none;
        padding-top: 0;
        margin-top: 8px;
        justify-content: flex-end;
    }
    
    .theme-toggle-btn {
        width: auto;
        padding: 8px 16px;
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
}

/* ==========================================================================
   DEPARTMENT SUMMARY WIDGETS (Header of Kanban Boards)
   ========================================================================== */
.dept-summary-widget {
    display: grid;
    grid-template-columns: 1fr 2.2fr;
    gap: 32px;
    padding: 24px;
    margin-bottom: 24px;
    align-items: center;
    border-radius: var(--border-radius-lg);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
}

.dept-summary-left {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-right: 32px;
    border-right: 1px solid var(--border-color);
}

.dept-summary-text h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dept-summary-text p {
    font-size: 12px;
    color: var(--text-secondary);
}

.dept-summary-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.status-bar-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.status-bar-track {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.status-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-bar-fill.todo {
    background-color: var(--color-todo);
    box-shadow: 0 0 8px var(--color-todo-border);
}

.status-bar-fill.progress {
    background-color: var(--color-progress);
    box-shadow: 0 0 8px var(--color-progress-border);
}

.status-bar-fill.done {
    background-color: var(--color-done);
    box-shadow: 0 0 8px var(--color-done-border);
}

@media (max-width: 900px) {
    .dept-summary-widget {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .dept-summary-left {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 16px;
    }
}

