/*
 * Casa Digital design tokens — Claude handoff
 *
 * Temporary visual-token bridge for the Reemplazo ClickUp UI.
 * Lives under public/vendor/claude-handoff/ so it can be served by Laravel
 * without touching Codex's Vite pipeline. When integration is done, Codex
 * may replace these placeholders with Claude's delivered theme package.
 *
 * Branding notes:
 *   - Typography is intentionally unset here. Claude owns the verified
 *     Casa Digital typeface from the public-site/design research pass.
 *   - Mint accent  #5bb3a3 derived from the lighter #9cd8cc on the public
 *     site, saturated for CTA contrast on white surfaces.
 *   - Stone/beige brand #9f9183 lifted directly from the site theme.
 *   - Dense work-OS palette: light canvas + crisp borders, not the dark
 *     marketing surface of the public site.
 */

:root {
    --brand-50: #faf8f4;
    --brand-100: #f1ede2;
    --brand-200: #e5dfd3;
    --brand-500: #9f9183;
    --brand-700: #574f47;
    --brand-900: #1f1f1f;

    --accent-100: #d4f3e9;
    --accent-300: #9cd8cc;
    --accent-500: #5bb3a3;
    --accent-600: #3f9684;
    --accent-700: #2f7567;

    --ink-50: #fafaf7;
    --ink-100: #f4f4ef;
    --ink-200: #e8e8e0;
    --ink-300: #d1d1c7;
    --ink-500: #8b8b8b;
    --ink-600: #5a5a55;
    --ink-700: #4f4f4f;
    --ink-800: #232323;
    --ink-900: #0e0e0e;

    --canvas: #fafaf7;
    --surface: #ffffff;
    --surface-muted: #f4f4ef;
    --border: #e8e8e0;
    --border-strong: #d1d1c7;

    --radius-card: 0.75rem;
    --radius-control: 0.5rem;

    --shadow-card: 0 1px 2px 0 rgb(15 15 15 / 0.04), 0 1px 4px -2px rgb(15 15 15 / 0.06);
    --shadow-panel: 0 10px 30px -12px rgb(15 15 15 / 0.18);
}

html {
    background-color: var(--canvas);
    color: var(--ink-800);
}

/*
 * Visual identity helpers used by Blade components. Keep this list tight —
 * everything else should be expressible with Tailwind utility classes.
 */
.surface-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1rem;
    white-space: nowrap;
}

.status-pill::before {
    content: '';
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 9999px;
    background-color: currentColor;
}

.focus-ring {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.focus-ring:focus-visible {
    outline-color: var(--accent-500);
}

/*
 * Sidebar collapse hardening. The JS toggles width/data state; these rules
 * prevent expanded text and nested lists from spilling over the collapsed rail.
 */
[data-component="Sidebar"][data-collapsed="false"] {
    width: 16rem !important;
}

[data-component="Sidebar"][data-collapsed="true"] {
    width: 3.5rem !important;
}

[data-sidebar-logo-stack] {
    width: 7.5rem;
    height: 2rem;
    transition: width 180ms ease, height 180ms ease, transform 180ms ease;
}

[data-sidebar-logo-expanded],
[data-sidebar-logo-collapsed] {
    transform-origin: center;
    transition: opacity 180ms ease, transform 180ms ease;
}

[data-sidebar-logo-expanded] {
    opacity: 1;
    transform: scale(1);
}

[data-sidebar-logo-collapsed] {
    opacity: 0;
    transform: scale(0.78);
}

[data-component="Sidebar"][data-collapsed="false"] [data-sidebar-logo-stack] {
    width: 7.5rem !important;
    height: 2rem !important;
    transform: scale(1) !important;
}

[data-component="Sidebar"][data-collapsed="false"] [data-sidebar-logo-expanded] {
    opacity: 1 !important;
    transform: scale(1) !important;
}

[data-component="Sidebar"][data-collapsed="false"] [data-sidebar-logo-collapsed] {
    opacity: 0 !important;
    transform: scale(0.78) !important;
}

[data-component="Sidebar"][data-collapsed="true"] [data-sidebar-brand] {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

[data-component="Sidebar"][data-collapsed="true"] [data-sidebar-logo-stack] {
    width: 2rem !important;
    height: 2rem !important;
    transform: translateX(0) !important;
}

[data-component="Sidebar"][data-collapsed="true"] [data-sidebar-logo-expanded] {
    opacity: 0 !important;
    transform: scale(0.86) !important;
}

[data-component="Sidebar"][data-collapsed="true"] [data-sidebar-logo-collapsed] {
    opacity: 1 !important;
    transform: scale(1) !important;
}

[data-component="Sidebar"][data-collapsed="true"] [data-sidebar-item] {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

[data-component="Sidebar"][data-collapsed="true"] [data-sidebar-label] {
    width: 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    white-space: nowrap;
}

[data-component="Sidebar"][data-collapsed="true"] [data-sidebar-expanded-only] {
    display: none !important;
}

[data-sidebar-collapsed-only] {
    display: none !important;
}

[data-component="Sidebar"][data-collapsed="true"] [data-sidebar-collapsed-only] {
    display: inline-flex !important;
}

[data-component="Sidebar"][data-collapsed="true"] [data-sidebar-toggle] {
    position: absolute;
    inset: 0;
    margin-left: 0;
    opacity: 0;
}

/*
 * Mapping notes for Codex when integrating into Tailwind utility classes:
 *   ink-800   → slate-800
 *   ink-700   → slate-700
 *   ink-600   → slate-600
 *   ink-500   → slate-500
 *   ink-300   → slate-300
 *   ink-200   → slate-200
 *   ink-100   → slate-100
 *   accent-*  → emerald-* (or define custom 'mint' palette under @theme)
 *   brand-*   → stone-* (or define custom 'sand' palette under @theme)
 * The Blade components shipped under resources/views/components/ already use
 * the slate/emerald/stone Tailwind aliases for portability; this stylesheet
 * only refines the canvas, surface, border, and shadow scales to better match
 * Casa Digital's identity than the raw Tailwind defaults.
 */

/* ============================================================================
 * Premium glass pass (2026-05-20, Claude) — VISUAL ONLY.
 *
 * Targets stable [data-component] / [data-*] selectors so it never changes any
 * functional contract. Wins over stock Tailwind by load order (theme.css is
 * loaded after Vite's app.css in layouts/app.blade.php). Degrades gracefully:
 * if this file is absent, Blade still renders with native Tailwind classes.
 *
 * Moderate glassmorphism: backdrop-blur is applied ONLY to floating surfaces
 * (topbar, dropdowns, modals) for performance; flat panels stay near-opaque
 * with refined gradients + layered shadows. No overflow:hidden is introduced,
 * so dropdowns/selects are never clipped.
 * ==========================================================================*/

:root {
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-bg-strong: rgba(255, 255, 255, 0.86);
    --glass-border: rgba(255, 255, 255, 0.55);
    --glass-blur: 14px;

    --shadow-card: 0 1px 2px 0 rgb(15 15 15 / 0.04), 0 6px 18px -12px rgb(15 15 15 / 0.16);
    --shadow-card-hover: 0 2px 6px -1px rgb(15 15 15 / 0.08), 0 16px 36px -16px rgb(15 15 15 / 0.24);
    --shadow-panel: 0 20px 50px -18px rgb(15 15 15 / 0.32), 0 6px 16px -8px rgb(15 15 15 / 0.16);
    --ring-accent: 0 0 0 3px rgba(91, 179, 163, 0.22);
}

/* ---- Canvas: soft premium wash (layers over the slate canvas color) ------ */
[data-component="AppShell"] {
    background-color: var(--canvas);
    background-image:
        radial-gradient(1100px 560px at 100% -8%, rgba(91, 179, 163, 0.08), transparent 60%),
        radial-gradient(900px 480px at -8% 2%, rgba(159, 145, 131, 0.07), transparent 55%);
    background-attachment: fixed;
}

/* ---- Cards: refined surface + soft top highlight + layered shadow -------- */
.surface-card {
    background-color: var(--surface);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 38%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

/* ---- Topbar: frosted glass bar ------------------------------------------- */
[data-component="Topbar"] {
    background-color: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border-bottom: 1px solid rgba(15, 15, 15, 0.06);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 22px -18px rgb(15 15 15 / 0.45);
}

/* ---- Sidebar: deep premium rail ------------------------------------------ */
[data-component="Sidebar"] {
    background-color: #0d1014;
    background-image:
        linear-gradient(180deg, rgba(91, 179, 163, 0.12), transparent 20%),
        linear-gradient(180deg, #11151b, #0b0e12);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.03) inset;
}

[data-sidebar-item] {
    border-radius: 0.5rem;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

[data-sidebar-item]:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

/* Best-effort active accent (no-op if the markup doesn't flag current page) */
[data-sidebar-item][aria-current="page"],
[data-sidebar-item].is-active {
    background-image: linear-gradient(90deg, rgba(91, 179, 163, 0.22), rgba(91, 179, 163, 0.04));
    color: #ffffff;
    box-shadow: inset 2px 0 0 var(--accent-500);
}

/* ---- Floating dropdowns: notifications + profile menu -------------------- */
[data-notifications-panel],
[data-profile-menu] {
    background-color: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    backdrop-filter: blur(18px) saturate(150%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-panel);
}

/* ---- Chat bubbles -------------------------------------------------------- */
[data-message-side="outgoing"] {
    background: linear-gradient(180deg, var(--accent-500), var(--accent-600));
    border: 1px solid rgba(47, 117, 103, 0.35);
    color: #ffffff;
    border-radius: 1rem 1rem 0.25rem 1rem;
    box-shadow: 0 8px 20px -12px rgba(63, 150, 132, 0.6);
}

/* White text for the bubble's own copy, but NOT the link/doc chips (they keep
 * their own backgrounds + colors, so contrast stays correct). */
[data-message-side="outgoing"] > p,
[data-message-side="outgoing"] > header p {
    color: #ffffff;
}

[data-message-side="outgoing"] > span {
    color: rgba(255, 255, 255, 0.85);
}

[data-message-side="incoming"] {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem 1rem 1rem 0.25rem;
    box-shadow: var(--shadow-card);
}

/* ---- Status selects (task row + task detail) ----------------------------- */
[data-action="task-row:status-change"],
[data-action="task:status-change"] {
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

[data-action="task-row:status-change"]:hover,
[data-action="task:status-change"]:hover {
    border-color: var(--accent-500);
}

[data-action="task-row:status-change"]:focus-visible,
[data-action="task:status-change"]:focus-visible {
    outline: none;
    box-shadow: var(--ring-accent);
}

/* ---- Focus ring upgrade -------------------------------------------------- */
.focus-ring:focus-visible {
    outline: none;
    box-shadow: var(--ring-accent);
}

/* ---- Thin, unobtrusive scrollbars on scroll regions ---------------------- */
main,
[data-notifications-list],
[data-runs-body],
[data-watcher-options-scroll] {
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 15, 15, 0.18) transparent;
}

main::-webkit-scrollbar,
[data-notifications-list]::-webkit-scrollbar,
[data-runs-body]::-webkit-scrollbar,
[data-watcher-options-scroll]::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

main::-webkit-scrollbar-thumb,
[data-notifications-list]::-webkit-scrollbar-thumb,
[data-runs-body]::-webkit-scrollbar-thumb,
[data-watcher-options-scroll]::-webkit-scrollbar-thumb {
    background-color: rgba(15, 15, 15, 0.16);
    border-radius: 9999px;
    border: 3px solid transparent;
    background-clip: content-box;
}

main::-webkit-scrollbar-thumb:hover,
[data-notifications-list]::-webkit-scrollbar-thumb:hover,
[data-runs-body]::-webkit-scrollbar-thumb:hover,
[data-watcher-options-scroll]::-webkit-scrollbar-thumb:hover {
    background-color: rgba(15, 15, 15, 0.28);
}

/* ---- Chat v1.5 motion (smooth message + popover entrances) -------------- */
@keyframes chat-msg-enter {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to { opacity: 1; transform: none; }
}

.chat-msg-enter {
    animation: chat-msg-enter 220ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes chat-pop-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

[data-chat-message-menu]:not([hidden]),
[data-chat-reaction-picker]:not([hidden]),
[data-chat-channel-menu]:not([hidden]) {
    animation: chat-pop-in 120ms ease-out both;
    transform-origin: top;
}

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

[data-chat-forward-modal]:not([hidden]),
[data-chat-delete-modal]:not([hidden]) {
    animation: chat-fade-in 140ms ease-out both;
}

/* ---- Respect reduced-motion --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    [data-sidebar-item],
    [data-action="task-row:status-change"],
    [data-action="task:status-change"],
    .surface-card {
        transition: none !important;
    }
    .chat-msg-enter,
    [data-chat-message-menu]:not([hidden]),
    [data-chat-reaction-picker]:not([hidden]),
    [data-chat-channel-menu]:not([hidden]),
    [data-chat-forward-modal]:not([hidden]),
    [data-chat-delete-modal]:not([hidden]) {
        animation: none !important;
    }
}
