@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..800;1,14..32,300..800&display=swap');

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

[x-cloak] { display: none !important; }

/* ── Base Typography ──────────────────────────────── */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    font-variation-settings: "opsz" 14;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-synthesis: none;
    font-smooth: always;
    line-height: 1.5;
    letter-spacing: -.012em;
}

/* ── CSS Variables ────────────────────────────────── */
:root {
    --ring-color:             hsl(240 5.9% 10%);
    --muted-foreground:       hsl(240 4% 44%);
    --border-color:           hsl(240 6% 89%);
    --primary:                hsl(240 5.9% 10%);
    --primary-foreground:     hsl(0 0% 98%);
    --secondary:              hsl(240 5% 96%);
    --secondary-foreground:   hsl(240 5.9% 10%);
    --destructive:            hsl(0 84.2% 60.2%);
    --destructive-foreground: hsl(0 0% 98%);
    --page-bg:                hsl(220 18% 95.5%);
    --card-bg:                hsl(0 0% 100%);
    --card-shadow:            0 1px 3px hsla(240,6%,10%,.07), 0 1px 2px hsla(240,6%,10%,.05);
    --radius:                 .375rem;
}

/* ── Scrollbars ────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: hsl(240 5% 82%);
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: hsl(240 4% 62%); }

/* Thin scrollbar for log / scroll areas */
.scroll-logs { scrollbar-width: thin; }
.scroll-logs::-webkit-scrollbar { width: 4px; height: 4px; }
.scroll-logs::-webkit-scrollbar-track { background: transparent; }
.scroll-logs::-webkit-scrollbar-thumb {
    background: hsl(240 5% 84%);
    border-radius: 4px;
}

/* Hide scrollbar utility (keep functionality) */
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: var(--radius);
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -.005em;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition:
        background-color .15s ease,
        color .15s ease,
        border-color .15s ease,
        box-shadow .15s ease,
        opacity .15s ease;
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px var(--ring-color);
}

.btn:disabled {
    pointer-events: none;
    opacity: .45;
}

.btn-default {
    background-color: var(--primary);
    color: var(--primary-foreground);
}
.btn-default:hover  { background-color: hsl(240 5.9% 16%); }
.btn-default:active { background-color: hsl(240 5.9% 7%); }

.btn-destructive {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
}
.btn-destructive:hover { background-color: hsl(0 84.2% 54%); }

.btn-outline {
    border: 1px solid var(--border-color);
    background-color: transparent;
}
.btn-outline:hover {
    background-color: var(--secondary);
    color: hsl(240 5.9% 10%);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}
.btn-secondary:hover { background-color: hsl(240 5% 91%); }

.btn-ghost { background-color: transparent; }
.btn-ghost:hover {
    background-color: var(--secondary);
    color: hsl(240 5.9% 10%);
}

.btn-link {
    color: var(--primary);
    text-decoration: none;
    text-underline-offset: 4px;
}
.btn-link:hover { text-decoration: underline; }

.btn-sm {
    height: 1.875rem;
    border-radius: calc(var(--radius) - 1px);
    padding-inline: .625rem;
    font-size: .75rem;
}

.btn-default-size {
    height: 2.125rem;
    padding-inline: 1rem;
    padding-block: .35rem;
}

.btn-lg {
    height: 2.375rem;
    border-radius: var(--radius);
    padding-inline: 1.5rem;
}

.btn-icon {
    height: 2rem;
    width: 2rem;
    flex-shrink: 0;
}

/* ── Cards ────────────────────────────────────────── */
.card {
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: hsl(240 10% 3.9%);
    box-shadow: var(--card-shadow);
}

/* ── Form Inputs ──────────────────────────────────── */
.input {
    display: flex;
    height: 2.125rem;
    width: 100%;
    border-radius: calc(var(--radius) - 1px);
    border: 1px solid var(--border-color);
    background-color: transparent;
    padding-inline: .7rem;
    padding-block: .25rem;
    font-size: .8125rem;
    font-family: inherit;
    line-height: 1.5;
    color: hsl(240 10% 3.9%);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input::placeholder { color: var(--muted-foreground); opacity: .75; }

.input:focus,
.input:focus-visible {
    outline: none;
    border-color: hsl(240 5.9% 36%);
    box-shadow: 0 0 0 3px hsla(240, 5.9%, 10%, .10);
}

.input:disabled { cursor: not-allowed; opacity: .5; }

/* ── Textarea ─────────────────────────────────────── */
.textarea {
    display: flex;
    min-height: 80px;
    max-height: 200px;
    height: 100px;
    text-transform: uppercase;
    width: 100%;
    border-radius: calc(var(--radius) - 1px);
    border: 1px solid var(--border-color);
    background-color: transparent;
    padding: .45rem .7rem;
    font-size: .8125rem;
    font-family: inherit;
    line-height: 1.5;
    color: hsl(240 10% 3.9%);
    resize: vertical;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.textarea::placeholder { color: var(--muted-foreground); opacity: .75; }

.textarea:focus,
.textarea:focus-visible {
    outline: none;
    border-color: hsl(240 5.9% 36%);
    box-shadow: 0 0 0 3px hsla(240, 5.9%, 10%, .10);
}

.textarea:disabled { cursor: not-allowed; opacity: .5; }

/* ── Badges ───────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: calc(var(--radius) - 1px);
    border-width: 1px;
    border-style: solid;
    padding-inline: .4rem;
    padding-block: .12rem;
    font-size: .6875rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: .01em;
}

.badge-default {
    border-color: transparent;
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.badge-secondary {
    border-color: transparent;
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}

.badge-destructive {
    border-color: transparent;
    background-color: var(--destructive);
    color: var(--destructive-foreground);
}

.badge-outline {
    border-color: var(--border-color);
    color: hsl(240 10% 3.9%);
    background-color: transparent;
}

/* ── Separator ────────────────────────────────────── */
.separator {
    flex-shrink: 0;
    background-color: var(--border-color);
    height: 1px;
    width: 100%;
}

/* ── Utilities ────────────────────────────────────── */
.up-text { text-transform: uppercase; }

/* Code / mono elements */
code, .font-mono {
    font-variant-ligatures: none;
    -webkit-font-smoothing: subpixel-antialiased;
}

/* ── Mobile-first touch optimisation ─────────────── */
@media (max-width: 639px) {
    .input {
        height: 2.5rem;
        font-size: .875rem;
    }

    .textarea {
        font-size: .875rem;
    }

    .btn-default-size {
        height: 2.5rem;
    }

    .btn-sm {
        height: 2.125rem;
        padding-inline: .75rem;
    }

    .btn-icon {
        height: 2.25rem;
        width: 2.25rem;
    }
}
