/* ─── AVAONE White Theme · Mobile-First ─── */

:root {
    --surface: #ffffff;
    --surface-low: #f8fafc;
    --surface-panel: #f1f5f9;
    --surface-high: #e2e8f0;
    --surface-highest: #cbd5e1;
    --text: #0f172a;
    --text-secondary: #334155;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-bg: #eff6ff;
    --secondary: #0ea5e9;
    --secondary-bg: #f0f9ff;
    --outline: rgba(15, 23, 42, 0.08);
    --outline-strong: rgba(15, 23, 42, 0.14);
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body.portal-body {
    margin: 0;
    color: var(--text);
    background: var(--surface-low);
    font-family: "Manrope", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Navigation ─── */

.glass-nav {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid var(--outline);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ─── Cards ─── */

.shell-card {
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
}

.shell-card--hero {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--outline);
}

/* ─── Brand Mark ─── */

.brand-mark {
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.20);
    color: #fff;
    display: inline-flex;
    height: 2.75rem;
    justify-content: center;
    width: 2.75rem;
}

.brand-mark--lg {
    border-radius: 16px;
    height: 3.75rem;
    width: 3.75rem;
}

/* ─── Pills / Badges ─── */

.pill {
    border: 1px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.10em;
    line-height: 1;
    padding: 0.5rem 0.8rem;
    text-transform: uppercase;
}

.pill--pending {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.pill--processing {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0369a1;
}

.pill--done {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

.pill--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.pill--admin {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #7c3aed;
}

/* ─── Buttons ─── */

.button-primary,
.button-secondary,
.button-ghost,
.button-danger {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.875rem;
    font-weight: 700;
    gap: 0.5rem;
    justify-content: center;
    min-height: 44px;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}

.button-primary:hover,
.button-secondary:hover,
.button-ghost:hover,
.button-danger:hover {
    transform: translateY(-1px);
}

.button-primary:active,
.button-secondary:active,
.button-ghost:active,
.button-danger:active {
    transform: translateY(0);
}

.button-primary {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.24);
    color: #fff;
}

.button-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.30);
}

.button-secondary {
    background: var(--secondary);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.20);
    color: #fff;
}

.button-ghost {
    background: var(--surface);
    border: 1px solid var(--outline-strong);
    color: var(--text-secondary);
}

.button-ghost:hover {
    background: var(--surface-low);
    border-color: rgba(15, 23, 42, 0.20);
}

.button-danger {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    color: var(--danger);
}

.button-danger:hover {
    background: #fee2e2;
}

/* ─── Form Fields ─── */

.field-shell {
    appearance: none;
    background: var(--surface);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: var(--text);
    font: inherit;
    font-size: 0.9375rem;
    min-height: 48px;
    outline: none;
    padding: 0.75rem 1rem;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    width: 100%;
}

.field-shell::placeholder {
    color: #94a3b8;
}

.field-shell:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ─── Metric Cards ─── */

.metric-card {
    background: var(--surface-low);
    border: 1px solid var(--outline);
    border-radius: var(--radius-lg);
    min-height: 9rem;
    padding: 1.25rem;
}

.metric-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.section-title {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.token-mono {
    font-variant-numeric: tabular-nums;
}

/* ─── Data Tables ─── */

.data-table {
    width: 100%;
}

.data-table th {
    background: var(--surface-low);
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    padding: 0.875rem 1rem;
    text-align: left;
    text-transform: uppercase;
}

.data-table td {
    border-top: 1px solid var(--outline);
    padding: 0.875rem 1rem;
    vertical-align: top;
}

.data-table tr:hover td {
    background: var(--surface-low);
}

/* ─── Auth Panel ─── */

.auth-panel {
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* ─── Hero Chip ─── */

.hero-chip {
    align-items: center;
    background: var(--primary-bg);
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    color: var(--primary);
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 700;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
}

/* ─── Empty State ─── */

.empty-state {
    align-items: center;
    border: 1px dashed #e2e8f0;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    justify-content: center;
    min-height: 14rem;
    padding: 2rem 1.5rem;
    text-align: center;
}

/* ─── Summary Grid ─── */

.summary-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
}

/* ─── Notice ─── */

.notice-danger {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    color: var(--danger);
}

/* ─── Material Icons ─── */

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    line-height: 1;
}

/* ─── Mobile-First Responsive ─── */

@media (min-width: 480px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    }
}

@media (max-width: 768px) {
    .data-table {
        min-width: 600px;
    }

    .metric-card {
        min-height: 7rem;
    }
}

@media (max-width: 480px) {
    .shell-card {
        border-radius: var(--radius);
    }

    .auth-panel {
        border-radius: var(--radius);
    }

    .metric-card {
        border-radius: 14px;
        min-height: auto;
        padding: 1rem;
    }

    .button-primary,
    .button-secondary,
    .button-ghost,
    .button-danger {
        font-size: 0.8125rem;
        padding: 0.65rem 1rem;
    }
}

/* ─── Safe Area (notch devices) ─── */

@supports (padding-top: env(safe-area-inset-top)) {
    .glass-nav {
        padding-top: env(safe-area-inset-top);
    }

    body.portal-body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ─── Touch Optimization ─── */

@media (hover: none) and (pointer: coarse) {
    .button-primary:hover,
    .button-secondary:hover,
    .button-ghost:hover,
    .button-danger:hover {
        transform: none;
    }

    .data-table tr:hover td {
        background: transparent;
    }
}

/* ─── Animations (from design prompts) ─── */

/* Text shimmer - processing/loading text effect (prompt 2) */
@keyframes shimmer {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.text-shimmer {
    background: linear-gradient(
        90deg,
        var(--muted) 0%,
        var(--muted) 40%,
        var(--primary) 50%,
        var(--muted) 60%,
        var(--muted) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 2s linear infinite;
}

/* Spinner animation (prompt 6 - loading→success) */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    animation: spin 1s linear infinite;
    border: 2.5px solid var(--outline);
    border-radius: 50%;
    border-top-color: var(--primary);
    display: inline-block;
    height: 1.25rem;
    width: 1.25rem;
}

.spinner--lg {
    height: 2rem;
    width: 2rem;
    border-width: 3px;
}

/* Checkmark draw animation (prompt 6 - success state) */
@keyframes draw-check {
    0% { stroke-dashoffset: 24; }
    100% { stroke-dashoffset: 0; }
}

.icon-check-animated circle {
    fill: var(--success);
    opacity: 0;
    animation: fade-in 0.3s ease forwards;
}

.icon-check-animated path {
    stroke: #fff;
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: draw-check 0.4s ease 0.25s forwards;
}

@keyframes fade-in {
    to { opacity: 1; }
}

/* Pulse dot for active/live indicators (prompt 5 - notification badge) */
@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

.pulse-dot {
    display: inline-flex;
    position: relative;
}

.pulse-dot::before {
    animation: pulse-ring 1.5s ease-out infinite;
    background: var(--success);
    border-radius: 50%;
    content: "";
    height: 8px;
    left: 0;
    position: absolute;
    top: 0;
    width: 8px;
}

.pulse-dot::after {
    background: var(--success);
    border-radius: 50%;
    content: "";
    height: 8px;
    position: relative;
    width: 8px;
}

/* Slide-up entrance for cards/sections */
@keyframes slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-slide-up {
    animation: slide-up 0.4s ease-out both;
}

/* ─── Drag-and-Drop Upload Zone (prompt 1) ─── */

.upload-zone {
    align-items: center;
    background: var(--surface-low);
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
    min-height: 11rem;
    padding: 1.5rem;
    text-align: center;
    transition: border-color 200ms ease, background 200ms ease, transform 200ms ease;
}

.upload-zone:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
}

.upload-zone.is-dragging {
    background: rgba(37, 99, 235, 0.06);
    border-color: var(--primary);
    transform: scale(1.01);
}

.upload-zone__icon {
    align-items: center;
    background: var(--surface);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    height: 3rem;
    justify-content: center;
    width: 3rem;
}

.upload-zone__title {
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 700;
}

.upload-zone__hint {
    color: var(--muted);
    font-size: 0.8125rem;
}

/* ─── Metric Card Hover (prompt 4 - card interactions) ─── */

.metric-card {
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.metric-card:hover {
    border-color: rgba(37, 99, 235, 0.16);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

/* ─── Status Indicator Enhancements ─── */

.pill--processing {
    position: relative;
    overflow: hidden;
}

.pill--processing::after {
    animation: shimmer-bar 1.8s ease-in-out infinite;
    background: linear-gradient(90deg, transparent, rgba(3, 105, 161, 0.15), transparent);
    content: "";
    inset: 0;
    position: absolute;
}

@keyframes shimmer-bar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ─── Mobile Bottom Nav (prompt 5 mobile pattern) ─── */

.mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--outline);
    bottom: 0;
    display: none;
    left: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    position: fixed;
    right: 0;
    z-index: 40;
}

.mobile-bottom-nav__inner {
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
}

.mobile-bottom-nav__item {
    align-items: center;
    border-radius: 12px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    font-size: 0.625rem;
    font-weight: 700;
    gap: 0.2rem;
    letter-spacing: 0.04em;
    min-width: 56px;
    padding: 0.4rem 0.6rem;
    text-decoration: none;
    transition: color 150ms ease, background 150ms ease;
}

.mobile-bottom-nav__item:hover,
.mobile-bottom-nav__item--active {
    background: var(--primary-bg);
    color: var(--primary);
}

@media (max-width: 640px) {
    .mobile-bottom-nav {
        display: block;
    }

    body.portal-body {
        padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0));
    }
}

/* ─── Auth Background Paths (prompt 3) ─── */

.auth-bg-paths {
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    position: absolute;
    z-index: 0;
}

.auth-bg-paths svg {
    height: 100%;
    opacity: 0.5;
    width: 100%;
}

@keyframes path-draw {
    0% { stroke-dashoffset: 1000; }
    100% { stroke-dashoffset: 0; }
}

.auth-bg-paths path {
    stroke-dasharray: 1000;
    animation: path-draw 25s linear infinite;
}

/* ─── Shell Card entrance stagger ─── */

.shell-card {
    animation: slide-up 0.35s ease-out both;
}

main > .shell-card:nth-child(1),
main > section:nth-child(1) .shell-card { animation-delay: 0s; }
main > .shell-card:nth-child(2),
main > section:nth-child(2) .shell-card { animation-delay: 0.06s; }
main > .shell-card:nth-child(3),
main > section:nth-child(3) .shell-card { animation-delay: 0.12s; }
main > .shell-card:nth-child(4),
main > section:nth-child(4) .shell-card { animation-delay: 0.18s; }

/* ─── Print ─── */

@media print {
    nav,
    .no-print,
    .mobile-bottom-nav {
        display: none !important;
    }

    .shell-card,
    .metric-card,
    .auth-panel {
        animation: none !important;
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
    }
}
