/* =========================================================
 Crewdog.demo — Premium Account/Dashboard (account.css)
 - Consistent with home.css / run.css
 - Dark + Light themes, glass sidebar, frosted cards
 - Gradient CTAs, glowing focus, hover lift, subtle grid
 ========================================================= */

/* ---------------- Theme Tokens ---------------- */
:root {
    /* Light */
    --bg: #f7f9fc;
    --bg-2: #ffffff;
    --card: rgba(255, 255, 255, 0.74);
    --text: #0f172a;
    --muted: #5b677a;
    --accent: #2563eb;
    --accent-2: #06b6d4;
    --border: #e6eaf0;
    --ring: rgba(37, 99, 235, 0.45);
    --input: rgba(241, 245, 249, 0.7);
    --shadow-1: 0 4px 18px rgba(16, 24, 40, 0.06);
    --shadow-2: 0 18px 40px rgba(16, 24, 40, 0.1);
    --footer: #eef2f7;

    /* Shared */
    --radius: 16px;
    --radius-sm: 12px;
    --blur: blur(16px);
    --transition: all 0.28s cubic-bezier(0.2, 0.6, 0.2, 1);
    --gradient: linear-gradient(135deg, #60a5fa, #3b82f6);
    --gradient-2: linear-gradient(135deg, #3b82f6, #6366f1, #06b6d4);
    --grid-line: rgba(0, 0, 0, 0.04);

    --good: #22c55e;
    --warn: #f59e0b;
    --bad: #ef4444;
}

html[data-theme="dark"] {
    --bg: #0a0f1c;
    --bg-2: #0f172a;
    --card: rgba(17, 25, 40, 0.78);
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #3b82f6;
    --accent-2: #06b6d4;
    --border: rgba(255, 255, 255, 0.08);
    --ring: rgba(56, 189, 248, 0.55);
    --input: rgba(2, 6, 23, 0.55);
    --shadow-1: 0 6px 24px rgba(0, 0, 0, 0.6);
    --shadow-2: 0 18px 46px rgba(0, 0, 0, 0.65);
    --footer: #0f1319;
    --gradient: linear-gradient(135deg, #3b82f6, #6366f1, #06b6d4);
    --gradient-2: linear-gradient(135deg, #22d3ee, #818cf8, #3b82f6);
    --grid-line: rgba(255, 255, 255, 0.04);
}

/* ---------------- Base / Background ---------------- */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Inter", "Satoshi", "Geist", -apple-system,
        BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell,
        "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    line-height: 1.6;
    background: radial-gradient(1100px 760px at 18% -8%,
            rgba(96, 165, 250, 0.12),
            transparent 60%),
        radial-gradient(900px 700px at 100% 0%,
            rgba(34, 211, 238, 0.1),
            transparent 60%),
        radial-gradient(720px 720px at -5% 88%,
            rgba(167, 139, 250, 0.09),
            transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    isolation: isolate;
}

/* Subtle background grid */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image: linear-gradient(to right,
            var(--grid-line) 1px,
            transparent 1px),
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    background-size: 24px 24px, 24px 24px;
    mix-blend-mode: soft-light;
    opacity: 0.25;
}

/* ---------------- Layout ---------------- */
.wrap {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 24px clamp(16px, 3vw, 28px);
    flex: 1 0 auto;
}

.toprow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0 18px;
}

.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--card), rgba(0, 0, 0, 0.02));
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-weight: 650;
    font-size: 14px;
    line-height: 1;
    box-shadow: var(--shadow-1);
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
}

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

.btn.ghost {
    background: transparent;
}

.btn.primary {
    background: var(--gradient);
    border-color: transparent;
    color: #fff;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15),
        0 12px 28px rgba(59, 130, 246, 0.28);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2),
        0 16px 42px rgba(59, 130, 246, 0.35);
}

.btn.danger {
    background: linear-gradient(135deg, #f87171, #ef4444);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 22px rgba(239, 68, 68, 0.32);
}

/* Focus visibility */
a:focus-visible,
.btn:focus-visible,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 4px var(--ring), var(--shadow-2);
}

/* ---------------- Sidebar ---------------- */
.sidebar {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow-1);
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
}

.menu a .dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--muted);
    transition: var(--transition);
}

.menu a:hover {
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.05),
            rgba(0, 0, 0, 0.03));
    border-color: var(--border);
}

.menu a.active {
    background: linear-gradient(180deg,
            rgba(59, 130, 246, 0.18),
            rgba(34, 211, 238, 0.14));
    border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        0 8px 26px rgba(59, 130, 246, 0.18);
}

.menu a.active .dot {
    background: var(--accent);
}

/* Mobile drawer */
.menu-btn {
    display: none;
}

@media (max-width: 900px) {
    .menu-btn {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        right: 16px;
        top: 72px;
        width: 280px;
        max-width: 88vw;
        transform: translateX(120%);
        transition: transform 0.26s ease;
        z-index: 20;
    }

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

/* ---------------- Panels / Cards ---------------- */
.panel {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-1);
    transition: var(--transition);
    overflow: clip;
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg,
            rgba(96, 165, 250, 0.35),
            rgba(34, 211, 238, 0.22),
            rgba(167, 139, 250, 0.2));
    -webkit-mask: linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.22;
    pointer-events: none;
}

.subtitle {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}

/* ---------------- Forms ---------------- */
.stack {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

label {
    font-size: 13px;
    color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    color: var(--text);
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: var(--transition);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: color-mix(in oklab, var(--muted) 80%, transparent);
    opacity: 0.92;
}

input:hover,
textarea:hover {
    border-color: color-mix(in oklab, var(--accent) 30%, var(--border));
}

input:focus,
textarea:focus {
    border-color: color-mix(in oklab, var(--accent) 55%, var(--border));
    box-shadow: 0 0 0 4px var(--ring), 0 10px 24px rgba(0, 0, 0, 0.12);
}

/* ---------------- Quota / Progress ---------------- */
.quota {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 6px 0 10px;
}

.bar {
    position: relative;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg,
            rgba(37, 99, 235, 0.15),
            rgba(34, 211, 238, 0.1));
    border: 1px solid var(--border);
    overflow: hidden;
}

.bar>span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--gradient-2);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.35);
    transition: width 1s ease;
}

/* ---------------- Badges / Pills ---------------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--input), rgba(0, 0, 0, 0.02));
    border: 1px solid var(--border);
    font-weight: 700;
    font-size: 13px;
}

.pill .dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--good);
}

/* ---------------- History List ---------------- */
.hist-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hist-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-1);
    overflow: hidden;
    transition: var(--transition);
}

.hist-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
}

.hist-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    cursor: pointer;
}

.hist-head h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
}

.hist-meta {
    font-size: 13px;
    color: var(--muted);
}

.hist-body {
    display: none;
    border-top: 1px solid var(--border);
    padding: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #0b1220;
    background: var(--gradient);
    box-shadow: 0 8px 22px rgba(59, 130, 246, 0.25);
}

/* ---------------- Alerts ---------------- */
.success,
.error {
    margin: 8px 0;
    padding: 10px 12px;
    border-radius: 12px;
    display: none;
    font-weight: 600;
}

.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--good);
    color: color-mix(in oklab, var(--good) 80%, black);
}

.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--bad);
    color: color-mix(in oklab, var(--bad) 82%, black);
}

/* ---------------- Footer (reuse run/home styles) ---------------- */
.footer {
    flex-shrink: 0;
    width: 100%;
    background: var(--footer);
    padding: 16px 12px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.footer-nav {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.footer a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* ---------------- Motion preferences ---------------- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------------- Modals ---------------- */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    /* toggled by JS */
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 23, 0.55);
    z-index: 50;
    backdrop-filter: blur(4px);
}

.modal__card {
    width: min(560px, 96vw);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    padding: 16px;
}

.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.modal__title {
    margin: 0;
    font-size: 18px;
}

.modal__body {
    padding: 6px 2px 2px;
}

.modal__foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
}

/* Simple radio style */
.radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-radius: 10px;
}

/* ===== Inline alerts for subscription actions ===== */
.alert {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.35;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}

.alert.success {
    background: rgba(16, 185, 129, .12);
    border: 1px solid rgba(16, 185, 129, .35);
    color: #065f46;
}

.alert.error {
    background: rgba(239, 68, 68, .10);
    border: 1px solid rgba(239, 68, 68, .35);
    color: #7f1d1d;
}

/* Optional: clickable modal backdrop close affordance */
.modal {
    cursor: default;
}

.modal.backdrop {
    cursor: pointer;
}


/* ---------------- Pagination ---------------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

.pagination .btn {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 10px;
}

.pagination .subtitle {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}