@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;800&display=swap');

:root {
    /* Color Palette (HSL) */
    --bg-main: hsl(222, 25%, 10%);
    --bg-surface: hsla(223, 25%, 16%, 0.6);
    --bg-surface-hover: hsla(223, 25%, 22%, 0.8);
    --bg-surface-solid: hsl(223, 25%, 16%);
    --border-color: hsla(223, 25%, 30%, 0.4);
    --border-color-focus: hsla(196, 100%, 60%, 0.6);
    
    /* Brand & Accent Colors */
    --color-primary: hsl(196, 100%, 55%);
    --color-primary-glow: hsla(196, 100%, 55%, 0.25);
    --color-secondary: hsl(262, 83%, 65%);
    --color-success: hsl(142, 70%, 50%);
    --color-warning: hsl(38, 92%, 55%);
    --color-danger: hsl(350, 89%, 60%);
    
    /* Text Colors */
    --text-main: hsl(210, 40%, 98%);
    --text-muted: hsl(215, 20%, 65%);
    --text-inverse: hsl(222, 25%, 10%);
    
    /* Kanban Status Colors */
    --status-todo: hsl(215, 20%, 65%);
    --status-inprogress: hsl(196, 100%, 55%);
    --status-review: hsl(262, 83%, 65%);
    --status-done: hsl(142, 70%, 50%);
    
    /* Fonts & Radii */
    --font-family: 'Plus Jakarta Sans', 'Noto Sans Thai', sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Shadows & Blur */
    --glass-blur: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 48px 0 rgba(0, 0, 0, 0.5);
    --shadow-primary: 0 0 20px hsla(196, 100%, 55%, 0.3);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Glowing Background Blobs */
body::before, body::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

body::before {
    top: 10%;
    left: 15%;
    background-color: var(--color-primary);
}

body::after {
    bottom: 15%;
    right: 15%;
    background-color: var(--color-secondary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: hsla(223, 25%, 35%, 0.4);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: hsla(223, 25%, 45%, 0.6);
}

/* App Container Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100vh;
}

/* Header & Glass Panel */
.glass-header {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
    gap: 16px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    box-shadow: var(--shadow-primary);
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, hsl(215, 20%, 80%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Role Selector */
.role-selector-container {
    display: flex;
    align-items: center;
    background: hsla(223, 25%, 8%, 0.6);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: var(--radius-md);
    gap: 4px;
}

.role-btn {
    background: transparent;
    border: none;
    padding: 10px 18px;
    border-radius: calc(var(--radius-md) - 4px);
    color: var(--text-muted);
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-btn:hover {
    color: var(--text-main);
    background: hsla(223, 25%, 20%, 0.4);
}

.role-btn.active {
    color: var(--text-main);
    background: linear-gradient(135deg, var(--color-primary), hsl(200, 100%, 45%));
    box-shadow: var(--shadow-primary);
}

.role-btn.active.boss {
    background: linear-gradient(135deg, var(--color-secondary), hsl(262, 83%, 55%));
    box-shadow: 0 0 20px hsla(262, 83%, 65%, 0.3);
}

/* Dropdown styling inside header */
.member-select-wrapper {
    position: relative;
    display: none; /* Only show when Team Member role is active */
}

.member-select-wrapper.show {
    display: block;
}

.custom-select {
    background: hsla(223, 25%, 8%, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 36px 10px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.custom-select:focus {
    border-color: var(--border-color-focus);
    box-shadow: var(--shadow-primary);
}

.member-select-wrapper::after {
    content: '▼';
    font-size: 10px;
    color: var(--text-muted);
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Views (Boss View & Member View) */
.view-panel {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.view-panel.active {
    display: block;
}

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

/* ==========================================================================
   BOSS VIEW STYLES
   ========================================================================== */

/* Overview Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: hsla(223, 25%, 40%, 0.4);
}

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

.stat-icon.total { background: hsla(196, 100%, 55%, 0.15); color: var(--color-primary); }
.stat-icon.done { background: hsla(142, 70%, 50%, 0.15); color: var(--color-success); }
.stat-icon.pending { background: hsla(262, 83%, 65%, 0.15); color: var(--color-secondary); }
.stat-icon.overdue { background: hsla(350, 89%, 60%, 0.15); color: var(--color-danger); }

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

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 4px;
}

/* Dashboard Visual Section (Charts & Team Performance) */
.dashboard-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

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

.dashboard-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
}

/* Interactive controls */
.controls-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), hsl(200, 100%, 45%));
    border: none;
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: var(--shadow-primary);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px hsla(196, 100%, 55%, 0.5);
}

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

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper::before {
    content: '🔍';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
}

.search-input {
    background: hsla(223, 25%, 8%, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 16px 10px 38px;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    width: 240px;
    transition: var(--transition-fast);
}

.search-input:focus {
    border-color: var(--border-color-focus);
    width: 280px;
}

/* Task Table */
.table-responsive {
    overflow-x: auto;
}

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

.task-table th, .task-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.task-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-table tbody tr {
    transition: var(--transition-fast);
}

.task-table tbody tr:hover {
    background: hsla(223, 25%, 20%, 0.3);
}

.task-title-cell {
    font-weight: 600;
    color: var(--text-main);
}

.task-desc-cell {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    gap: 6px;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-todo {
    background: hsla(215, 20%, 65%, 0.15);
    color: var(--text-muted);
}
.badge-todo::before { background-color: var(--status-todo); }

.badge-inprogress {
    background: hsla(196, 100%, 55%, 0.15);
    color: var(--color-primary);
}
.badge-inprogress::before { background-color: var(--status-inprogress); }

.badge-review {
    background: hsla(262, 83%, 65%, 0.15);
    color: var(--color-secondary);
}
.badge-review::before { background-color: var(--status-review); }

.badge-done {
    background: hsla(142, 70%, 50%, 0.15);
    color: var(--color-success);
}
.badge-done::before { background-color: var(--status-done); }

.badge-overdue {
    background: hsla(350, 89%, 60%, 0.15);
    color: var(--color-danger);
    animation: pulse 2s infinite;
}
.badge-overdue::before { background-color: var(--color-danger); }

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

.assignee-avatar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

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

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    color: var(--text-main);
    background: hsla(223, 25%, 30%, 0.4);
    border-color: hsla(223, 25%, 45%, 0.6);
}

.btn-icon.edit:hover {
    color: var(--color-primary);
    border-color: var(--status-inprogress);
}

.btn-icon.delete:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* Team Performance Section */
.team-performance-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.member-performance-card {
    background: hsla(223, 25%, 8%, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.member-perf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.member-perf-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.member-perf-stats {
    font-size: 13px;
    color: var(--text-muted);
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: hsla(223, 25%, 8%, 0.8);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--color-secondary), var(--color-primary));
    border-radius: var(--radius-full);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   KANBAN BOARD VIEW STYLES (TEAM MEMBER)
   ========================================================================== */

.kanban-board-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.board-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.kanban-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    align-items: start;
}

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

.kanban-column {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 500px;
    max-height: 75vh;
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-fast);
}

.kanban-column.drag-over {
    border-color: var(--color-primary);
    background: hsla(223, 25%, 22%, 0.5);
}

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

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

.column-bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.kanban-column:nth-child(1) .column-bullet { background-color: var(--status-todo); }
.kanban-column:nth-child(2) .column-bullet { background-color: var(--status-inprogress); }
.kanban-column:nth-child(3) .column-bullet { background-color: var(--status-review); }
.kanban-column:nth-child(4) .column-bullet { background-color: var(--status-done); }

.column-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.column-count {
    background: hsla(223, 25%, 8%, 0.6);
    border: 1px solid var(--border-color);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    overflow-y: auto;
    padding: 2px;
}

/* Kanban Cards */
.kanban-card {
    background: hsla(223, 25%, 8%, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: grab;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.kanban-card.drag-origin {
    opacity: 0.4;
}

.kanban-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--status-todo);
}

.kanban-column:nth-child(1) .kanban-card::before { background: var(--status-todo); }
.kanban-column:nth-child(2) .kanban-card::before { background: var(--status-inprogress); }
.kanban-column:nth-child(3) .kanban-card::before { background: var(--status-review); }
.kanban-column:nth-child(4) .kanban-card::before { background: var(--status-done); }

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: hsla(223, 25%, 40%, 0.5);
    background: hsla(223, 25%, 10%, 0.5);
}

.kanban-card.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

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

.card-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid hsla(223, 25%, 25%, 0.4);
    padding-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.card-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-date.urgent {
    color: var(--color-warning);
}

.card-date.overdue {
    color: var(--color-danger);
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    position: absolute;
    top: 8px;
    right: 8px;
    background: hsla(223, 25%, 10%, 0.9);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.kanban-card:hover .card-actions {
    opacity: 1;
}

/* ==========================================================================
   MODAL DIALOG STYLES
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 11, 18, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-backdrop.show {
    display: flex;
    animation: fadeIn var(--transition-fast);
}

.modal-content {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp var(--transition-normal);
}

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

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    background: hsla(223, 25%, 8%, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 12px 14px;
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--border-color-focus);
    box-shadow: var(--shadow-primary);
}

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

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

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: hsla(223, 25%, 12%, 0.5);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    color: var(--text-main);
    background: hsla(223, 25%, 20%, 0.4);
    border-color: hsla(223, 25%, 35%, 0.6);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
}

.empty-state-icon {
    font-size: 48px;
    opacity: 0.6;
}

.empty-state-text {
    font-size: 14px;
}
