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

:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-green: #4ade80;
    --accent-orange: #fb923c;
    --status-new: #38bdf8;
    --status-wip: #fb923c;
    --status-complete: #4ade80;
    --bg-deep: #020617;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 100%);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding: 2rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-blue);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

input, select, textarea {
    background-color: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.6rem 0.8rem;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* Force dark backdrop for browser-native dropdown menus */
option {
    background-color: #1e293b;
    color: white;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

.modal-lg {
    max-width: 1200px !important;
    width: 95% !important;
}

.modal-xl {
    max-width: 1600px !important;
    width: 98% !important;
}

.settings-list {
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: auto;
    margin: 1rem 0;
    padding-right: 1rem;
    padding-bottom: 1rem;
}

/* Custom Scrollbar for Settings */
.settings-list::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.settings-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.settings-list::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

.settings-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

.settings-list table {
    width: 100%;
    min-width: 900px; /* Force wide layout to prevent squashed columns */
    border-collapse: collapse;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}
.settings-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

.settings-list table {
    width: 100%;
    min-width: 500px; /* Ensure table doesn't squash */
    border-collapse: collapse;
}

.settings-list th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.settings-list td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-list input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 0.4rem;
}

.new-entry-row {
    background: rgba(56, 189, 248, 0.05);
}

header {
    margin-bottom: 3rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to bottom right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Project Card */
.project-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    animation: fadeIn 0.5s ease-out backwards;
}

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

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.project-title h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(8px);
    padding: 1.25rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.search-container {
    flex: 2; /* Take more space */
    min-width: 300px;
}

.search-container input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.85rem 1.25rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

.search-container input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.15), inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

.btn-primary {
    white-space: nowrap;
}

.filter-container {
    min-width: 200px;
}

.filter-container select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    color: white;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-container select option,
select option {
    background-color: #1e293b; /* Solid dark color for browser dropdown menu */
    color: white;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-new {
    background: #facc15; /* Yellow */
    color: #000;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.badge-work-in-progress {
    background: #f97316; /* Orange */
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-complete {
    background: var(--accent-green);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Task Tree */
.task-tree {
    margin-top: 1rem;
}

.task-item {
    margin-bottom: 1rem;
    position: relative;
    padding-left: 1.5rem;
}

.task-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.task-content:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.task-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.task-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1.5rem;
}

.owner-tag {
    color: var(--accent-blue);
}

/* Subtasks */
.subtasks {
    margin-top: 1rem;
    margin-left: 1.5rem;
    border-left: 1px dashed var(--border-color);
    padding-left: 1.5rem;
}

/* Items List */
.items-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.items-section h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.item-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

.item-qty {
    color: var(--accent-green);
    font-weight: 600;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-blue);
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

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

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    background: var(--card-bg);
    border-radius: 1rem;
}

/* Interactive Elements */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent-blue);
    color: #000;
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: #7dd3fc;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.btn-danger {
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.4rem;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.75rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.08);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Tree Toggle */
.toggle-btn {
    cursor: pointer;
    font-size: 0.7rem;
    color: #4ade80;
    margin-right: 0.5rem;
    display: inline-block;
    transition: transform 0.2s;
    width: 1rem;
}

.task-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.75rem 0;
    padding-left: 1.5rem;
    border-left: 2px solid var(--border-color);
}

.item-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.item-actions {
    display: flex;
    gap: 0.25rem;
}

#loader {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    body { padding: 1rem; }
    .project-header { flex-direction: column; gap: 1rem; }
}
/* Drag and Drop Feedback */
.task-item.drag-over > .task-content, 
.project-card.drag-over {
    border-color: var(--accent-blue) !important;
    background: rgba(56, 189, 248, 0.1) !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
    transform: scale(1.01);
}

.task-item[draggable="true"] {
    cursor: grab;
}

.task-item[draggable="true"]:active {
    cursor: grabbing;
}

/* Drop Zone for Reordering */
.drop-zone {
    height: 8px;
    margin: 4px 0;
    width: 100%;
    background: transparent;
    border-radius: 4px;
    transition: all 0.2s;
}

.drop-zone.drag-over {
    height: 30px;
    background: rgba(56, 189, 248, 0.2);
    border: 2px dashed var(--accent-blue);
    margin: 8px 0;
}

.item-badge {
    cursor: grab;
    transition: transform 0.2s;
}

.item-badge:active {
    cursor: grabbing;
}

.items-section {
    margin: 0.5rem 0 0.5rem 2rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.items-section h4 {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.items-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.task-content-extra {
    padding-left: 1.5rem;
}

.task-item.search-match {
    background: rgba(56, 189, 248, 0.1) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
    transform: scale(1.005);
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.task-item.search-match h3 {
    color: var(--accent-blue);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.task-item.search-match .task-info h3::before {
    content: '⭐';
    margin-right: 0.5rem;
    font-size: 0.8rem;
    display: inline-block;
}

/* Pulse for specific task selection */
@keyframes highlight-pulse {
    0% { box-shadow: 0 0 15px rgba(56, 189, 248, 0.2); border-color: var(--accent-blue); }
    50% { box-shadow: 0 0 30px rgba(56, 189, 248, 0.5); border-color: #fff; }
    100% { box-shadow: 0 0 15px rgba(56, 189, 248, 0.2); border-color: var(--accent-blue); }
}

.task-item.search-match {
    animation: highlight-pulse 2s infinite;
}

/* Drag and Drop Helpers */
.drop-zone {
    height: 4px;
    margin: 2px 0;
    border-radius: 2px;
    transition: all 0.2s;
    background: transparent;
}

.drop-zone.drag-over {
    height: 20px;
    background: rgba(56, 189, 248, 0.2);
    border: 2px dashed var(--accent-blue);
    margin: 10px 0;
}

[draggable="true"] {
    cursor: grab;
}

[draggable="true"]:active {
    cursor: grabbing;
}

.task-item.drag-over {
    border: 2px solid var(--accent-blue);
    background: rgba(56, 189, 248, 0.1) !important;
}

/* Focused Mobile View */
.mobile-view-active {
    overflow-x: hidden !important;
}

/* Mobile Devices: Immersive Full-Screen */
@media (max-width: 768px) {
    .mobile-view-active .container, 
    .mobile-view-active header,
    .mobile-view-active .header-actions,
    .mobile-view-active .view-toggles,
    .mobile-view-active main,
    .mobile-view-active div[style*="position: fixed"]:not(#mobile-overlay) {
        display: none !important;
    }
    .mobile-master-view {
        width: 100vw !important;
        left: 0 !important;
    }
}

/* Desktop: Side-by-Side Split View (50/50) */
@media (min-width: 769px) {
    .mobile-view-active .container {
        width: 50% !important;
        margin: 0 !important;
        padding-right: 1rem !important;
        overflow-x: hidden;
    }
    .mobile-view-active .mobile-master-view {
        width: 50vw !important;
        left: 50vw !important;
        border-left: 1px solid var(--accent-blue);
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
        background: #000000 !important; /* Pure black for desktop preview */
    }
}

.mobile-master-view {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-deep);
}

/* Mindmap Styles */
.mindmap-tree {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    padding-left: 2rem;
}

.mm-project {
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
}

.mm-node {
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: all 0.2s;
    position: relative;
    z-index: 2;
}

.mm-node:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--accent-blue);
    transform: translateX(5px);
}

.mm-project-node {
    font-weight: bold;
    font-size: 1.1rem;
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.mm-task-node {
    background: rgba(255, 255, 255, 0.08);
}

.mm-leaf-node {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    border-radius: 0.5rem;
    opacity: 0.8;
}

.mm-item { border-color: var(--accent-blue); color: var(--accent-blue); }
.mm-owner { border-color: #facc15; color: #facc15; }
.mm-asst { border-color: #a855f7; color: #a855f7; }

.mm-children {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-left: 3rem;
    margin-top: 1rem;
    position: relative;
}

.mm-children::before {
    content: '';
    position: absolute;
    left: 1.5rem;
    top: -1.5rem;
    bottom: 1.5rem;
    width: 2px;
    background: rgba(255,255,255,0.1);
}

.mm-child-wrapper {
    position: relative;
}

.mm-child-wrapper::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 50%;
    width: 1.5rem;
    height: 2px;
    background: rgba(255,255,255,0.1);
}

.mm-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    margin-right: 0.5rem;
    font-size: 0.6rem;
    transition: all 0.2s;
    color: #4ade80;
}

.mm-toggle:hover {
    background: var(--accent-blue);
    color: white;
}
/* Gantt Chart View */
.gantt-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.gantt-container {
    background: var(--bg-secondary);
    width: 95%;
    height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.gantt-header-row {
    display: flex;
    background: rgba(255,255,255,0.05);
    border-bottom: 2px solid var(--border-color);
}

.gantt-task-col {
    width: 300px;
    min-width: 300px;
    padding: 10px;
    border-right: 2px solid var(--border-color);
    flex-shrink: 0;
}

.gantt-timeline-col {
    flex-grow: 1;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
}

.gantt-grid {
    display: flex;
    position: relative;
    min-height: 100%;
}

.gantt-day-col {
    min-width: 30px;
    border-right: 1px solid rgba(255,255,255,0.05);
    text-align: center;
    font-size: 0.7rem;
    padding-top: 5px;
}

.gantt-task-row {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    min-height: 40px;
    align-items: center;
}

.gantt-bar-container {
    position: relative;
    flex-grow: 1;
    height: 100%;
}

.gantt-bar {
    position: absolute;
    height: 24px;
    top: 8px;
    border-radius: 12px;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.7rem;
    color: white;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.gantt-bar:hover {
    transform: scaleY(1.1);
}

.gantt-bar.task-comp { background: var(--accent-green); }
.gantt-bar.task-prog { background: var(--accent-orange); }
.gantt-bar.task-late { background: var(--accent-red); }

.gantt-task-name {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-project-header {
    background: rgba(56, 189, 248, 0.1);
}

.gantt-date-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-secondary);
}
