/* ============================================
   Weny CRM — Supabase-style components
   Importar APÓS tokens.css.
   ============================================ */

/* ---- Page setup ---- */
.w-page {
    background: var(--w-bg);
    color: var(--w-text);
    min-height: 100vh;
    font-family: var(--w-font-sans);
    -webkit-font-smoothing: antialiased;
}

/* Background subtle grid (Supabase-style) */
.w-grid-bg {
    background-image:
        linear-gradient(to right, var(--w-divider) 1px, transparent 1px),
        linear-gradient(to bottom, var(--w-divider) 1px, transparent 1px);
    background-size: 56px 56px;
    background-position: -1px -1px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

/* ---- Buttons (Supabase-style) ---- */
.w-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: var(--w-btn-h);
    padding: 0 1rem;
    border-radius: var(--w-radius);
    font-family: var(--w-font-sans);
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s var(--w-easing), border-color 0.15s var(--w-easing), box-shadow 0.15s var(--w-easing), color 0.15s var(--w-easing);
    text-decoration: none;
    white-space: nowrap;
}
.w-btn:focus-visible { outline: 2px solid var(--w-primary); outline-offset: 2px; }

.w-btn-primary {
    background: var(--w-primary);
    color: var(--w-on-primary);
    border-color: var(--w-primary);
    box-shadow: var(--w-glow-primary);
}
.w-btn-primary:hover { background: var(--w-primary-hover); border-color: var(--w-primary-hover); }
.w-btn-primary:active { background: var(--w-primary-active); }

.w-btn-secondary {
    background: var(--w-surface);
    color: var(--w-text);
    border-color: var(--w-border);
    box-shadow: var(--w-shadow-sm);
}
.w-btn-secondary:hover { background: var(--w-surface-2); border-color: var(--w-border-strong); }

.w-btn-ghost {
    background: transparent;
    color: var(--w-text);
    border-color: transparent;
}
.w-btn-ghost:hover { background: var(--w-surface-2); }

.w-btn-lg { height: 44px; padding: 0 1.5rem; font-size: 0.9375rem; }

/* ---- Card ---- */
.w-card {
    background: var(--w-surface);
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius-md);
    padding: 1.5rem;
    transition: border-color 0.15s var(--w-easing), background 0.15s var(--w-easing);
}
.w-card-hover:hover {
    border-color: var(--w-border-strong);
    background: var(--w-surface);
}

/* ---- Bento grid ---- */
.w-bento {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}
.w-bento-cell { background: var(--w-surface); border: 1px solid var(--w-border); border-radius: var(--w-radius-md); padding: 1.5rem; transition: border-color 0.15s; }
.w-bento-cell:hover { border-color: var(--w-border-strong); }
.w-cell-3 { grid-column: span 3; }
.w-cell-4 { grid-column: span 4; }
.w-cell-2 { grid-column: span 2; }
.w-cell-6 { grid-column: span 6; }
@media (max-width: 900px) {
    .w-cell-3, .w-cell-4, .w-cell-2 { grid-column: span 6; }
}

/* ---- Pills / badges ---- */
.w-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 22px;
    padding: 0 0.625rem;
    border-radius: var(--w-radius-pill);
    background: var(--w-surface);
    color: var(--w-text-muted);
    border: 1px solid var(--w-border);
    font-family: var(--w-font-sans);
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1;
}
.w-pill-primary {
    background: var(--w-primary-soft);
    color: var(--w-primary);
    border-color: var(--w-primary-soft-2);
}
.w-pill-mono {
    font-family: var(--w-font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ---- Inputs (caso precise) ---- */
.w-input {
    width: 100%;
    height: var(--w-input-h);
    padding: 0 0.75rem;
    background: var(--w-surface);
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius);
    font-family: var(--w-font-sans);
    font-size: 0.875rem;
    color: var(--w-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.w-input:focus { outline: none; border-color: var(--w-primary); box-shadow: 0 0 0 3px var(--w-primary-soft); }

/* ---- Code chip ---- */
.w-code {
    font-family: var(--w-font-mono);
    font-size: 0.8125rem;
    background: var(--w-surface-2);
    padding: 0.125rem 0.375rem;
    border-radius: var(--w-radius-sm);
    color: var(--w-text);
    border: 1px solid var(--w-border);
}

/* ---- Link underlined ---- */
.w-link {
    color: var(--w-text);
    text-decoration: underline;
    text-decoration-color: var(--w-primary);
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
    transition: color 0.15s;
}
.w-link:hover { color: var(--w-primary); }

/* ---- Selection ---- */
::selection { background: var(--w-primary); color: var(--w-on-primary); }

/* ---- Theme toggle ---- */
.w-theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: var(--w-radius);
    background: var(--w-surface);
    color: var(--w-text);
    border: 1px solid var(--w-border);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    transition: all 0.15s var(--w-easing);
    box-shadow: var(--w-shadow);
}
.w-theme-toggle:hover { border-color: var(--w-border-strong); background: var(--w-surface-2); }
[data-theme="dark"] .w-theme-toggle .w-icon-sun  { display: inline; }
[data-theme="dark"] .w-theme-toggle .w-icon-moon { display: none; }
.w-theme-toggle .w-icon-sun  { display: none; }
.w-theme-toggle .w-icon-moon { display: inline; }

/* ---- Scrollbar Supabase-like ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--w-border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--w-text-subtle); }

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