/* TypeRhythm GUI - Dark Theme */

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #252525;
    --bg-tertiary: #2f2f2f;
    --border-color: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-primary: #4a9eff;
    --accent-hover: #6ab0ff;
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

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

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

.header h1 { font-size: 1.5rem; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 1rem; }
.status { font-size: 0.8rem; }
.status.running { color: var(--success); }
.status.stopped { color: var(--danger); }
#status-text { font-size: 0.9rem; color: var(--text-secondary); }

.auth-gate {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.auth-form h2 { margin-bottom: 0.5rem; }
.auth-form p { color: var(--text-secondary); margin-bottom: 1.5rem; }
.auth-form input {
    width: 100%;
    padding: 0.7rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}
.auth-form input:focus { outline: none; border-color: var(--accent-primary); }

.main-layout { display: flex; flex: 1; overflow: hidden; }
.content { flex: 1; padding: 2rem; overflow-y: auto; }
.view { display: none; }
.view.active { display: block; }

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.view-header h2 { font-size: 1.8rem; }

.search-bar { flex: 1; max-width: 400px; margin: 0 1rem; }
.search-bar input {
    width: 100%;
    padding: 0.6rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
}
.search-bar input:focus { outline: none; border-color: var(--accent-primary); }

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: var(--accent-primary); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-secondary:hover { background: var(--border-color); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #ef4444; }

.snippet-list { display: grid; gap: 0.75rem; }
.snippet-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: border-color 0.2s;
}
.snippet-item:hover { border-color: var(--accent-primary); }
.snippet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.snippet-trigger {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 1.1rem;
    color: var(--accent-primary);
    font-weight: 600;
}
.snippet-actions { display: flex; gap: 0.5rem; }
.snippet-actions button { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.snippet-replace {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 100px;
    overflow: hidden;
}
.snippet-meta {
    margin-top: 0.5rem;
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.snippet-badge {
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 1.3rem; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.5rem; }

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.7rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
}
.form-group input[type="text"]:focus,
.form-group textarea:focus { outline: none; border-color: var(--accent-primary); }
.form-group textarea { resize: vertical; font-family: 'Monaco', 'Courier New', monospace; }
.form-group small { display: block; margin-top: 0.3rem; font-size: 0.85rem; color: var(--text-secondary); }
.form-group input[type="checkbox"] { margin-right: 0.5rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }

#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
