/* ==========================================================================
   Fishbowl — App-wide styles
   Design tokens at :root. Shadow-DOM components inherit via CSS custom
   properties.
   ========================================================================== */

/* Self-hosted fonts (OFL 1.1). Served from /fonts/ via the embedded resource
   pipeline so we don't phone home to fonts.googleapis.com on every load.
   Mirrors the old <link> request: Inter 400/500/600, Outfit 600/700/800.
   latin + latin-ext subsets (covers most European text); anything outside
   those unicode-ranges falls back to the system sans stack below. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('/fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/outfit-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/outfit-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('/fonts/outfit-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 600 800;
    font-display: swap;
    src: url('/fonts/outfit-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --bg:           #0a0a0a;
    --panel:        #1e1e1e;
    --accent:       #3b82f6;
    --accent-edit:  #a855f7;
    --accent-warm:  #f97316;
    --danger:       #ef4444;
    --border:       rgba(255, 255, 255, 0.08);
    --text:         #f8fafc;
    --text-muted:   #64748b;
    --glass:        rgba(15, 23, 42, 0.7);
    --bg-dark:      #000000;

    /* Tag palette. Slot names mirror Fishbowl.Core.Util.TagPalette.Slots so the
       backend can store names instead of hex and a future theme can shift the
       palette without rewriting persisted tag colors. */
    --tag-blue:     #3b82f6;
    --tag-orange:   #f97316;
    --tag-red:      #ef4444;
    --tag-green:    #10b981;
    --tag-purple:   #8b5cf6;
    --tag-pink:     #ec4899;
    --tag-yellow:   #eab308;
    --tag-teal:     #14b8a6;
    --tag-gray:     #64748b;
    --tag-indigo:   #6366f1;
}

/* Modern themed scrollbars — global.
   Note: this `*` selector does NOT pierce Shadow DOM; components with their
   own scrollable areas inside shadow roots must duplicate these rules. */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    background-clip: content-box;
    border: 2px solid transparent;
    border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.32);
    background-clip: content-box;
}
*::-webkit-scrollbar-corner { background: transparent; }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, textarea {
    font-family: inherit;
    color: inherit;
}

/* Decorative background orb — used on hub, login, setup */
.orb {
    position: fixed;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    top: -10vw;
    right: -10vw;
    z-index: -1;
    pointer-events: none;
}

/* Glassmorphic panel */
.glass {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Logo mark — blue top, orange bottom (goldfish) */
.fb-logo-mark {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 14px;
    height: 20px;
}
.fb-logo-mark .top    { flex: 1; background: var(--accent);      border-radius: 10px 10px 0 0; }
.fb-logo-mark .bottom { flex: 1; background: var(--accent-warm); border-radius: 0 0 10px 10px; }

/* SPA mount point */
#app-root {
    padding-top: 50px; /* leave room for fixed <fb-nav> */
    min-height: 100vh;
}

/* Hub container */
.hub-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem 2rem;
}
.hub-container header {
    text-align: center;
    margin-bottom: 3rem;
}
.hub-container h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}
.hub-container .intro-text {
    color: var(--text-muted);
    font-size: 1.125rem;
}

/* Tile grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: 280px;
    gap: 1.5rem;
}

.tile {
    position: relative;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    cursor: pointer;
}
.tile fb-icon {
    --icon-size: 48px;
    margin-bottom: auto;
    color: var(--accent);
    transition: transform 0.4s ease;
}
.tile h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.tile p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}
.tile:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(59, 130, 246, 0.2);
}
.tile:hover fb-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Tool-page layout */
.tool-layout {
    display: flex;
    height: calc(100vh - 50px);
    overflow: hidden;
}
.tool-sidebar {
    width: 260px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    overflow-y: auto;
    flex-shrink: 0;
}
.tool-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Scrollbars are themed globally at the top of this file; per-element
   webkit rules were previously duplicated here — no longer needed. */

/* Base button classes (used inside Shadow DOM too via :host-context support) */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: var(--glass);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    transition: all 0.2s;
}
.btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}
.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}
.btn.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* Centered pre-auth card (login + setup) */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    text-align: center;
}
.auth-card .fb-logo-mark {
    width: 28px;
    height: 40px;
    margin: 0 auto 1rem;
}
/* Login screen uses the full fishbowl illustration instead of the pill —
   bigger canvas + room for the goldfish, water, bubbles, glass highlight. */
.auth-card .fb-fishbowl {
    display: block;
    width: 88px;
    height: 88px;
    margin: 0 auto 1.25rem;
    filter: drop-shadow(0 8px 20px rgba(59, 130, 246, 0.28));
}
.auth-card h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}
.auth-card .tagline {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}
.auth-card .form-group {
    text-align: left;
    margin-bottom: 1rem;
}
.auth-card label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-card input[type="text"],
.auth-card input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
.auth-card input:focus {
    outline: none;
    border-color: var(--accent);
}
.auth-card .providers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.auth-card .provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s;
}
.auth-card .provider-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}
.auth-card .error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ───── Vault passphrase modal (fb.vault promptPassphrase) ───── */
/* Plain DOM overlay; glass-styled to match fb-dialog without inheriting
   its confirm-button shape. Lives in document (not shadow) so autofocus
   and password managers find the input. */
.fb-vault-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    animation: fb-vault-fade 0.18s ease-out;
}
@keyframes fb-vault-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.fb-vault-dialog {
    min-width: 360px;
    max-width: 480px;
    padding: 28px 32px 22px;
    background: var(--panel, #1e1e1e);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    font-family: 'Inter', sans-serif;
    color: var(--text, #fff);
}
.fb-vault-dialog h2 {
    margin: 0 0 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--accent-warm, #f59e0b);
}
.fb-vault-msg {
    margin: 0 0 18px;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-muted, #bbb);
}
.fb-vault-msg strong { color: var(--text, #fff); font-weight: 600; }
.fb-vault-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    letter-spacing: 0.02em;
}
.fb-vault-input {
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    color: var(--text, #fff);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.12s, background 0.12s;
}
.fb-vault-input:focus {
    border-color: var(--accent-warm, #f59e0b);
    background: rgba(255, 255, 255, 0.06);
}
.fb-vault-error {
    margin: 4px 0 12px;
    font-size: 0.82rem;
    color: var(--danger, #ef4444);
}
.fb-vault-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}
.fb-vault-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    border-radius: 6px;
    color: var(--text, #fff);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.fb-vault-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}
.fb-vault-btn.fb-vault-ok {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--accent-warm, #f59e0b);
}
.fb-vault-btn.fb-vault-ok:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: var(--accent-warm, #f59e0b);
}
