/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
    --accent: #4caf50;
    --accent-dim: rgba(76, 175, 80, 0.15);
    --bg: #121212;
    --surface: #1e1e1e;
    --surface2: #2a2a2a;
    --border: #333;
    --text: #f1f1f1;
    --text-muted: #888;
    --delete: #e53935;
    --radius: 0.5rem;
    --transition: 0.22s ease;
}

body.frequent-mode {
    --accent: #16a2e7;
    --accent-dim: rgba(22, 162, 231, 0.15);
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { background-color: var(--bg); margin: 0; }
body { color: var(--text); font-family: sans-serif; }

/* ─── Container ─────────────────────────────────────────────── */
.container { padding: 1rem; max-width: 680px; margin: 0 auto; }

/* ─── Header ────────────────────────────────────────────────── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
h1 { font-size: 2rem; color: var(--text); margin: 0; }

.header-right { display: flex; align-items: center; gap: 0.75rem; }

/* ─── Status pill ───────────────────────────────────────────── */
.status {
    padding: 0.3rem 0.8rem;
    border-radius: 1rem;
    font-weight: bold;
    background-color: #5a5a5a;
    color: #e1e1e1;
    font-size: 0.85rem;
}
.status.online { background-color: var(--accent); color: white; }

/* ─── Frequent toggle button ────────────────────────────────── */
.frequent-toggle {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
    flex-shrink: 0;
}
.frequent-toggle svg { width: 1.1rem; height: 1.1rem; fill: none; }
.frequent-toggle:hover { color: var(--accent); border-color: var(--accent); }
.frequent-toggle.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}
.frequent-toggle.active svg {
    fill: var(--accent);
}

/* ─── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tab-btn {
    flex: 1;
    padding: 0.8rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    transition: color var(--transition), border-bottom-color var(--transition);
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Tab content ───────────────────────────────────────────── */
.tab-content { padding: 1rem 0; }

/* ─── Forms ─────────────────────────────────────────────────── */
form { display: flex; margin-bottom: 1.5rem; }
input[type='text'] {
    flex-grow: 1;
    padding: 0.8rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    background-color: var(--surface2);
    color: var(--text);
    border-radius: var(--radius) 0 0 var(--radius);
    transition: outline var(--transition), border-color var(--transition);
}
input[type='text']:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
form button {
    padding: 0.8rem 1.2rem;
    font-size: 1.5rem;
    border: none;
    background-color: var(--accent);
    color: white;
    cursor: pointer;
    border-radius: 0 var(--radius) var(--radius) 0;
    transition: background-color var(--transition);
}

/* ─── List items ────────────────────────────────────────────── */
ul { list-style: none; padding: 0; margin: 0; }

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    min-height: 3.5rem;
    padding: 0 0 0 1rem;
}
.item-name { font-size: 1.1rem; }

/* ─── Controls (regular list) ───────────────────────────────── */
.controls { display: flex; align-items: center; padding: 0.5rem 0; }
.controls button {
    background: #333;
    color: var(--text);
    border: none;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    margin: 0 0.3rem;
    display: grid;
    place-items: center;
    transition: background var(--transition);
}
.count { font-size: 1.2rem; min-width: 2rem; text-align: center; }
.controls .delete-btn {
    background: var(--delete);
    color: white;
    border: none;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.4rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    margin: 0.5rem;
}

/* ─── Frequent items ────────────────────────────────────────── */
.frequent-item-btn {
    all: unset;
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border-radius: var(--radius);
    padding: 0.5rem 0;
    user-select: none;
    -webkit-user-select: none;
}
#frequent-items-list .delete-btn {
    background: var(--delete);
    color: white;
    border: none;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.4rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    margin: 0.5rem;
}
.checkbox {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #555;
    border-radius: 50%;
    margin-right: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent);
    font-weight: bold;
    flex-shrink: 0;
    transition: border-color var(--transition);
}
.list-item.selected .checkbox { border-color: var(--accent); }

/* ─── Import button ─────────────────────────────────────────── */
#import-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color var(--transition);
}

/* ─── Frequent mode label in header ─────────────────────────── */
.frequent-badge {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-left: 0.5rem;
    opacity: 0;
    transition: opacity var(--transition);
}
body.frequent-mode .frequent-badge { opacity: 1; }

/* ─── Empty state ───────────────────────────────────────────── */
.empty-message { text-align: center; color: var(--text-muted); margin-top: 2rem; }
