@import url('https://fonts.googleapis.com/css2?family=Boogaloo&family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
    --bg: #f4f5fb;
    --bg-soft: #f9faff;
    --card: #ffffff;
    --text: #1a1e2a;
    --muted: #64718f;
    --line: #e0e5f2;
    --border: var(--line);
    --accent: #bb86fc;
    --accent-strong: #9b59f5;
    --accent-2: #e040fb;
    --ok: #03dac6;
    --warn: #f59e0b;
    --danger: #cf6679;
    --bg-tertiary: rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.14);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.22);
    --glow: rgba(187, 134, 252, 0.12);
    --radius: 10px;
}

[data-theme="dark"] {
    --bg: #0d0d0d;
    --bg-soft: #141414;
    --card: #1a1a1a;
    --text: rgba(255, 255, 255, 0.87);
    --muted: rgba(255, 255, 255, 0.50);
    --line: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --bg-tertiary: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.60);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.75);
    --glow: rgba(187, 134, 252, 0.10);
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(ellipse 60% 45% at 10% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent),
        radial-gradient(ellipse 55% 40% at 90% -15%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── Topnav ───────────────────────────────────────────────────────────────── */
.topnav {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    height: 56px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px);
}

/* ── Brand ────────────────────────────────────────────────────────────────── */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    color: var(--text);
}

.brand-badge { display: none; }

.brand-text { display: flex; flex-direction: column; line-height: 1.05; }

.brand-title {
    font-size: 2rem;
    font-weight: 400;
    font-family: "Boogaloo", cursive;
    background-image: linear-gradient(135deg, #bb86fc, #9b59f5, #e040fb, #bb86fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.02em;
}

.brand-title em { font-style: normal; }

.brand-subtitle {
    font-size: 0.66rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: -2px;
}

/* ── Nav links ────────────────────────────────────────────────────────────── */
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    transition: color 0.18s ease, background 0.18s ease;
}

.nav-links a.active,
.nav-links a:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-tertiary));
}

.nav-links a.nav-disabled-link,
.mobile-links a.nav-disabled-link,
.nav-submenu a.nav-disabled-link,
.user-menu a.nav-disabled-link,
.btn.nav-disabled-link {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── User menu ────────────────────────────────────────────────────────────── */
.user-menu-wrap { position: relative; }

.user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #bb86fc, #9b59f5);
    color: #0d0d0d;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(187, 134, 252, 0.35);
}

.user-menu-label { font-size: 13px; font-weight: 600; }
.user-menu-caret { font-size: 0.7rem; color: var(--muted); }

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 8px;
    display: none;
    z-index: 50;
    animation: fadeDown 0.15s ease;
}

.user-menu.open { display: block; }

.user-menu-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}

.user-menu-name { font-weight: 700; font-size: 14px; }
.user-menu-email { color: var(--muted); font-size: 12px; margin-top: 2px; }

.user-menu a,
.user-menu button {
    display: flex;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    text-align: left;
    transition: background 0.15s;
}

.user-menu a:hover,
.user-menu button:hover { background: var(--bg-tertiary); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.icon-btn,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.18s ease;
    text-decoration: none;
    white-space: nowrap;
}

.icon-btn:hover, .btn:hover {
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-tertiary));
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

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

.btn:disabled, .icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: rgba(255, 255, 255, 0.9);
    color: #0d0d0d;
    border-color: transparent;
    font-weight: 600;
}

[data-theme="dark"] .btn-primary {
    background: rgba(255, 255, 255, 0.90);
    color: #0d0d0d;
}

.btn-primary:hover {
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: rgba(255, 255, 255, 0.18);
}

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

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

/* ── Layout container ─────────────────────────────────────────────────────── */
.container {
    width: min(1120px, calc(100% - 28px));
    margin: 28px auto 28px;
    padding-bottom: 10px;
}

/* ── Cards / Panels ───────────────────────────────────────────────────────── */
.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.panel:hover { box-shadow: var(--shadow); }

.panel + .panel { margin-top: 16px; }

.floating-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

[data-theme="dark"] .floating-card {
    background:
        radial-gradient(circle at top right, rgba(187, 134, 252, 0.06), transparent 40%),
        var(--card);
}

/* ── Typography ───────────────────────────────────────────────────────────── */
.section-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 4px;
}

.subtle { color: var(--muted); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid .full { grid-column: 1 / -1; }

label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--card) 70%, transparent);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: rgba(255, 255, 255, 0.05);
}

input::placeholder, textarea::placeholder { color: var(--muted); }

input:focus, select:focus, textarea:focus {
    border-color: rgba(187, 134, 252, 0.5);
    box-shadow: 0 0 0 3px rgba(187, 134, 252, 0.14);
}

.slug-row { display: flex; gap: 10px; align-items: stretch; }
.slug-row input { flex: 1; }
.slug-lock { min-width: 112px; }

.field-note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 5px;
    line-height: 1.4;
}

/* ── Plan cards ───────────────────────────────────────────────────────────── */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.plan-option {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 120px;
}

.plan-option:hover {
    transform: translateY(-2px);
    border-color: rgba(187, 134, 252, 0.45);
}

.plan-option.active {
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 4px rgba(187, 134, 252, 0.14);
    transform: translateY(-2px);
}

.plan-option .plan-tick {
    display: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    font-size: 11px;
    align-items: center;
    justify-content: center;
    float: right;
    margin-bottom: 6px;
}

.plan-option.active .plan-tick { display: inline-flex; }

.plan-option.suggested {
    border-color: rgba(187, 134, 252, 0.35);
    background:
        linear-gradient(180deg, rgba(187, 134, 252, 0.07), transparent 30%),
        var(--bg-tertiary);
}

.plan-option.suggested .plan-name {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.plan-option.suggested .plan-name::after {
    content: "Recommended";
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    white-space: nowrap;
}

.plan-highlight {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.plan-option input { display: none; }

.plan-option.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.plan-option.disabled:hover { border-color: var(--border); }

.plan-name { font-size: 14px; font-weight: 700; text-transform: capitalize; margin-bottom: 5px; }
.plan-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.plan-price { margin-top: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }

/* ── Workspace meta grid ──────────────────────────────────────────────────── */
.workspace-meta-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    padding: 14px;
}

.workspace-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.workspace-meta-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--card);
}

.workspace-meta-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
}

.workspace-meta-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 13px;
    word-break: break-word;
}

.workspace-meta-value-row { display: flex; align-items: center; gap: 8px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--bg-tertiary); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge.pending      { background: rgba(245, 158, 11, 0.15);  color: #f59e0b; }
.badge.active       { background: rgba(3, 218, 198, 0.15);   color: #03dac6; }
.badge.suspended,
.badge.failed,
.badge.deleted      { background: rgba(207, 102, 121, 0.15); color: #cf6679; }
.badge.provisioning { background: rgba(187, 134, 252, 0.15); color: #bb86fc; }

/* ── Flash messages ───────────────────────────────────────────────────────── */
.flash {
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid transparent;
    font-size: 13px;
    display: none;
    margin-bottom: 14px;
    animation: fadeInUp 0.18s ease;
}

.flash.show { display: block; }

.flash.error {
    background: rgba(207, 102, 121, 0.12);
    border-color: rgba(207, 102, 121, 0.25);
    color: #cf6679;
}

.flash.success {
    background: rgba(3, 218, 198, 0.10);
    border-color: rgba(3, 218, 198, 0.25);
    color: #03dac6;
}

/* ── Auth pages ───────────────────────────────────────────────────────────── */
.auth-shell {
    width: min(1100px, calc(100% - 28px));
    margin: 40px auto 24px;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 18px;
}

.auth-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.auth-hero {
    min-height: 100%;
    padding: 36px 38px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(circle at top left, rgba(187, 134, 252, 0.14), transparent 45%),
        var(--card);
}

[data-theme="dark"] .auth-hero {
    background:
        radial-gradient(circle at top left, rgba(187, 134, 252, 0.14), transparent 48%),
        linear-gradient(175deg, #181818 0%, #111111 100%);
}

.auth-brand { margin-bottom: 20px; }

.auth-brand .brand-title { font-size: 3.2rem; }
.auth-brand .brand-subtitle { font-size: 0.75rem; margin-top: -2px; }

.auth-copy { max-width: 29rem; margin-top: 10px; }

.auth-copy h2 {
    font-size: clamp(1.6rem, 2.4vw, 2.1rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.auth-copy p { color: var(--muted); font-size: 14px; margin-bottom: 10px; }

.auth-bullets { margin-top: 20px; display: grid; gap: 11px; }

.auth-bullet {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13.5px;
}

.auth-bullet span:first-child {
    font-weight: 800;
    color: var(--accent);
    font-size: 1rem;
    line-height: 1.4;
}

.auth-form-wrap {
    padding: 36px 38px;
    display: flex;
    align-items: center;
}

.auth-form-card { width: 100%; }

.auth-form-card .section-title { font-size: 1.3rem; margin-bottom: 4px; }

/* ── Nav dropdown ─────────────────────────────────────────────────────────── */
.nav-dropdown { position: relative; display: inline-flex; align-items: center; }

.nav-dropdown-trigger::after { content: " ▾"; font-size: 0.72rem; color: var(--muted); }

.nav-dropdown.active .nav-dropdown-trigger,
.nav-dropdown.open .nav-dropdown-trigger { color: var(--text); }

.nav-dropdown .nav-dropdown-trigger.nav-disabled-link { pointer-events: auto; cursor: default; }

.nav-submenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 210px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 6px;
    display: none;
    z-index: 20;
}

.nav-submenu a {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--muted);
    font-size: 13px;
    transition: background 0.14s, color 0.14s;
}

.nav-submenu a:hover,
.nav-submenu a.active {
    background: var(--bg-tertiary);
    color: var(--text);
}

.nav-dropdown:hover .nav-submenu,
.nav-dropdown.open .nav-submenu { display: block; }

.nav-dropdown:hover .nav-dropdown-trigger { color: var(--text); }

/* ── Mobile nav ───────────────────────────────────────────────────────────── */
.mobile-menu-btn { display: none; }
.mobile-links { display: none; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto 28px;
    padding: 18px 4px 10px;
    color: var(--muted);
    font-size: 12.5px;
    border-top: 1px solid var(--line);
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.site-footer a { text-decoration: none; color: var(--muted); transition: color 0.15s; }
.site-footer a:hover { color: var(--text); }

/* ── Misc helpers ─────────────────────────────────────────────────────────── */
.workspace-page-intro { display: none; }

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

[data-animate="in"] { opacity: 0; transform: translateY(8px); }
[data-animate="in"].is-visible {
    opacity: 1; transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 840px) {
    .topnav { padding: 0 14px; }
    .nav-links { display: none; }
    .nav-dropdown { display: none; }
    .mobile-menu-btn { display: inline-flex; }

    .mobile-links.open {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        padding: 10px 14px 12px;
        border-bottom: 1px solid var(--line);
        background: var(--card);
    }

    .mobile-links a {
        text-decoration: none;
        color: var(--muted);
        border: 1px solid var(--border);
        border-radius: 20px;
        padding: 5px 12px;
        font-size: 12.5px;
    }

    .container { width: calc(100% - 18px); margin-top: 16px; }
    .panel, .floating-card { border-radius: 10px; }
    .form-grid { grid-template-columns: 1fr; }
    .workspace-meta-grid { grid-template-columns: 1fr; }
    .plan-grid { grid-template-columns: 1fr; }
    .slug-row { flex-direction: column; }
    .slug-lock { min-width: 0; }

    .auth-shell {
        grid-template-columns: 1fr;
        margin-top: 16px;
    }

    .auth-hero { padding: 24px; }
    .auth-form-wrap { padding: 24px; }
    .auth-brand .brand-title { font-size: 2.4rem; }

    .site-footer { width: calc(100% - 20px); }
    .site-footer-inner { flex-direction: column; align-items: flex-start; }
}
