/* OmniSearch Design System — Premium Minimal */

:root {
    --os-surface: #FAFAFA;
    --os-card: #FFFFFF;
    --os-ink: #0F172A;
    --os-muted: #475569;
    --os-faint: #64748B;
    --os-border: #E2E8F0;
    --os-champagne: #B8956B;
    --os-dark-bg: #0F172A;
    --os-dark-surface: #1E293B;
    --os-dark-text: #F8FAFC;
    --os-dark-muted: #94A3B8;
    --os-radius: 10px;
    --os-radius-lg: 12px;
    --os-radius-xl: 16px;
    --os-btn-primary-bg: #0F172A;
    --os-btn-primary-fg: #fff;
    --os-btn-primary-hover: #1e293b;
}

.dark {
    --os-surface: #0F172A;
    --os-card: #1E293B;
    --os-ink: #F8FAFC;
    --os-muted: #94A3B8;
    --os-faint: #64748B;
    --os-border: rgba(255, 255, 255, 0.12);
    --os-btn-primary-bg: #B8956B;
    --os-btn-primary-fg: #0F172A;
    --os-btn-primary-hover: #a6845f;
}

html {
    touch-action: manipulation;
}

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

[x-cloak] { display: none !important; }

/* Sidebar */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    margin: 0 0.25rem;
    border-radius: var(--os-radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--os-muted);
    transition: color 0.2s, background-color 0.2s;
    cursor: pointer;
    min-height: 44px;
}

.sidebar-link:hover {
    color: var(--os-ink);
    background-color: rgba(15, 23, 42, 0.04);
}

.dark .sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
    color: var(--os-ink);
    background: rgba(184, 149, 107, 0.12);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(184, 149, 107, 0.25);
}

.sidebar-link.active svg {
    color: var(--os-champagne);
}

.sidebar-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(184, 149, 107, 0.3);
}

.sidebar-link.active:focus-visible {
    box-shadow: inset 0 0 0 1px rgba(184, 149, 107, 0.25), 0 0 0 2px rgba(184, 149, 107, 0.3);
}

.sidebar-link svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* Components */
.os-card {
    background: var(--os-card);
    border: 1px solid var(--os-border);
    border-radius: var(--os-radius-xl);
}

.os-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border-radius: var(--os-radius);
    border: 1px solid var(--os-border);
    background: var(--os-card);
    color: var(--os-ink);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.os-input:focus {
    border-color: var(--os-ink);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.dark .os-input:focus {
    box-shadow: 0 0 0 3px rgba(248, 250, 252, 0.08);
}

.os-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    min-height: 44px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--os-radius);
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
}

.os-btn-primary {
    background: var(--os-btn-primary-bg, #0F172A);
    color: var(--os-btn-primary-fg, #fff);
}

.os-btn-primary:hover {
    background: var(--os-btn-primary-hover, #1e293b);
}

.os-btn-secondary {
    background: transparent;
    color: var(--os-muted);
    border: 1px solid var(--os-border);
}

.os-btn-secondary:hover {
    background: rgba(15, 23, 42, 0.04);
    color: var(--os-ink);
}

.os-btn-gold {
    color: var(--os-champagne);
}

.os-btn-gold:hover {
    color: var(--os-ink);
}

/* Global notice toast */
.os-notice {
    position: fixed;
    bottom: calc(6rem + env(safe-area-inset-bottom, 0));
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    padding: 0.75rem 1.25rem;
    border-radius: var(--os-radius-xl);
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: center;
    max-width: 20rem;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
    animation: os-notice-in 0.25s ease-out both;
    pointer-events: none;
}

@media (min-width: 768px) {
    .os-notice {
        bottom: 2rem;
    }
}

.os-notice--success {
    background: var(--os-ink);
    color: #fff;
}

.os-notice--error {
    background: #dc2626;
    color: #fff;
}

@keyframes os-notice-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .os-notice {
        animation: none;
    }
}

/* Mobile bottom nav */
.mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 52px;
    min-width: 52px;
    flex: 1;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--os-faint);
    margin: 0.25rem;
    border-radius: var(--os-radius-lg);
    transition: color 0.2s, background-color 0.2s;
    cursor: pointer;
}

.mobile-nav-link.active {
    color: var(--os-champagne);
    background: rgba(184, 149, 107, 0.12);
    font-weight: 600;
}

.mobile-nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(184, 149, 107, 0.3);
}

.mobile-nav-link svg {
    width: 1.375rem;
    height: 1.375rem;
}

/* Auth split layout */
.auth-mesh {
    background:
        radial-gradient(ellipse 70% 50% at 15% 85%, rgba(184, 149, 107, 0.12), transparent),
        linear-gradient(155deg, #0F172A, #1a2332 45%, #0F172A);
}

.search-caret::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--os-champagne);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: os-blink 1s step-end infinite;
}

@keyframes os-blink {
    50% { opacity: 0; }
}

.widget-result-enter {
    animation: os-result-in 0.35s ease-out both;
}

@keyframes os-result-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* FAB */
.os-fab {
    position: fixed;
    bottom: calc(5rem + env(safe-area-inset-bottom, 0));
    right: 1rem;
    z-index: 40;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background: var(--os-ink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
    cursor: pointer;
    transition: background-color 0.2s;
}

.os-fab:hover {
    background: #1e293b;
}

@media (min-width: 768px) {
    .os-fab { display: none; }
}

.project-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.project-nav-link:hover {
    color: var(--os-ink);
}

.project-nav-link.active {
    color: var(--os-ink);
    border-bottom-color: var(--os-champagne);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .search-caret::after { animation: none; }
}

/* iOS-style toggle */
.os-toggle {
    position: relative;
    width: 3rem;
    height: 1.75rem;
    border-radius: 9999px;
    background: #e2e8f0;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.os-toggle--on {
    background: var(--os-champagne);
}

.os-toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s;
}

.os-toggle--on .os-toggle__thumb {
    transform: translateX(1.25rem);
}

/* OAuth buttons */
.os-oauth-yandex {
    background: #fc3f1d;
    color: #fff;
    border: none;
}

.os-oauth-yandex:hover {
    background: #e03618;
    color: #fff;
}

.os-oauth-max {
    background: #f8fafc;
    color: var(--os-ink);
    border: 1px solid var(--os-border);
    font-weight: 600;
}

.os-btn-trial {
    background: transparent;
    color: var(--os-champagne);
    border: 1px solid rgba(184, 149, 107, 0.55);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.os-btn-trial:hover {
    background: rgba(184, 149, 107, 0.1);
    border-color: var(--os-champagne);
}

.os-btn-trial:disabled {
    opacity: 0.65;
    cursor: wait;
}

.os-trial-overlay {
    background: rgba(15, 23, 42, 0.45);
    animation: os-trial-fade 0.25s ease-out both;
}

.os-trial-card {
    animation: os-trial-card-in 0.4s ease-out both;
}

.os-trial-check {
    animation: os-trial-pop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.os-trial-burst {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.os-trial-burst span {
    position: absolute;
    left: 50%;
    top: 3.25rem;
    width: 6px;
    height: 6px;
    margin-left: -3px;
    border-radius: 9999px;
    background: var(--os-champagne);
    opacity: 0;
    animation: os-trial-spark 0.7s ease-out 0.12s both;
}

.os-trial-burst span:nth-child(1) { --dx: 0px; --dy: -36px; }
.os-trial-burst span:nth-child(2) { --dx: 26px; --dy: -26px; animation-delay: 0.16s; }
.os-trial-burst span:nth-child(3) { --dx: 36px; --dy: 0px; animation-delay: 0.2s; }
.os-trial-burst span:nth-child(4) { --dx: 26px; --dy: 26px; animation-delay: 0.18s; }
.os-trial-burst span:nth-child(5) { --dx: 0px; --dy: 36px; animation-delay: 0.14s; }
.os-trial-burst span:nth-child(6) { --dx: -26px; --dy: 26px; animation-delay: 0.22s; }
.os-trial-burst span:nth-child(7) { --dx: -36px; --dy: 0px; animation-delay: 0.16s; }
.os-trial-burst span:nth-child(8) { --dx: -26px; --dy: -26px; animation-delay: 0.2s; }

@keyframes os-trial-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes os-trial-card-in {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes os-trial-pop {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes os-trial-spark {
    0% { opacity: 0; transform: translate(0, 0) scale(0.4); }
    30% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); }
}

@media (prefers-reduced-motion: reduce) {
    .os-trial-overlay,
    .os-trial-card,
    .os-trial-check,
    .os-trial-burst span {
        animation: none;
    }
}
