/* ══════════════════════════════════════════════════════
   Frittomatic UI — Dark + Neon Glassmorphism
   Tailwind v4 browser + custom properties, no frameworks
   ══════════════════════════════════════════════════════ */

/* ── Design Tokens ───────────────────────────────────── */
:root {
    /* Backgrounds */
    --bg-body: #0b0d14;
    --bg-surface: rgba(255, 255, 255, 0.035);
    --bg-surface-hover: rgba(255, 255, 255, 0.065);
    --bg-sidebar: rgba(12, 14, 22, 0.72);
    --bg-topbar: rgba(12, 14, 22, 0.60);

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    /* Text */
    --text-1: rgba(255, 255, 255, 0.92);
    --text-2: rgba(255, 255, 255, 0.60);
    --text-3: rgba(255, 255, 255, 0.38);
    --text-4: rgba(255, 255, 255, 0.22);

    /* Neon palette */
    --cyan: #00e5cc;
    --violet: #b06cff;
    --pink: #ff5caa;
    --lime: #6eff8e;
    --amber: #ffbf44;
    --red: #ff5555;

    /* Neon with alpha */
    --cyan-a15: rgba(0, 229, 204, 0.15);
    --cyan-a25: rgba(0, 229, 204, 0.25);
    --violet-a15: rgba(176, 108, 255, 0.15);
    --violet-a25: rgba(176, 108, 255, 0.25);
    --pink-a15: rgba(255, 92, 170, 0.15);
    --pink-a25: rgba(255, 92, 170, 0.25);
    --lime-a15: rgba(110, 255, 142, 0.15);
    --lime-a25: rgba(110, 255, 142, 0.25);
    --amber-a15: rgba(255, 191, 68, 0.15);
    --amber-a25: rgba(255, 191, 68, 0.25);

    font-family: "Inter", system-ui, -apple-system, sans-serif;
    color: var(--text-1);
}

/* ── Page background with color blobs ────────────────── */
html, body {
    background: var(--bg-body);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle 600px at 5% 95%, rgba(176, 108, 255, 0.18), transparent),
        radial-gradient(circle 500px at 90% 5%, rgba(0, 229, 204, 0.14), transparent),
        radial-gradient(circle 400px at 45% 45%, rgba(255, 92, 170, 0.08), transparent),
        radial-gradient(circle 350px at 85% 80%, rgba(110, 255, 142, 0.06), transparent);
}

/* ── Layout ──────────────────────────────────────────── */
.app {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

@media (min-width: 1024px) {
    .app-main { margin-left: 16rem; }
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 16rem;
    z-index: 40;
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
    backdrop-filter: blur(40px) saturate(1.6);
    -webkit-backdrop-filter: blur(40px) saturate(1.6);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.open { transform: translateX(0); }

@media (min-width: 1024px) {
    .sidebar { transform: translateX(0); }
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 1024px) {
    .sidebar-overlay { display: none; }
}

/* ── Navigation items ────────────────────────────────── */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    border-radius: 0.625rem;
    font-size: 0.9rem;
    color: var(--text-2);
    text-decoration: none;
    transition: all 0.18s ease;
    border-left: 3px solid transparent;
    margin-left: -3px;
}

.nav-link:hover {
    color: var(--text-1);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--cyan);
    background: var(--cyan-a15);
    border-left-color: var(--cyan);
    font-weight: 600;
}

.nav-link .nav-emoji {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── Glass surface ───────────────────────────────────── */
.glass {
    background: var(--bg-surface);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border: 1px solid var(--border);
    border-radius: 1rem;
}

/* ── Glass cards ─────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.25s ease,
                border-color 0.25s ease,
                box-shadow 0.25s ease;
}

a.card { cursor: pointer; }

a.card:hover {
    transform: translateY(-3px);
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
}

/* Card glow on hover */
a.card.glow-cyan:hover    { border-color: var(--cyan-a25);   box-shadow: 0 8px 32px rgba(0, 229, 204, 0.12); }
a.card.glow-violet:hover  { border-color: var(--violet-a25); box-shadow: 0 8px 32px rgba(176, 108, 255, 0.12); }
a.card.glow-pink:hover    { border-color: var(--pink-a25);   box-shadow: 0 8px 32px rgba(255, 92, 170, 0.12); }
a.card.glow-lime:hover    { border-color: var(--lime-a25);   box-shadow: 0 8px 32px rgba(110, 255, 142, 0.12); }
a.card.glow-amber:hover   { border-color: var(--amber-a25);  box-shadow: 0 8px 32px rgba(255, 191, 68, 0.12); }

/* Card title color on hover */
a.card.glow-cyan:hover   .card-title { color: var(--cyan); }
a.card.glow-violet:hover .card-title { color: var(--violet); }
a.card.glow-pink:hover   .card-title { color: var(--pink); }
a.card.glow-lime:hover   .card-title { color: var(--lime); }
a.card.glow-amber:hover  .card-title { color: var(--amber); }

.card-icon { font-size: 2.25rem; line-height: 1; }
.card-title { font-size: 1.1rem; font-weight: 600; transition: color 0.2s ease; }
.card-desc { font-size: 0.85rem; color: var(--text-3); margin-top: 0.125rem; }

/* ── Glass table ─────────────────────────────────────── */
.glass-table {
    position: relative;
    border-radius: 1rem;
    isolation: isolate;
}

.glass-table::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    box-sizing: border-box;
    z-index: 0;
    pointer-events: none;
}

.glass-table__viewport {
    position: relative;
    border-radius: inherit;
    overflow: hidden;
    z-index: 1;
}

.glass-table__viewport--scroll {
    overflow-x: auto;
    overflow-y: hidden;
}

.glass-table__viewport--no-clip {
    overflow: visible;
}

.glass-table table { width: 100%; border-collapse: collapse; }

.glass-table thead { border-bottom: 1px solid var(--border); }

.glass-table th {
    padding: 0.8rem 1rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-3);
}

.glass-table td { padding: 0.75rem 1rem; }

.glass-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.025);
    transition: background 0.12s ease;
}

.glass-table tbody tr:last-child { border-bottom: none; }
.glass-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.2rem;
    border-radius: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s ease;
    line-height: 1.4;
}

.btn-primary {
    background: var(--cyan);
    color: #0b0d14;
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(0, 229, 204, 0.30);
    filter: brightness(1.08);
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-1);
}

/* ── Badge ───────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid var(--cyan-a25);
    color: var(--cyan);
}

/* ── Form controls ───────────────────────────────────── */
.fm-input, .fm-textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-1);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fm-input:focus, .fm-textarea:focus {
    border-color: var(--cyan-a25);
    box-shadow: 0 0 0 3px rgba(0, 229, 204, 0.08);
}

.fm-textarea { resize: vertical; min-height: 10rem; }
.fm-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.35rem; }

/* ── Alerts ──────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 0.6rem;
    font-size: 0.875rem;
    border: 1px solid;
}

.alert-error { background: rgba(255, 85, 85, 0.08); border-color: rgba(255, 85, 85, 0.20); color: #ff8888; }
.alert-success { background: rgba(110, 255, 142, 0.08); border-color: rgba(110, 255, 142, 0.20); color: #8dffaa; }

/* ── Pagination ──────────────────────────────────────── */
.pagination { display: flex; gap: 0.25rem; }

.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-2);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.15s ease;
}

.pagination a:hover { background: var(--bg-surface-hover); color: var(--text-1); }

.pagination a.active {
    background: var(--cyan);
    color: #0b0d14;
    border-color: transparent;
    font-weight: 700;
}

/* ── Avatar ──────────────────────────────────────────── */
.avatar {
    border-radius: 22%;
    object-fit: cover;
    outline: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Breadcrumb link ─────────────────────────────────── */
.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.82rem;
    color: var(--text-3);
    text-decoration: none;
    transition: color 0.15s ease;
    margin-bottom: 0.75rem;
}

.breadcrumb:hover { color: var(--text-2); }

/* ── Gradient text ───────────────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, var(--cyan), var(--violet), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Tooltip (CSS-only) ──────────────────────────────── */
.tip { position: relative; }

.tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.96);
    padding: 0.3rem 0.55rem;
    border-radius: 0.35rem;
    font-size: 0.68rem;
    white-space: nowrap;
    background: rgba(20, 22, 35, 0.95);
    color: var(--text-1);
    border: 1px solid var(--border);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 50;
}

.tip:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }

/* ── Mobile topbar ───────────────────────────────────── */
.topbar {
    background: var(--bg-topbar);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border-bottom: 1px solid var(--border);
}

/* ── Connection row ──────────────────────────────────── */
.connect-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem;
    border-radius: 0.85rem;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.22s ease;
}

.connect-row:hover {
    background: var(--bg-surface-hover);
    transform: translateY(-1px);
}
