/* Design Tokens & Theme Variables */
:root {
    --bg-base: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --shadow-color: rgba(0, 0, 0, 0.4);
    
    --primary: #2dd4bf;       /* Teal 400 */
    --primary-glow: rgba(45, 212, 191, 0.15);
    --secondary: #818cf8;     /* Indigo 400 */
    --secondary-glow: rgba(129, 140, 248, 0.15);
    --accent: #ec4899;        /* Pink 500 */
    
    --color-todo: #94a3b8;
    --color-progress: #3b82f6;
    --color-review: #a855f7;
    --color-done: #10b981;
    --color-overdue: #ef4444;
}

/* Light Theme Variables */
html.light {
    --bg-base: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --border-color: rgba(15, 23, 42, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow-color: rgba(15, 23, 42, 0.08);
    
    --primary: #0d9488;       /* Teal 600 */
    --primary-glow: rgba(13, 148, 136, 0.1);
    --secondary: #4f46e5;     /* Indigo 600 */
    --secondary-glow: rgba(79, 70, 229, 0.1);
    --accent: #db2777;
    
    --color-todo: #64748b;
    --color-progress: #2563eb;
    --color-review: #7c3aed;
    --color-done: #059669;
    --color-overdue: #dc2626;
}

/* Reset & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Sarabun', sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

/* Background Glowing Orbs */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

html.light .bg-glow {
    opacity: 0.05;
}

.bg-glow-1 {
    top: -100px;
    left: -100px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.bg-glow-2 {
    bottom: -100px;
    right: -100px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
}

/* Glassmorphism System */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
}

/* Typography Helpers (Tailwind-like fallback class) */
.font-outfit { font-family: 'Outfit', 'Inter', sans-serif; }
.tracking-tight { tracking-spacing: -0.025em; }
.bg-clip-text { -webkit-background-clip: text; background-clip: text; }
.text-transparent { color: transparent; }
.bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-stops)); }
.from-teal-400 { --tw-gradient-from: #2dd4bf; --tw-gradient-to: rgba(45, 212, 191, 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); }
.to-indigo-400 { --tw-gradient-to: #818cf8; }

/* Grid & Layout Utilities */
.container { width: 100%; margin-left: auto; margin-right: auto; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.hidden { display: none !important; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.w-full { width: 100%; }

@media (min-width: 768px) {
    .md\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:flex-row { flex-direction: row; }
    .md\:w-auto { width: auto; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:col-span-2 { grid-column: span 2 / span 2; }
}

/* UI Elements */
.brand-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-glow);
    border: 1px solid rgba(45, 212, 191, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #14b8a6 100%);
    color: #0f172a;
    border-radius: 12px;
    padding: 0.625rem 1.25rem;
    box-shadow: 0 4px 14px 0 rgba(45, 212, 191, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px 0 rgba(45, 212, 191, 0.5);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.625rem 1.25rem;
}

.btn-secondary:hover {
    background: rgba(148, 163, 184, 0.18);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-radius: 12px;
    padding: 0.625rem 1.25rem;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.4);
    filter: brightness(1.1);
}

.btn-icon {
    width: 38px;
    height: 38px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.btn-icon:hover {
    background: rgba(148, 163, 184, 0.2);
    transform: scale(1.05);
}

/* Stat Cards */
.stat-card {
    padding: 1.25rem;
    border-radius: 18px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(30, 41, 59, 0.85);
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-indigo { background: rgba(129, 140, 248, 0.15); color: #818cf8; border: 1px solid rgba(129, 140, 248, 0.2); }
.badge-green { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.2); }
.badge-gray { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.2); }
.badge-rose { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Kanban System */
.kanban-column {
    border-radius: 16px;
    overflow: hidden;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.column-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Kanban Cards */
.kanban-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: grab;
    position: relative;
    user-select: none;
}

.kanban-card:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 10px 15px -3px var(--shadow-color);
    border-color: rgba(255, 255, 255, 0.15);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.4;
    border: 2px dashed var(--primary);
    transform: scale(0.96);
}

.column-cards.drag-over {
    background: rgba(45, 212, 191, 0.05);
    border: 2px dashed rgba(45, 212, 191, 0.25);
    border-radius: 12px;
}

/* Modals Overlay & Content */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Form Styling */
input, textarea, select {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    width: 100%;
    outline: none;
    transition: border-color 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
}

/* Animations */
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fa-spin-slow {
    animation: spin-slow 4s linear infinite;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Task Cards inside Kanban */
.task-notes-counter {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.action-btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.375rem;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}
