/* Terminal.css - Eternal Todo Terminal Styling */

* {
    box-sizing: border-box;
}

/* CSS Custom Properties for Theme System */
:root {
    /* Default Dark Theme */
    --bg-primary: #1e1e1e;
    --bg-secondary: #2d2d30;
    --bg-header: #252526;
    --bg-input: #1e1e1e;
    --text-primary: #d4d4d4;
    --text-secondary: #cccccc;
    --text-muted: #8c8c8c;
    --text-completed: #8c8c8c;
    --accent-color: #d4a574;
    --accent-hover: #f4c896;
    --border-color: #3e3e42;
    --border-hover: #252526;
    --success-color: #4ec9b0;
    --error-color: #d16969;
    --error-hover: #f17070;
    --info-color: #007acc;
}

/* Theme Definitions */
body[data-theme="amber"] {
    --bg-primary: #2a1f1a;
    --bg-secondary: #3d2f25;
    --bg-header: #332520;
    --bg-input: #2a1f1a;
    --text-primary: #f4e4d4;
    --text-secondary: #e8d4c1;
    --text-muted: #b8956f;
    --text-completed: #b8956f;
    --accent-color: #ff9800;
    --accent-hover: #ffb74d;
    --border-color: #5c4a3d;
    --border-hover: #332520;
}

body[data-theme="white-on-black"] {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --bg-header: #0d0d0d;
    --bg-input: #000000;
    --text-primary: #ffffff;
    --text-secondary: #f0f0f0;
    --text-muted: #a0a0a0;
    --text-completed: #a0a0a0;
    --accent-color: #00ff00;
    --accent-hover: #00ff88;
    --border-color: #333333;
    --border-hover: #1a1a1a;
    --info-color: #00ffff;
}

body[data-theme="matrix"] {
    --bg-primary: #000000;
    --bg-secondary: #0d1a0d;
    --bg-header: #000a00;
    --bg-input: #000000;
    --text-primary: #00ff41;
    --text-secondary: #00cc33;
    --text-muted: #008822;
    --text-completed: #008822;
    --accent-color: #00ff41;
    --accent-hover: #00ff88;
    --border-color: #008822;
    --border-hover: #0d1a0d;
    --info-color: #00ffff;
    --error-color: #ff0041;
}

/* Matrix theme specific overrides for consistency */
body[data-theme="matrix"] .todo-checkbox.checked {
    color: #000000;
}

body[data-theme="white-on-black"] .terminal-input:focus {
    box-shadow: 0 0 0 1px rgba(0, 255, 0, 0.2);
}

body[data-theme="solarized-light"] {
    --bg-primary: #fdf6e3;
    --bg-secondary: #eee8d5;
    --bg-header: #fdf6e3;
    --bg-input: #fdf6e3;
    --text-primary: #657b83;
    --text-secondary: #839496;
    --text-muted: #93a1a1;
    --text-completed: #93a1a1;
    --accent-color: #859900;
    --accent-hover: #b58900;
    --border-color: #93a1a1;
    --border-hover: #839496;
    --success-color: #859900;
    --error-color: #dc322f;
    --error-hover: #cb4b16;
    --info-color: #268bd2;
}

body[data-theme="retro"] {
    --bg-primary: #282828;
    --bg-secondary: #383838;
    --bg-header: #1c1c1c;
    --bg-input: #282828;
    --text-primary: #ebdbb2;
    --text-secondary: #d5c4a1;
    --text-muted: #665c54;
    --text-completed: #665c54;
    --accent-color: #d79921;
    --accent-hover: #fabd2f;
    --border-color: #504945;
    --border-hover: #1c1c1c;
    --success-color: #b8bb26;
    --error-color: #fb4934;
    --error-hover: #cc241d;
    --info-color: #458588;
}

body {
    margin: 0;
    padding: 20px;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.terminal {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.terminal-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.terminal-title {
    font-weight: 600;
    color: var(--accent-color);
}

.terminal-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.terminal-user {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Info menu styling */
.info-menu {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Header buttons - both info and archive */
.header-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    border-radius: 3px;
    transition: all 0.2s ease;
    line-height: 1;
}

.header-button:hover {
    color: var(--accent-color);
    background-color: var(--bg-primary);
}

.info-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 16px;
    min-width: 320px;
    max-width: 400px;
    display: none;
    z-index: 1000;
}

.info-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

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

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h4 {
    margin: 0 0 8px 0;
    color: var(--accent-color);
    font-size: 14px;
    font-weight: 600;
}

.info-section p {
    margin: 4px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.info-section code {
    background-color: var(--bg-primary);
    padding: 2px 4px;
    border-radius: 3px;
    color: var(--text-primary);
}

.theme-selector {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 4px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.theme-selector:hover {
    border-color: var(--accent-color);
}

.theme-selector:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.terminal-body {
    padding: 16px;
    min-height: 400px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease;
}

.terminal-output {
    margin-bottom: 8px;
    padding: 8px 12px;
    background-color: var(--info-color);
    color: #ffffff;
    border-radius: 3px;
    font-size: 14px;
    animation: fadeIn 0.3s ease-in;
}

.terminal-footer {
    background-color: var(--bg-header);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.terminal-actions {
    display: flex;
    gap: 12px;
    font-size: 14px;
}

.terminal-link {
    color: var(--accent-color);
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    transition: all 0.2s ease;
}

.terminal-link:hover {
    background-color: var(--accent-color);
    color: var(--bg-primary);
    border-color: var(--accent-color);
}

/* Todo specific styling */
.todo-container {
    margin-bottom: 16px;
}

.todo-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.todo-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease, opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
    opacity: 1;
}

/* Animation when todo is marked as completed */
.todo-item.completing {
    animation: slideToComplete 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
    opacity: 0.7;
    transform-origin: center left;
}

@keyframes slideToComplete {
    0% {
        opacity: 1;
        transform: scaleX(1) translateX(0);
    }
    30% {
        opacity: 0.8;
        transform: scaleX(0.98) translateX(4px);
    }
    100% {
        opacity: 1;
        transform: scaleX(1) translateX(0);
    }
}

.todo-item:hover {
    background-color: var(--border-hover);
    border-radius: 3px;
    margin: 0 -4px;
    padding: 8px 4px;
}

.todo-checkbox {
    border: none;
    background-color: transparent;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1;
    width: auto;
    height: auto;
    padding: 0 4px;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
}

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

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

.todo-content {
    flex: 1;
    color: var(--text-primary);
    word-break: break-word;
    font-size: 13px;
}

.todo-content.completed {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.todo-meta {
    font-size: 12px;
    color: var(--text-secondary);
    cursor: help;
    white-space: nowrap;
}

/* Child item indentation */
.todo-item.child-level-1 {
    margin-left: 2em;
}
.todo-item.child-level-2 {
    margin-left: 4em;
}
.todo-item.child-level-3 {
    margin-left: 6em;
}
.todo-item.child-level-4 {
    margin-left: 8em;
}
.todo-item.child-level-5 {
    margin-left: 10em;
}

/* Forms */
.terminal-form {
    margin-bottom: 16px;
}

.terminal-prompt {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.prompt-symbol {
    color: var(--accent-color);
    font-weight: 600;
}

.terminal-label {
    color: var(--text-primary);
    font-weight: normal;
}

.terminal-input {
    flex: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    border-radius: 3px;
    transition: border-color 0.2s ease;
    min-width: 0;
}

.terminal-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
    opacity: 0.2;
}

.terminal-button {
    background-color: var(--accent-color);
    color: var(--bg-primary);
    border: none;
    padding: 12px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.terminal-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.terminal-button:active {
    transform: translateY(0);
}

/* Archive specific styling */
.archive-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.archive-filters {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.archive-filter {
    flex: 1;
    min-width: 150px;
}

.archive-item {
    padding: 12px;
    margin-bottom: 8px;
    background-color: var(--bg-header);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.archive-item:hover {
    opacity: 1;
}

.archive-item-content {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 4px;
}

.archive-item-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.delete-button {
    background-color: var(--error-color);
    color: #ffffff;
    border: none;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.delete-button:hover {
    background-color: var(--error-hover);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-style: italic;
}

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

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

.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .terminal {
        border-radius: 0;
    }

    .terminal-header,
    .terminal-body,
    .terminal-footer {
        padding: 12px;
    }

    .archive-filters {
        flex-direction: column;
    }

    .archive-filter {
        min-width: auto;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
.todo-checkbox:focus-visible,
.terminal-link:focus-visible,
.terminal-button:focus-visible,
.terminal-input:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}