/* Modern Dark Mode Design */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-card: #1f1f1f;
    --bg-hover: #262626;
    
    --text-primary: #ffffff;
    --text-secondary: #a8a8a8;
    --text-tertiary: #666666;
    
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-light: #a78bfa;
    --accent-bg: rgba(124, 58, 237, 0.1);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --border: #2a2a2a;
    --border-light: #333333;
    
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 i {
    color: var(--accent);
    font-size: 18px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

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

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

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-tertiary);
    border-radius: 6px;
    transition: all 0.2s;
}

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

/* Main Content Layout */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Journal Panel */
.journal-panel {
    flex: 1;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px 32px;
}

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

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.view-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-tertiary);
    padding: 2px;
    border-radius: 8px;
}

.view-toggle button {
    padding: 6px 14px;
    border: none;
    background: none;
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    letter-spacing: -0.01em;
}

.view-toggle button:hover {
    color: var(--text-secondary);
}

.view-toggle button.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Journal Entries - Interconnected Design */
.journal-entries {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.journal-entries::-webkit-scrollbar {
    width: 6px;
}

.journal-entries::-webkit-scrollbar-track {
    background: transparent;
}

.journal-entries::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.journal-entry {
    background: var(--bg-card);
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 1px solid var(--border);
    margin-bottom: -1px; /* Creates connected effect */
}

.journal-entry:first-child {
    border-radius: 12px 12px 0 0;
}

.journal-entry:last-child {
    border-radius: 0 0 12px 12px;
    margin-bottom: 0;
}

.journal-entry:only-child {
    border-radius: 12px;
}

.journal-entry:hover {
    background: var(--bg-hover);
    z-index: 1;
    box-shadow: var(--shadow-lg);
    transform: scale(1.02);
    border-radius: 12px;
    margin: 8px 0;
    border-color: var(--accent);
}

.journal-entry.completed {
    opacity: 0.5;
}

.journal-entry.completed .entry-header h3 {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.entry-header h3 {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    letter-spacing: -0.01em;
}

.entry-date {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.entry-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.entry-due-date {
    font-size: 12px;
    color: var(--text-tertiary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.subtasks-preview {
    font-size: 12px;
    color: var(--accent-light);
    margin-top: 8px;
    font-weight: 500;
}

/* Checklist Panel */
.checklist-panel {
    width: 420px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px;
    border-left: 1px solid var(--border);
}

.checklist-items {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.checklist-items::-webkit-scrollbar {
    width: 6px;
}

.checklist-items::-webkit-scrollbar-track {
    background: transparent;
}

.checklist-items::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.checklist-item {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.checklist-item:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.checklist-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.checklist-header input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 0;
    cursor: pointer;
    accent-color: var(--accent);
}

.checklist-header label {
    flex: 1;
    font-weight: 500;
    cursor: pointer;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.checklist-due {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: 32px;
    margin-bottom: 16px;
    font-weight: 500;
}

.checklist-due.overdue {
    color: var(--danger);
}

/* Subtasks */
.subtasks {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px;
    margin-left: 20px;
    margin-bottom: 16px;
}

.subtask {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-radius: 6px;
    transition: all 0.2s;
}

.subtask:hover {
    background: var(--bg-hover);
}

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

.subtask label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    flex: 1;
}

.subtask input:checked + label {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.checklist-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    margin-left: 32px;
}

.checklist-actions button {
    padding: 6px 12px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.checklist-actions button:hover {
    background: var(--accent-bg);
    color: var(--accent);
}

/* Mindmap Styles */
.mindmap-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--bg-secondary);
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.05) 0%, transparent 50%);
}

.mindmap-svg {
    width: 100%;
    height: 100%;
    cursor: grab;
}

.mindmap-svg:active {
    cursor: grabbing;
}

.mindmap-link {
    stroke: var(--accent);
    stroke-opacity: 0.3;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.mindmap-link:hover {
    stroke-opacity: 0.6;
    stroke-width: 3;
}

.temp-link {
    stroke: var(--accent);
    stroke-opacity: 0.5;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

.mindmap-node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.node-circle {
    fill: var(--bg-card);
    stroke: var(--border-light);
    stroke-width: 2;
    transition: all 0.3s ease;
}

.node-circle.completed {
    fill: var(--bg-tertiary);
    stroke: var(--success);
    opacity: 0.7;
}

.node-circle.active {
    stroke: var(--accent);
}

.mindmap-node:hover .node-circle {
    stroke: var(--accent-light);
    stroke-width: 3;
    filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.3));
}

.mindmap-node.selected .node-circle {
    stroke: var(--accent);
    stroke-width: 3;
    fill: var(--accent-bg);
}

.node-title {
    fill: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

.mindmap-node.completed .node-title {
    fill: var(--text-secondary);
    text-decoration: line-through;
}

.status-indicator {
    fill: var(--accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mindmap-node:hover .status-indicator {
    opacity: 1;
}

.connect-button {
    fill: var(--bg-tertiary);
    stroke: var(--border-light);
    stroke-width: 1;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
}

.mindmap-node:hover .connect-button {
    opacity: 1;
}

.connect-button:hover {
    fill: var(--accent-bg);
    stroke: var(--accent);
}

.connect-button.connecting {
    fill: var(--accent);
    stroke: var(--accent);
    opacity: 1;
}

.connect-icon {
    font-size: 12px;
    fill: var(--text-secondary);
}

/* Mindmap Controls */
.mindmap-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    background: var(--bg-card);
    padding: 10px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.mindmap-controls button {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mindmap-controls button:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

/* Task Detail Panel */
.task-detail-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 350px;
    max-height: calc(100vh - 120px);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    display: none;
    overflow-y: auto;
    z-index: 100;
}

.task-detail-panel.show {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.task-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
}

.task-detail-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    margin-right: 10px;
}

.task-detail-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.task-detail-close:hover {
    color: var(--text-primary);
}

.task-detail-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 16px;
}

.task-detail-status.active {
    background: var(--accent-bg);
    color: var(--accent);
}

.task-detail-status.completed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

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

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

.task-detail-content {
    color: var(--text-primary);
    line-height: 1.6;
}

.task-detail-due {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.task-detail-due.overdue {
    color: var(--danger);
}

.task-detail-subtasks {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-detail-subtask {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.task-detail-subtask:last-child {
    border-bottom: none;
}

.task-detail-subtask input[type="checkbox"] {
    cursor: pointer;
}

.task-detail-subtask label {
    flex: 1;
    cursor: pointer;
    color: var(--text-primary);
}

.task-detail-subtask.completed label {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.task-detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.task-detail-actions button {
    flex: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-tertiary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Form */
form {
    padding: 24px;
    overflow-y: auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

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

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
}

/* AI Suggestions */
.ai-suggestions {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
    display: none;
}

.ai-suggestions.show {
    display: block;
}

/* Implementation Modal */
.modal-large {
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
}

.implementation-content {
    max-height: 60vh;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', monospace;
}

.implementation-content h1 {
    font-size: 24px;
    margin: 20px 0 10px 0;
    color: var(--accent);
}

.implementation-content h2 {
    font-size: 20px;
    margin: 18px 0 8px 0;
    color: var(--text-primary);
}

.implementation-content h3 {
    font-size: 16px;
    margin: 15px 0 5px 0;
    color: var(--text-primary);
}

.implementation-content p {
    margin: 10px 0;
    line-height: 1.6;
}

.implementation-content ul {
    margin: 10px 0;
    padding-left: 25px;
}

.implementation-content li {
    margin: 5px 0;
    line-height: 1.5;
}

.implementation-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--accent-light);
}

.implementation-content pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    margin: 15px 0;
}

.implementation-content pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    display: block;
    white-space: pre;
}

.implementation-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.implementation-content em {
    color: var(--text-secondary);
    font-style: italic;
}

.ai-suggestions h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggested-subtask {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.suggested-subtask:hover {
    background: var(--bg-hover);
}

.suggested-subtask input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.suggested-subtask label {
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Loading */
.loading {
    text-align: center;
    padding: 24px;
    color: var(--text-tertiary);
}

.loading i {
    font-size: 20px;
    color: var(--accent);
    animation: spin 1s linear infinite;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .journal-panel {
        border-right: none;
        padding: 16px;
    }
    
    .checklist-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
    }
    
    .app-header {
        padding: 16px;
    }
}

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

.journal-entry,
.checklist-item {
    animation: fadeIn 0.3s ease-out;
}

/* Focus styles */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}