/* ETM — Essential Task Manager | Blue Theme */

:root {
    /* Blue palette */
    --bg-deep: #070d1a;
    --bg-primary: #0b1528;
    --bg-secondary: #111d35;
    --bg-card: #162544;
    --bg-card-hover: #1a2d52;
    --bg-input: #0e1a30;
    --bg-overlay: rgba(7, 13, 26, 0.85);

    /* Accent blues */
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-dark: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --accent-border: rgba(59, 130, 246, 0.25);

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #8fa3bf;
    --text-muted: #546a8a;
    --text-inverse: #070d1a;

    /* Borders */
    --border: #1e3050;
    --border-light: #253d5e;
    --border-focus: #3b82f6;

    /* Status colors */
    --status-new: #94a3b8;
    --status-progress: #3b82f6;
    --status-blocked: #ef4444;
    --status-completed: #22c55e;
    --status-cancelled: #6b7280;

    /* Priority colors */
    --priority-urgent: #ef4444;
    --priority-high: #f97316;
    --priority-medium: #eab308;
    --priority-low: #3b82f6;
    --priority-none: #6b7280;

    /* Sizing */
    --sidebar-width: 240px;
    --header-height: 56px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 6px;

    /* Transitions */
    --transition: 200ms ease;
}

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

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    background: none;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    outline: none;
    transition: border-color var(--transition);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238fa3bf' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ========== LAYOUT ========== */

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 20;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--header-height);
}

.sidebar-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.nav-section {
    margin-bottom: 16px;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition);
    width: 100%;
    text-align: left;
}

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

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent-light);
    border: 1px solid var(--accent-border);
}

.nav-item .icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--accent-dark);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Project list in sidebar */
.project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    text-align: left;
}

.project-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.project-item.active { color: var(--accent-light); background: var(--accent-glow); }

.project-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--text-muted); text-transform: capitalize; }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Header */
.main-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    flex-shrink: 0;
    background: var(--bg-primary);
}

.hamburger {
    display: none;
    font-size: 1.3rem;
    padding: 4px;
    color: var(--text-secondary);
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Search */
.search-box {
    position: relative;
    width: 220px;
}

.search-box input {
    width: 100%;
    padding-left: 32px;
    background: var(--bg-secondary);
    border-color: transparent;
}

.search-box input:focus { border-color: var(--border-focus); }

.search-box .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Notification bell */
.notification-btn {
    position: relative;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

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

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: var(--priority-urgent);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-badge.hidden { display: none; }

/* View area */
.view-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ========== BUTTONS ========== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.85rem;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-card); border-color: var(--border-light); }

.btn-ghost {
    color: var(--text-secondary);
    padding: 6px 10px;
}
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text-primary); }

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-icon { padding: 6px; width: 32px; height: 32px; justify-content: center; }

/* ========== MODALS ========== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform var(--transition);
}

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

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

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    font-size: 1.2rem;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg-card); color: var(--text-primary); }

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========== FORMS ========== */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

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

.form-row > * { flex: 1; }

/* ========== TASK DETAIL SLIDE PANEL ========== */

.task-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 520px;
    max-width: 100%;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 90;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 250ms ease;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
}

.task-panel.open { transform: translateX(0); }

.task-panel-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
    flex-shrink: 0;
}

.task-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.task-panel-section {
    margin-bottom: 20px;
}

.task-panel-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-title-input {
    font-size: 1.2rem;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    padding: 4px 0;
}

.task-title-input:focus {
    outline: none;
    box-shadow: none;
}

.task-meta-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px;
    align-items: center;
}

.task-meta-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.task-description-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    color: var(--text-primary);
    min-height: 80px;
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge[data-status="New"] { background: rgba(148,163,184,0.15); color: var(--status-new); }
.status-badge[data-status="In Progress"] { background: rgba(59,130,246,0.15); color: var(--status-progress); }
.status-badge[data-status="Blocked"] { background: rgba(239,68,68,0.15); color: var(--status-blocked); }
.status-badge[data-status="Completed"] { background: rgba(34,197,94,0.15); color: var(--status-completed); }
.status-badge[data-status="Cancelled"] { background: rgba(107,114,128,0.15); color: var(--status-cancelled); }

/* Priority badge */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.priority-dot[data-priority="urgent"] { background: var(--priority-urgent); }
.priority-dot[data-priority="high"] { background: var(--priority-high); }
.priority-dot[data-priority="medium"] { background: var(--priority-medium); }
.priority-dot[data-priority="low"] { background: var(--priority-low); }
.priority-dot[data-priority="none"] { background: var(--priority-none); }

/* Progress bar */
.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width var(--transition);
}

/* Checklist */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.checklist-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checklist-item.checked .checklist-item-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checklist-item-text {
    flex: 1;
    font-size: 0.85rem;
}

.checklist-item-due {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Subtask row */
.subtask-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.subtask-status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    flex-shrink: 0;
    cursor: pointer;
}

.subtask-status-dot.completed {
    background: var(--status-completed);
    border-color: var(--status-completed);
}

.subtask-title {
    flex: 1;
    font-size: 0.85rem;
}

.subtask-due {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Comments */
.comment-item {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.comment-body { flex: 1; }
.comment-meta { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 2px; }
.comment-text { font-size: 0.85rem; color: var(--text-primary); }

.comment-input-area {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.comment-input-area input {
    flex: 1;
}

/* Activity / History */
.history-item {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-item strong {
    color: var(--text-secondary);
}

/* ========== NOTIFICATION DROPDOWN ========== */

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 50;
    display: none;
}

.notification-dropdown.open { display: block; }

.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.85rem;
}

.notification-item {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}

.notification-item:hover { background: var(--bg-card); }
.notification-item.unread { background: var(--accent-glow); }
.notification-item .notif-text { flex: 1; }
.notification-item .notif-title { font-size: 0.8rem; font-weight: 600; }
.notification-item .notif-message { font-size: 0.75rem; color: var(--text-muted); }
.notification-item .notif-time { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; }

/* ========== TOAST ========== */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.85rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: toastIn 300ms ease;
    max-width: 350px;
}

.toast.success { border-left: 3px solid var(--status-completed); }
.toast.error { border-left: 3px solid var(--priority-urgent); }
.toast.info { border-left: 3px solid var(--accent); }

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

/* ========== EMPTY STATE ========== */

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

.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state-text { font-size: 0.85rem; }

/* ========== LOADING ========== */

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay);
    z-index: 10;
}

/* ========== LOGIN PAGE ========== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
    padding: 20px;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-form .form-group { margin-bottom: 16px; }

.login-form input {
    width: 100%;
    padding: 10px 14px;
}

.login-form .btn {
    width: 100%;
    padding: 10px;
    justify-content: center;
    font-size: 0.9rem;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #ef4444;
    margin-bottom: 16px;
    display: none;
}

.login-error.visible { display: block; }

.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.login-tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-input);
    transition: all var(--transition);
}

.login-tab.active {
    background: var(--accent);
    color: #fff;
}

/* ========== UTILITIES ========== */

.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.font-semibold { font-weight: 600; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
