/**
 * ReadyFocus Styles
 * 
 * Design Philosophy:
 * - Minimal styling that appeals to plain-text enthusiasts
 * - Subtle improvements over a raw text editor
 * - CSS variables for future theming (dark mode, view-specific styles)
 * - Modular structure to support multiple views
 */

/* ===== CSS Variables ===== */
/* These variables make it easy to implement theming in future milestones */
:root {
    /* Color palette - light mode (default) */
    --color-bg-primary: #fafafa;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #f5f5f5;
    --color-text-primary: #2c3e50;
    --color-text-secondary: #7f8c8d;
    --color-border: #e0e0e0;
    --color-accent: hsl(101, 78%, 41%);
    --color-hover-bg: hsla(0, 0%, 50%, 0.06);
    --color-hover-border: hsla(0, 0%, 50%, 0.2);
    --color-current-bg: hsla(101, 78%, 41%, 0.12);
    --color-current-border: hsla(101, 78%, 41%, 0.5);
    --color-ready-bg: hsla(30, 100%, 50%, 0.05);
    --color-ready-border: hsla(30, 100%, 50%, 0.15);
    
    /* Typography */
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 15px;
    --line-height-base: 1.6;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Task item spacing - for consistent alignment between views */
    --task-item-gap: 8px;
    --task-item-padding-block: 2px;
    --task-item-padding-inline: 8px;
    
    /* Layout */
    --border-radius: 4px;
    --border-radius-md: 6px;
    --editor-max-width: 800px;
    --bottom-bar-height: 180px; /* Height of fixed bottom bar */
}

/* Dark mode color palette */
/* Applied when body has 'dark-theme' class */
body.dark-theme {
    --color-bg-primary: #1a1a1a;
    --color-bg-secondary: #2d2d2d;
    --color-bg-tertiary: #252525;
    --color-text-primary: #e0e0e0;
    --color-text-secondary: #a0a0a0;
    --color-border: #404040;
    --color-accent: hsl(101, 78%, 55%);
    --color-hover-bg: hsla(0, 0%, 60%, 0.08);
    --color-hover-border: hsla(0, 0%, 60%, 0.25);
    --color-current-bg: hsla(101, 78%, 55%, 0.16);
    --color-current-border: hsla(101, 78%, 55%, 0.55);
    --color-ready-bg: hsla(30, 100%, 60%, 0.06);
    --color-ready-border: hsla(30, 100%, 60%, 0.18);
}

/* ===== Base Styles ===== */

/* Remove default margins and padding */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Constrain viewport to enable internal scrolling */
html, body {
    height: 100%;
    overflow: hidden;
}

/* Body styles - sets the foundation for the entire app */
body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    
    /* Prevent text selection of UI elements (doesn't affect textarea content) */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== App Layout ===== */

/* Main app container */
.app-container {
    height: calc(100vh - var(--bottom-bar-height));
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-md);
    overflow-y: auto;
}

/* ===== Task Editor (Plain Text View) ===== */

/* The main textarea where users edit their task list */
.task-editor {
    width: 100%;
    max-width: var(--editor-max-width);
    flex: 1;
    height: 0; /* Allow flex to control height */
    
    /* Typography - monospace for plain text feel */
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    
    /* Colors */
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    
    /* Border and spacing */
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    padding-bottom: calc(var(--bottom-bar-height) + var(--spacing-md));
    
    /* Remove default textarea styles */
    resize: vertical;
    outline: none;
    
    /* Smooth transitions for subtle polish */
    transition: border-color 0.2s ease;
}

/* Subtle focus state - indicates active editing without being intrusive */
.task-editor:focus {
    border-color: var(--color-accent);
}

/* ===== Task Input Area ===== */

/* 
 * Container for the task input field and add button
 * Now positioned inside the fixed bottom bar
 */
.task-input-container {
    width: 100%;
    max-width: var(--editor-max-width);
    display: flex;
    margin: 0;
}

/* The text input field for adding new tasks */
.task-input {
    flex: 1;
    
    /* Typography */
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    
    /* Colors */
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    
    /* Border and spacing */
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm) var(--spacing-md);
    height: 44px;
    
    /* Remove default input styles */
    outline: none;
    
    /* Smooth transitions */
    transition: border-color 0.2s ease;
}

/* Placeholder text styling */
.task-input::placeholder {
    color: var(--color-text-secondary);
    opacity: 0.6;
}

/* Focus state for the input */
.task-input:focus {
    border-color: var(--color-accent);
}

/* Add task button wrapper - hidden */
.task-input-button-wrapper {
    display: none;
}

/* ===== View Selector Button ===== */

/* Wrapper for view selector button */
.view-selector-wrapper {
    position: relative;
    margin-left: var(--spacing-sm);
}

/* View selector button - matches input height */
.view-selector-button {
    height: 44px;
    min-width: 60px;
    padding: 0 var(--spacing-sm);
    
    /* Colors */
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    
    /* Layout */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    
    /* Interaction */
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Hover state */
.view-selector-button:hover {
    border-color: var(--color-accent);
    background-color: var(--color-bg-primary);
}

/* Icon container */
.view-selector-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dropdown indicator */
.view-selector-dropdown-indicator {
    font-size: 10px;
    opacity: 0.6;
}

/* Dropdown menu for view selection */
.view-selector-menu {
    position: absolute;
    bottom: calc(100% + 4px);
    right: 0;
    min-width: 160px;
    
    /* Colors */
    background-color: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    
    /* Shadow for depth */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    
    /* Layering */
    z-index: 1000;
    
    /* Spacing */
    padding: var(--spacing-xs) 0;
}

/* Individual view option in dropdown */
.view-selector-option {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    
    /* Typography */
    font-size: var(--font-size-base);
    text-align: left;
    
    /* Colors */
    color: var(--color-text-primary);
    background-color: transparent;
    border: none;
    
    /* Layout */
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    
    /* Interaction */
    cursor: pointer;
    transition: background-color 0.15s ease;
}

/* Hover state for dropdown options */
.view-selector-option:hover {
    background-color: var(--color-bg-secondary);
}

/* Icon in dropdown option */
.view-selector-option svg {
    flex-shrink: 0;
}

/* ===== Fixed Bottom Bar ===== */

/*
 * Fixed bottom bar that contains view tabs and task input
 * Always visible at the bottom of the viewport
 */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    
    /* Background and borders */
    background-color: var(--color-bg-primary);
    border-top: 1px solid var(--color-border);
    
    /* Spacing */
    padding: var(--spacing-md) var(--spacing-lg);
    
    /* Layout */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    
    /* Layering */
    z-index: 100;
}

/* ===== Task View Styles ===== */

/* View containers for Basic, Focus, and Agenda views */
.basic-view,
.focus-view,
.agenda-view {
    width: 100%;
    max-width: var(--editor-max-width);
    min-height: 0;
    padding: var(--spacing-md);
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    font-family: var(--font-sans);
    overflow-y: auto;
    flex: 1;
}

/* Focus view archive zone - grey background for completed/cancelled tasks at top */
.focus-archive-zone {
    background-color: var(--color-bg-tertiary);
    margin: calc(var(--spacing-md) * -1); /* Negative margin to extend to edges */
    margin-bottom: var(--spacing-md); /* Space between archive and active tasks */
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

/* Pinned current task - appears at top when actual current task is scrolled out of view */
.pinned-current-task {
    position: sticky;
    top: calc(-1 * var(--spacing-md)); /* Offset to sit flush at top, compensating for container padding */
    left: 0;
    right: 0;
    z-index: 80; /* High enough to cover task items and their option buttons */
    margin: calc(var(--spacing-md) * -1); /* Negative margin to extend to edges */
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--color-bg-primary);
    border-bottom: 2px solid var(--color-border); /* Neutral grey instead of green */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-theme .pinned-current-task {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* The pinned task element shouldn't have extra margins and should look like current task */
.pinned-current-task .task-item {
    margin: 0;
    /* Apply current task styling even without .is-current class */
    background-color: var(--color-current-bg);
    border-color: var(--color-current-border);
    border-width: 2px;
    padding: 1px 7px;
}

/* Bold text for pinned task */
.pinned-current-task .task-item__body {
    font-weight: 600;
}

/* Focus tip overlay - floating onboarding card */
.focus-tip-overlay {
    position: fixed;
    bottom: calc(var(--bottom-bar-height) + var(--spacing-lg));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    pointer-events: none;
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show overlay when visible class is added */
.focus-tip-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    animation: fade-slide-up 0.4s ease-out;
}

/* Slide-up entrance animation */
@keyframes fade-slide-up {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Tip card - the actual visible box */
.focus-tip-card {
    position: relative;
    width: 80vw;
    max-width: calc(var(--editor-max-width) * 0.8); /* 80% of list view width (640px) */
    padding: var(--spacing-md);
    background-color: white;
    color: var(--color-text-primary);
    border: 1.5px solid #e8a873; /* Very soft orange outline */
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

body.dark-theme .focus-tip-card {
    background-color: #1a1a1a; /* Dark background */
    color: var(--color-text-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Close button */
.focus-tip-close {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--border-radius);
    transition: background-color 0.2s;
}

.focus-tip-close:hover {
    background-color: var(--color-hover-bg);
}

/* Content area */
.focus-tip-content {
    padding-right: var(--spacing-xl);
}

.focus-tip-content p {
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--color-text-primary);
    font-size: 14px; /* Smaller text */
    line-height: var(--line-height-base);
}

.focus-tip-content p:last-child {
    margin-bottom: 0;
}

/* Bold and underlined task name */
.focus-tip-content strong {
    font-weight: 700;
    text-decoration: underline;
}

/* Code element for + symbol */
.focus-tip-content code {
    display: inline-block;
    padding: 2px 6px;
    background-color: var(--color-hover-bg);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--color-text-primary);
    font-weight: 600;
}

/* Step containers */
.focus-tip-step {
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Footer with navigation and step indicators */
.focus-tip-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--color-border);
}

/* Navigation buttons */
.focus-tip-nav {
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--border-radius);
    transition: background-color 0.2s;
    min-width: 60px;
}

.focus-tip-nav:hover {
    background-color: var(--color-hover-bg);
}

.focus-tip-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Step indicator dots */
.focus-tip-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.focus-tip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(128, 128, 128, 0.4);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.focus-tip-dot:hover {
    background-color: rgba(128, 128, 128, 0.6);
}

.focus-tip-dot.active {
    background-color: #e8a873; /* Very soft orange dot for active step */
    transform: scale(1.3);
}

/* Disable hover effect on pinned task - keep green background */
.pinned-current-task .task-item:hover {
    background-color: var(--color-current-bg);
    border-color: var(--color-current-border);
}

/* Current task checkbox styling for pinned task */
.pinned-current-task .task-item__checkbox {
    accent-color: hsl(101, 78%, 35%);
    filter: contrast(1.2);
}

body.dark-theme .pinned-current-task .task-item__checkbox {
    accent-color: hsl(101, 78%, 50%);
    filter: contrast(1.15);
}

/* ===== Shared Task Item Styles ===== */

/*
 * Base task item structure
 * Used by both Basic and Focus views for consistent styling
 */
.task-item {
    display: flex;
    align-items: center;
    gap: var(--task-item-gap);
    padding: var(--task-item-padding-block) var(--task-item-padding-inline);
    
    /* Typography */
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    
    /* Border for visual separation and hover effect */
    border-radius: var(--border-radius-md);
    border: 1px solid transparent;
}

/* Hover effect - subtle background and border */
.task-item:hover,
.task-item.has-open-dropdown {
    background-color: var(--color-hover-bg);
    border-color: var(--color-hover-border);
}

/* Current task highlight - persistent, more intense green with thicker border */
.task-item.is-current {
    background-color: var(--color-current-bg);
    border-color: var(--color-current-border);
    border-width: 2px;
    padding: 1px 7px; /* Adjust padding to compensate for thicker border */
}

/* Ready task highlight - subtle orange */
.task-item.is-ready {
    background-color: var(--color-ready-bg);
    border-color: var(--color-ready-border);
}

/* Disable hover effects for archived tasks */
.task-item.is-archived:hover {
    background-color: transparent;
    border-color: transparent;
}

/* Action container (checkbox or plus button area) */
/* Fixed width ensures consistent text alignment across all views */
.task-item__action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; /* Fixed width to accommodate checkbox (18px) and plus button (24px) */
    min-width: 32px;
    position: relative;
}

/* Simple plus indicator for tasks eligible to be marked as ready */
.task-item__action.has-plus-indicator::before {
    content: '+';
    position: absolute;
    top: calc(50% - 3px); /* Optical centering adjustment - matches ready button position */
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    line-height: 1;
    color: var(--color-text-primary);
}

/* Hide simple indicator on hover to show interactive button */
.task-item:hover .task-item__action.has-plus-indicator::before {
    opacity: 0;
    visibility: hidden;
}

/* Grey out plus indicator when task is greyed (completed/cancelled) */
.task-item.is-greyed .task-item__action.has-plus-indicator::before {
    color: var(--color-text-secondary);
    opacity: 0.6;
}

/* Grey out plus indicator when task is hover-dimmed (extra focus) */
.task-item.is-hover-dimmed .task-item__action.has-plus-indicator::before {
    color: var(--color-text-secondary);
    opacity: 0.6;
}

/* Control visibility of checkbox and plus based on state */
/* Default state: show what the task was rendered with */
.task-item__action.show-checkbox .task-item__checkbox {
    display: block;
}

.task-item__action.show-checkbox .task-item__plus {
    display: none;
}

.task-item__action.show-plus .task-item__checkbox {
    display: none;
}

.task-item__action.show-plus .task-item__plus {
    display: block;
}

/* Hover state override: force checkbox visibility for tasks above hovered */
.task-item.show-checkbox-on-hover .task-item__action .task-item__checkbox {
    display: block !important;
}

.task-item.show-checkbox-on-hover .task-item__action .task-item__plus {
    display: none !important;
}

.task-item.show-checkbox-on-hover .task-item__action.has-plus-indicator::before {
    display: none !important;
}

/* Checkbox styling */
.task-item__checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-accent);
    margin-top: -2px; /* Optical centering adjustment */
}

/* Non-interactive checkbox (Focus view only - for non-current tasks) */
.task-item__checkbox.is-non-interactive {
    cursor: default;
    pointer-events: none;
}

/* Shared button styling for plus and options buttons */
.task-item__plus,
.task-item__options-button {
    border-radius: 2px;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s, border-color 0.2s;
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
}

/* Plus button specific sizing */
.task-item__plus {
    width: 18px;
    height: 18px;
    font-size: 16px;
    margin-top: -2px; /* Optical centering adjustment */
}

/* Options button specific sizing */
.task-item__options-button {
    width: 22px;
    height: 22px;
    font-size: 16px;
    letter-spacing: 1px;
}

/* Show buttons on hover or touch */
.task-item:hover .task-item__plus,
.task-item:hover .task-item__options-button {
    opacity: 1;
    visibility: visible;
}

/* Shared hover effect - grey background and darker border */
.task-item__plus:hover,
.task-item__options-button:hover {
    background-color: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.15);
}

/* Shared focus effect */
.task-item__plus:focus,
.task-item__options-button:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Dark theme button hover */
[data-theme="dark"] .task-item__plus:hover,
[data-theme="dark"] .task-item__options-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Body container (main text content) */
.task-item__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    align-self: flex-start;
}

/* Meta container (tags only) */
.task-item__meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xs);
}

/* Options button additional properties (positioned at task-item level) */
.task-item__options-button {
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

/* ===== Task State Modifiers ===== */

/* Checked state - greyed but no strikethrough */
.task-item.is-checked .task-item__body {
    color: var(--color-text-secondary);
    opacity: 0.6;
}

.task-item.is-checked .task-item__checkbox {
    opacity: 0.6;
}

/* Cancelled state - greyed with strikethrough */
.task-item.is-cancelled .task-item__body {
    color: var(--color-text-secondary);
    opacity: 0.6;
    text-decoration: line-through;
}

.task-item.is-cancelled .task-item__checkbox {
    opacity: 0.6;
}

/* Greyed state (for Focus view) - dim text and checkbox but not options button */
/* Also applies to hover-dimmed state (extra focus feature) */
.task-item.is-greyed .task-item__body,
.task-item.is-hover-dimmed .task-item__body {
    color: var(--color-text-secondary);
    opacity: 0.6;
}

.task-item.is-greyed .task-item__checkbox,
.task-item.is-greyed .task-item__plus,
.task-item.is-hover-dimmed .task-item__checkbox,
.task-item.is-hover-dimmed .task-item__plus {
    opacity: 0.6;
}

/* Current task state (for Focus view) */
.task-item.is-current .task-item__body {
    font-weight: 600;
}

/* Current task checkbox - darker accent color to make outline more prominent */
.task-item.is-current .task-item__checkbox {
    accent-color: hsl(101, 78%, 35%);
    filter: contrast(1.2);
}

body.dark-theme .task-item.is-current .task-item__checkbox {
    accent-color: hsl(101, 78%, 50%);
    filter: contrast(1.15);
}

/* ===== Task Content Styling ===== */

/* Task text container */
.task-text {
    flex: 1;
}

/* Links within task text */
.task-link {
    color: inherit; /* Same color as regular text */
    text-decoration: underline;
    text-decoration-style: solid;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    cursor: pointer;
}

.task-link:hover {
    text-decoration-thickness: 1.5px;
}

/* Tags container - holds all tags for a task */
.task-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Individual tag */
.task-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: nowrap;
}

/* Tag styling in light theme */
.task-tag {
    background-color: #e0e0e0;
    color: #555555;
}

/* Tag styling in dark theme */
[data-theme="dark"] .task-tag {
    background-color: #404040;
    color: #b0b0b0;
}

/* ===== Empty State ===== */

/* Message shown when a view has no tasks to display */
.empty-state {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--color-text-secondary);
    font-style: italic;
}

/* ===== View-Specific Overrides ===== */

/* Basic View - hide options button but keep in layout for consistent spacing */
.task-item.view-basic .task-item__options-button,
.task-item.view-basic:hover .task-item__options-button {
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

/* Basic View - use neutral grey accent color for checkboxes */
.task-item.view-basic .task-item__checkbox {
    accent-color: #6b7280;
}

[data-theme="dark"] .task-item.view-basic .task-item__checkbox {
    accent-color: #9ca3af;
}

/* Focus View - options button subtle by default, prominent on hover */
.view-focus .task-item__options-button {
    opacity: 0.6;
}

.view-focus .task-item:hover .task-item__options-button,
.view-focus .task-item__options-button:focus {
    opacity: 1;
}

/* ===== Dropdown Menu (Body-Level) ===== */

/* 
 * Dropdown menu rendered at document.body level
 * Completely decoupled from task item styling to prevent inheritance
 * of opacity, transforms, or other parent styles
 */
.dropdown-menu {
    position: fixed;
    
    /* Sizing - fit content with minimal padding */
    width: fit-content;
    min-width: max-content;
    
    /* Colors - solid opaque backgrounds */
    background-color: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    
    /* Shadow for depth */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    /* Layering - very high z-index to appear above everything */
    z-index: 10000;
    
    /* Spacing */
    padding: 4px 0;
}

/* Dark mode dropdown menu */
[data-theme="dark"] .dropdown-menu {
    background-color: #2a2a2a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Dropdown menu option button */
.dropdown-menu-option {
    width: 100%;
    padding: 6px 12px;
    border: none;
    background-color: #ffffff;
    color: var(--color-text-primary);
    
    /* Typography */
    font-size: 14px;
    font-family: var(--font-sans);
    line-height: 1.4;
    text-align: left;
    
    /* Layout - use flexbox for icon+text alignment */
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    
    /* Cursor */
    cursor: pointer;
    
    /* Transition */
    transition: background-color 0.15s ease;
}

/* Menu option hover state */
.dropdown-menu-option:hover {
    background-color: #f0f0f0;
}

/* Dark mode menu option */
[data-theme="dark"] .dropdown-menu-option {
    background-color: #2a2a2a;
}

[data-theme="dark"] .dropdown-menu-option:hover {
    background-color: #353535;
}

/* Menu option focus state */
.dropdown-menu-option:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

/* Dropdown menu icon */
.dropdown-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.dropdown-menu-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    display: block;
}

/* ===== Theme Toggle Button ===== */

/* 
 * The theme toggle button allows users to switch between light and dark modes
 * Positioned in top right corner, stays fixed when scrolling
 */
.theme-toggle {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    
    /* Button styling */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    
    /* Center the icon */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Cursor and interaction */
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    
    /* Remove default button styles */
    font-family: inherit;
    font-size: 20px;
    padding: 0;
}

/* Hover state for the theme toggle */
.theme-toggle:hover {
    background-color: var(--color-bg-primary);
    border-color: var(--color-accent);
}

/* Focus state for keyboard navigation */
.theme-toggle:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Active state when clicking */
.theme-toggle:active {
    transform: scale(0.95);
}

/* The icon inside the button */
.theme-icon {
    display: block;
    line-height: 1;
}

/* ===== Accessibility & Responsive ===== */

/* Ensure text remains readable on smaller screens */
@media (max-width: 768px) {
    .app-container {
        padding: var(--spacing-sm);
    }
    
    .task-editor,
    .basic-view,
    .focus-view,
    .agenda-view {
        min-height: 300px;
        font-size: 14px;
    }
    
    .task-input {
        font-size: 14px;
    }
    
    .view-tab {
        font-size: 14px;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    /* Position theme toggle closer to edge on mobile */
    .theme-toggle {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
    }
}

/* ===== iOS-Style Toggle Switches ===== */

/* Toggle menu item container (combines label and toggle switch) */
.dropdown-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 6px 12px;
    background-color: transparent;
    border: none;
    color: var(--color-text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    gap: 12px;
}

/* Toggle menu item label container (icon + text) */
.dropdown-menu-toggle__label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-menu-toggle:hover {
    background-color: #f0f0f0;
}

/* Dark mode toggle menu item */
[data-theme="dark"] .dropdown-menu-toggle {
    background-color: transparent;
}

[data-theme="dark"] .dropdown-menu-toggle:hover {
    background-color: #353535;
}

/* iOS-style toggle switch container (smaller size) */
.toggle-switch {
    position: relative;
    width: 32px;
    height: 18px;
    flex-shrink: 0;
    pointer-events: none; /* Prevent direct clicks, parent button handles interaction */
}

/* Toggle switch track */
.toggle-switch__track {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--color-border);
    border-radius: 9px;
    transition: background-color 0.3s ease;
}

/* Toggle switch track when active/on */
.toggle-switch.is-on .toggle-switch__track {
    background-color: var(--color-accent);
}

/* Toggle switch thumb (sliding circle) */
.toggle-switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

/* Toggle switch thumb when active/on */
.toggle-switch.is-on .toggle-switch__thumb {
    transform: translateX(14px);
}

/* Respect user's preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .task-editor,
    .theme-toggle,
    .view-tab,
    .basic-task-item,
    .focus-task-item,
    .focus-task-plus,
    .focus-task-options-button,
    .focus-task-menu-option,
    .focus-task-item,
    .focus-task-plus,
    .focus-task-options-button,
    .toggle-switch__track,
    .toggle-switch__thumb {
        transition: none;
    }
    
    .theme-toggle:active {
        transform: none;
    }
}
