/* ============================================================
   Base reset + shared components
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-1);
    background:
        radial-gradient(1100px 420px at 18% -10%, rgba(61, 220, 151, 0.07), transparent 60%),
        radial-gradient(900px 380px at 95% 0%, rgba(108, 178, 255, 0.05), transparent 55%),
        var(--bg-0);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol {
    margin: 0;
}

ul,
ol {
    padding: 0;
    list-style: none;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-strong);
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

input,
textarea,
select {
    font: inherit;
    color: var(--text-1);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

::selection {
    background: var(--accent-dim);
}

/* scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-3) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-thumb {
    background: var(--bg-3);
    border-radius: 4px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-s);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    transition:
        background var(--speed) var(--ease),
        border-color var(--speed) var(--ease),
        color var(--speed) var(--ease),
        transform var(--speed) var(--ease);
    user-select: none;
    white-space: nowrap;
}

.btn:active {
    transform: translateY(1px);
}

.btn.primary {
    background: var(--accent);
    color: #08281b;
}

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

.btn.ghost {
    background: var(--bg-2);
    border-color: var(--border);
    color: var(--text-1);
}

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

.btn.danger {
    background: var(--danger-dim);
    color: var(--danger);
    border-color: transparent;
}

.btn.danger:hover {
    background: var(--danger);
    color: #2b0a09;
}

.btn.sm {
    padding: 5px 10px;
    font-size: 12.5px;
    border-radius: 6px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- inputs ---------- */

.input {
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text-1);
    transition: border-color var(--speed) var(--ease);
}

.input::placeholder {
    color: var(--text-3);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field > label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
}

.field-hint {
    font-size: 12px;
    color: var(--text-3);
}

/* ---------- badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--bg-3);
    color: var(--text-2);
}

.badge.host {
    background: var(--warn-dim);
    color: var(--warn);
}

.badge.temp {
    background: rgba(108, 178, 255, 0.14);
    color: var(--info);
}

.badge.lock {
    background: var(--warn-dim);
    color: var(--warn);
}

.badge.on {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ---------- overlay / modal ---------- */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 11, 16, 0.78);
    backdrop-filter: blur(6px);
    animation: fade-in 0.16s var(--ease);
}

.modal {
    width: 100%;
    max-width: 400px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    padding: 26px;
    box-shadow: var(--shadow-1);
}

.modal h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

/* ---------- toasts ---------- */

.toasts {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    padding: 9px 18px;
    border-radius: var(--radius-m);
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-1);
    animation: toast-in 0.2s var(--ease);
    max-width: min(90vw, 480px);
}

.toast.warn {
    border-color: var(--warn);
    color: var(--warn);
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

.toast.ok {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---------- misc ---------- */

.hidden {
    display: none !important;
}

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

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- light theme overrides (dark stays the default) ---------- */

html[data-theme='light'] body {
    background:
        radial-gradient(1100px 420px at 18% -10%, rgba(0, 153, 255, 0.06), transparent 60%),
        radial-gradient(900px 380px at 95% 0%, rgba(0, 153, 255, 0.04), transparent 55%),
        var(--bg-0);
}

/* blue/danger buttons carry white text on the light palette */
html[data-theme='light'] .btn.primary,
html[data-theme='light'] .btn.danger {
    color: #fff;
}

html[data-theme='light'] .overlay {
    background: rgba(23, 32, 45, 0.42);
}
