/* ============================================
   TODO.EXE - Classic Mac Aesthetic
   Clean, tasteful retro design
   ============================================ */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme - Classic Mac Palette */
    --bg-desktop: #dddddd;
    --bg-window: #ffffff;
    --bg-titlebar: #000000;
    --bg-input: #ffffff;
    --bg-button: #f5f5f5;
    --bg-button-hover: #e8e8e8;
    --bg-button-active: #d0d0d0;

    --text-primary: #000000;
    --text-inverse: #ffffff;
    --text-muted: #888888;

    --border-light: #e0e0e0;
    --border-dark: #000000;
    --border-mid: #cccccc;

    --accent-color: #0055ff;
    --accent-hover: #0044dd;
    --input-focus: #fffacd;
    --item-hover: #f5f5f5;
    --delete-color: #ff3b30;
    --overdue-color: #ff3b30;
    --due-today-color: #ff9500;

    /* Typography - Default: Pixelify Sans */
    --font-pixelify: "Pixelify Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-doto: "Doto", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-silkscreen: "Silkscreen", -apple-system, BlinkMacSystemFont, system-ui, monospace;
    --font-ubuntu-mono: "Ubuntu Mono", -apple-system, BlinkMacSystemFont, system-ui, monospace;
    --font-primary: var(--font-pixelify);
    --font-mono: var(--font-pixelify);
    --font-size-xs: 9px;
    --font-size-sm: 11px;
    --font-size-md: 13px;
    --font-size-lg: 16px;
    --font-size-xl: 20px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 20px;
    --space-xl: 32px;

    /* Border radius */
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 8px;
}

/* Dark Theme - Classic Terminal */
body[data-theme="dark"] {
    --bg-desktop: #0a0a0a;
    --bg-window: #1a1a1a;
    --bg-titlebar: #000000;
    --bg-input: #0f0f0f;
    --bg-button: #2a2a2a;
    --bg-button-hover: #333333;
    --bg-button-active: #1a1a1a;

    --text-primary: #00ff00;
    --text-inverse: #00ff00;
    --text-muted: #008800;

    --border-light: #2a2a2a;
    --border-dark: #000000;
    --border-mid: #1a1a1a;

    --accent-color: #00ff00;
    --accent-hover: #00dd00;
    --input-focus: #0a1a0a;
    --item-hover: #151515;
    --delete-color: #ff3b30;
}

/* Font Variations */
body[data-font="doto"] {
    --font-primary: var(--font-doto);
    --font-mono: var(--font-doto);
    font-weight: 600;
}

body[data-font="silkscreen"] {
    --font-primary: var(--font-silkscreen);
    --font-mono: var(--font-silkscreen);
}

body[data-font="ubuntu-mono"] {
    --font-primary: var(--font-ubuntu-mono);
    --font-mono: var(--font-ubuntu-mono);
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-desktop);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === NOTIFICATION TOAST === */
.notification {
    position: fixed;
    top: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-window);
    border: 2px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    z-index: 1000;
    max-width: 90%;
    animation: slideDown 0.3s ease-out;
}

.notification.hidden {
    display: none;
}

.notification.error {
    border-color: var(--delete-color);
    background: var(--bg-window);
}

.notification.success {
    border-color: #27c93f;
}

.notification.warning {
    border-color: var(--due-today-color);
}

.notification-message {
    font-size: var(--font-size-sm);
    font-weight: 500;
    flex: 1;
}

.notification-close {
    background: transparent;
    border: 1px solid var(--border-mid);
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.notification-close:hover {
    background: var(--bg-button-hover);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* === DESKTOP & WINDOW === */
.desktop {
    width: 100%;
    /* max-width set in responsive section for desktop */
}

.window {
    background: var(--bg-window);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15),
                0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* === TITLE BAR === */
.title-bar {
    background: var(--bg-titlebar);
    padding: var(--space-sm) var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-dark);
}

.title-bar-text {
    color: var(--text-inverse);
    font-size: var(--font-size-md);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.title-bar-controls {
    display: flex;
    gap: var(--space-sm);
}

.title-bar-button {
    /* Classic Mac window control size - small circular buttons */
    width: 12px;
    height: 12px;
    background: var(--bg-button);
    border: 1px solid var(--border-dark);
    border-radius: 50%;
    font-size: 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.title-bar-button:hover {
    opacity: 0.8;
}

.title-bar-button:nth-child(1) {
    background: #ff5f56;
}

.title-bar-button:nth-child(2) {
    background: #ffbd2e;
}

.title-bar-button:nth-child(3) {
    background: #27c93f;
}

/* === WINDOW BODY === */
.window-body {
    padding: var(--space-lg);
}

/* === HEADER === */
.app-header {
    text-align: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.app-title {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-xs);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* === SETTINGS CONTAINER === */
.settings-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

/* === THEME TOGGLE === */
.theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.theme-label {
    font-size: var(--font-size-xs);
    letter-spacing: 0.5px;
    font-weight: 500;
    text-transform: uppercase;
}

.theme-toggle-btn {
    width: 36px;
    height: 20px;
    background: var(--bg-button);
    border: 1px solid var(--border-mid);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs);
    transition: background 0.2s;
}

.theme-toggle-btn:hover {
    background: var(--bg-button-hover);
}

.theme-icon {
    font-size: var(--font-size-sm);
    user-select: none;
}

/* === FONT SELECT === */
.font-select-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.font-label {
    font-size: var(--font-size-xs);
    letter-spacing: 0.5px;
    font-weight: 500;
    text-transform: uppercase;
}

.font-select {
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-primary);
    font-size: var(--font-size-xs);
    font-weight: 500;
    background: var(--bg-button);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    outline: none;
}

.font-select:hover {
    background: var(--bg-button-hover);
}

.font-select:focus {
    border-color: var(--accent-color);
    background: var(--input-focus);
}

/* === ADD TODO SECTION === */
.add-todo-section {
    margin-bottom: var(--space-lg);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.input-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.optional-label {
    font-weight: 400;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

.input-wrapper {
    display: flex;
    gap: var(--space-sm);
}

.todo-input,
.date-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    background: var(--bg-input);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    color: var(--text-primary);
}

.todo-input:focus,
.date-input:focus {
    border-color: var(--accent-color);
    background: var(--input-focus);
}

.date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: opacity(0.7);
}

body[data-theme="dark"] .date-input::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.7);
}

/* === BUTTONS === */
.btn {
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    background: var(--bg-button);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn:active {
    background: var(--bg-button-active);
    transform: translateY(1px);
}

.btn-primary {
    background: var(--accent-color);
    color: var(--text-inverse);
    border-color: var(--accent-color);
}

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

.btn-secondary {
    width: 100%;
}

/* === STATS SECTION === */
.stats-section {
    margin-bottom: var(--space-md);
}

.stats-box {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.stats-value {
    font-size: var(--font-size-lg);
    font-weight: 700;
    background: var(--accent-color);
    color: var(--text-inverse);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    min-width: 32px;
    text-align: center;
}

/* === FILTER SECTION === */
.filter-section {
    margin-bottom: var(--space-md);
}

.filter-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.filter-btn {
    padding: var(--space-sm);
    font-family: var(--font-primary);
    font-size: var(--font-size-xs);
    font-weight: 600;
    background: var(--bg-button);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-btn:hover {
    background: var(--bg-button-hover);
}

.filter-btn.active {
    background: var(--accent-color);
    color: var(--text-inverse);
    border-color: var(--accent-color);
}

/* Dark mode: ensure contrast for active buttons */
body[data-theme="dark"] .filter-btn.active {
    color: #000000;
}

body[data-theme="dark"] .btn-primary {
    color: #000000;
}

body[data-theme="dark"] .stats-value {
    color: #000000;
}

/* === TODO LIST === */
.todo-list-section {
    margin-bottom: var(--space-lg);
}

.list-container {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    /* Desktop dimensions - shows ~10-13 tasks without scrolling */
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.todo-list {
    list-style: none;
}

.todo-item {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--bg-input);
    transition: background 0.2s;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item:hover {
    background: var(--item-hover);
}

.todo-item.completed {
    opacity: 0.5;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
}

/* Custom Checkbox */
.todo-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-dark);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.todo-checkbox:hover {
    border-color: var(--accent-color);
}

.todo-checkbox.checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.todo-checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--font-size-sm);
    font-weight: bold;
    color: var(--text-inverse);
}

/* Dark mode: improve checkbox visibility */
body[data-theme="dark"] .todo-checkbox {
    border-color: var(--text-muted);
}

body[data-theme="dark"] .todo-checkbox:hover {
    border-color: var(--accent-color);
}

body[data-theme="dark"] .todo-checkbox.checked {
    border-color: var(--accent-color);
}

.todo-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.todo-text {
    font-size: var(--font-size-md);
    word-break: break-word;
    line-height: 1.4;
}

.todo-due-date {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.todo-item.overdue:not(.completed) .todo-due-date {
    color: var(--overdue-color);
    font-weight: 600;
}

.todo-item.due-today:not(.completed) .todo-due-date {
    color: var(--due-today-color);
    font-weight: 600;
}

.todo-item.overdue:not(.completed) {
    border-left: 3px solid var(--overdue-color);
    padding-left: calc(var(--space-md) - 3px);
}

.todo-item.due-today:not(.completed) {
    border-left: 3px solid var(--due-today-color);
    padding-left: calc(var(--space-md) - 3px);
}

.todo-delete {
    padding: var(--space-xs) var(--space-md);
    font-family: var(--font-primary);
    font-size: var(--font-size-xs);
    font-weight: 600;
    background: transparent;
    color: var(--delete-color);
    border: 1px solid var(--delete-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.todo-delete:hover {
    background: var(--delete-color);
    color: var(--text-inverse);
}

/* === EMPTY STATE === */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: var(--space-lg);
}

.empty-state.hidden {
    display: none;
}

.ascii-art {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}

/* === ACTIONS SECTION === */
.actions-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

/* === FOOTER === */
.app-footer {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.footer-text {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* === SCROLLBAR STYLING === */
.list-container::-webkit-scrollbar {
    width: 10px;
}

.list-container::-webkit-scrollbar-track {
    background: var(--bg-window);
}

.list-container::-webkit-scrollbar-thumb {
    background: var(--border-mid);
    border-radius: var(--radius-sm);
}

.list-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === RESPONSIVE - MOBILE FIRST === */
/* Base styles are mobile-optimized */

/* Default mobile styles */
body {
    padding: var(--space-sm);
}

.window-body {
    padding: var(--space-md);
}

.app-header {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
}

.app-title {
    font-size: var(--font-size-lg);
}

.input-wrapper {
    flex-direction: column;
}

.btn, .btn-primary {
    width: 100%;
    min-height: 44px;
}

.filter-btn {
    min-height: 44px;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
}

.todo-delete {
    min-width: 44px;
    min-height: 44px;
}

.actions-section {
    grid-template-columns: 1fr;
}

.list-container {
    /* Mobile dimensions - smaller to fit typical mobile screens */
    min-height: 250px;
    max-height: 350px;
}

/* Tablet and up - enhance from mobile base */
@media (min-width: 641px) {
    body {
        padding: var(--space-lg);
    }

    .window-body {
        padding: var(--space-lg);
    }

    .app-header {
        margin-bottom: var(--space-lg);
        padding-bottom: var(--space-lg);
    }

    .app-title {
        font-size: var(--font-size-xl);
    }

    .input-wrapper {
        flex-direction: row;
    }

    .btn, .btn-primary {
        width: auto;
    }

    .todo-checkbox {
        width: 18px;
        height: 18px;
    }

    .todo-delete {
        min-width: auto;
        min-height: auto;
    }

    .actions-section {
        grid-template-columns: 1fr 1fr;
    }

    .list-container {
        min-height: 300px;
        max-height: 400px;
    }

    .desktop {
        max-width: 640px;
    }
}

/* Desktop and up - further enhancements */
@media (min-width: 1025px) {
    .desktop {
        max-width: 560px;
    }
}

/* Improve touch targets on all touchscreen devices */
@media (pointer: coarse) {
    .btn, .filter-btn, .todo-delete, .theme-toggle-btn {
        min-height: 44px;
        cursor: pointer;
    }

    .todo-checkbox {
        min-width: 20px;
        min-height: 20px;
    }
}
