/* ===== HIXY — Auth pages redesign (Flook-style) ===== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Global font override */
body, input, button, select, textarea, label {
    font-family: 'Poppins', sans-serif !important;
}

/* ===================================================================
   Scope all overrides to the Minimal layout (auth pages only)
   identified by bg-stone-500 on the root div.
   =================================================================== */

/* 1. White background, strip padding */
.bg-stone-500 {
    background-color: #f9fafb !important;
    padding: 0 !important;
}

/* 2. Inner container: full width, vertical flex */
.bg-stone-500 > div.w-full {
    max-width: 100% !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
}

/* 3. Top bar (logo strip) */
.bg-stone-500 > div.w-full > div:first-child {
    padding: 16px 28px !important;
    margin-bottom: 0 !important;
    background-color: #ffffff !important;
    border-bottom: 1px solid #f0f0f0 !important;
}

/* Logo sizing */
.bg-stone-500 > div.w-full > div:first-child img {
    height: 39.6px !important;
    width: auto !important;
    max-width: 220px !important;
}
.bg-stone-500 > div.w-full > div:first-child a svg {
    height: 39.6px !important;
}

/* 4. Form area: grow and center */
.bg-stone-500 > div.w-full > div:nth-child(2) {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 100% !important;
    padding: 40px 20px !important;
}

/* Form element — constrain width */
.bg-stone-500 > div.w-full > div:nth-child(2) form {
    width: 100% !important;
    max-width: 460px !important;
}

/* 5. Panel — clean card */
.bg-stone-500 .bg-white.border.border-gray-100.rounded-lg {
    border: 1px solid #e5e7eb !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.11) !important;
    background-color: #ffffff !important;
    overflow: hidden !important;
}

/* 6. Panel header padding */
.bg-stone-500 .bg-white.border.border-gray-100.rounded-lg > .p-lg:first-child {
    padding: 28px 28px 0 28px !important;
}

/* 7. Panel title */
.bg-stone-500 .text-lg.font-semibold.text-black {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: #111827 !important;
    line-height: 1.3 !important;
    letter-spacing: -0.01em !important;
}

/* 8. Hide description ("Enter your details...") */
.bg-stone-500 .text-gray-500.mt-xs {
    display: none !important;
}

/* 9. Panel body padding */
.bg-stone-500 .bg-white.border.border-gray-100.rounded-lg > .p-lg:not(:first-child) {
    padding: 20px 28px 28px 28px !important;
}

/* 10. Stack form fields: label above input */
.bg-stone-500 .form-field > div {
    flex-direction: column !important;
    align-items: flex-start !important;
}

/* Label */
.bg-stone-500 .form-field .font-medium {
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
    margin-bottom: 4px !important;
}

/* Input/select wrapper: full-width */
.bg-stone-500 .form-field > div > div:last-child {
    width: 100% !important;
    margin-top: 5px !important;
}

/* 11. Input fields: email, password, text */
.bg-stone-500 input[type="email"],
.bg-stone-500 input[type="password"],
.bg-stone-500 input[type="text"] {
    height: 44px !important;
    width: 100% !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 8px !important;
    padding: 0 14px !important;
    font-size: 0.9375rem !important;
    font-family: 'Poppins', sans-serif !important;
    color: #111827 !important;
    background-color: #fafafa !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
    box-shadow: none !important;
}

.bg-stone-500 input[type="email"]:focus,
.bg-stone-500 input[type="password"]:focus,
.bg-stone-500 input[type="text"]:focus {
    outline: none !important;
    border-color: #4F46BB !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 187, 0.12) !important;
}

/* 12. Select field (timezone) */
.bg-stone-500 select {
    height: 44px !important;
    width: 100% !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 8px !important;
    padding: 0 14px !important;
    font-size: 0.9375rem !important;
    font-family: 'Poppins', sans-serif !important;
    color: #111827 !important;
    background-color: #fafafa !important;
    transition: border-color 0.15s ease !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
}

.bg-stone-500 select:focus {
    outline: none !important;
    border-color: #4F46BB !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 187, 0.12) !important;
}

/* 13. Spacing between fields */
.bg-stone-500 .mt-md {
    margin-top: 16px !important;
}

.bg-stone-500 .mt-lg {
    margin-top: 22px !important;
}

/* 14. Terms checkbox row */
.bg-stone-500 .form-field .flex.gap-xs.items-center {
    align-items: flex-start !important;
    gap: 10px !important;
}

.bg-stone-500 .form-field input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    margin-top: 2px !important;
    border-radius: 4px !important;
    border: 1.5px solid #d1d5db !important;
    cursor: pointer !important;
    accent-color: #4F46BB !important;
}

.bg-stone-500 .form-field label {
    font-size: 0.8125rem !important;
    color: #6b7280 !important;
    line-height: 1.5 !important;
    cursor: pointer !important;
}

.bg-stone-500 .form-field label a {
    color: #4F46BB !important;
    text-decoration: underline !important;
}

/* 15. Hide "Remember me" on login (label directly wraps checkbox) */
.bg-stone-500 div.mt-md:has(label > input[type="checkbox"]) {
    display: none !important;
}

/* 16. Bottom row: stack button and link vertically */
.bg-stone-500 .flex.justify-between.mt-lg,
.bg-stone-500 .flex.items-center.justify-between.mt-lg {
    flex-direction: column !important;
    align-items: stretch !important;
    margin-top: 24px !important;
    gap: 14px !important;
}

/* 17. Submit button */
.bg-stone-500 button[type="submit"] {
    width: 100% !important;
    height: 46px !important;
    padding: 0 16px !important;
    border-radius: 8px !important;
    background-color: #111827 !important;
    color: #ffffff !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    font-family: 'Poppins', sans-serif !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.20), 0 6px 16px rgba(0,0,0,0.14) !important;
    transition: background-color 0.15s ease, box-shadow 0.15s ease !important;
}

.bg-stone-500 button[type="submit"]:hover:not(:disabled) {
    background-color: #1f2937 !important;
}

.bg-stone-500 button[type="submit"]:disabled {
    background-color: #9ca3af !important;
    cursor: not-allowed !important;
}

/* 18. "Forgot password?" / "Already registered?" link */
.bg-stone-500 .link-primary {
    display: block !important;
    text-align: center !important;
    font-size: 0.8125rem !important;
    font-weight: 400 !important;
    color: #6b7280 !important;
    text-decoration: none !important;
}

.bg-stone-500 .link-primary:hover {
    color: #111827 !important;
    text-decoration: underline !important;
}

/* 19. Error message spacing */
.bg-stone-500 .mb-xs {
    margin-bottom: 10px !important;
}

/* 20. Markdown links in terms text */
.bg-stone-500 .markdown a {
    color: #4F46BB !important;
}

/* ===== GLOBAL: extra bottom padding inside all card/panel boxes ===== */
/* Targets any p-lg content block that is the last (or only) child of a rounded card */
.rounded-lg > .p-lg,
.rounded-lg > div:last-child {
    padding-bottom: 3rem !important;
}

/* Pro-team Panel body (p-lg pt-0) — same treatment */
.rounded-lg .p-lg.pt-0 {
    padding-bottom: 3rem !important;
}

/* ─── Workspace Selection Balls ──────────────────────────── */

/* Circular ball wrapper */
.mp-wball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: 2.5px solid transparent;
    outline-offset: 3px;
    transition: outline-color 0.15s ease-in-out;
    flex-shrink: 0;
}

/* Black ring on hover */
.group:hover .mp-wball {
    outline-color: #000000;
}

/* Active workspace — primary colour ring */
.mp-wball.mp-wball--active {
    outline-color: #0f172a;
}

/* Coloured circle */
.mp-wball-inner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Single white letter */
.mp-wball-inner span {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    font-family: 'Poppins', sans-serif;
}

/* "Add workspace" circular button */
.mp-wball-add {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: 2.5px solid transparent;
    outline-offset: 3px;
    transition: outline-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.group:hover .mp-wball-add {
    border-color: #000000;
    outline-color: #000000;
}

.mp-wball-add-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: color 0.15s ease-in-out;
}

.group:hover .mp-wball-add-icon {
    color: #000000;
}

/* ============================================================
   RESPONSIVE SIDEBAR (tablet collapsed mode) — 2026-06-02
   ------------------------------------------------------------
   <  md (<768px)        : original slide-in overlay (unchanged)
   md  → xl-1 (768-1279) : 72px collapsed, icons only, larger
   ≥  xl (1280+)         : original 240px full mode (unchanged)
   ============================================================ */

@media (min-width: 768px) and (max-width: 1279.98px) {

    /* --- Aside: always visible, narrow, takes layout space --- */
    aside.default-sidebar {
        position: relative !important;
        transform: translateX(0) !important;
        z-index: 10 !important;
        width: 72px !important;
        flex-shrink: 0 !important;
        height: 100vh !important;
    }
    html[dir="rtl"] aside.default-sidebar {
        transform: translateX(0) !important;
    }

    /* Main column takes the remaining width */
    main.w-full {
        width: calc(100% - 72px) !important;
    }

    /* Hide the slide-in dim overlay (sidebar is permanently visible at md+) */
    .fixed.inset-0.z-10.transform.transition-all {
        display: none !important;
    }

    /* --- Inner panel: tighten side padding --- */
    aside.default-sidebar .px-xl {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* --- Logo: compact + centered --- */
    aside.default-sidebar > div > div.relative.px-xl > a {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    aside.default-sidebar > div > div.relative.px-xl > a svg,
    aside.default-sidebar > div > div.relative.px-xl > a img {
        max-width: 36px !important;
        max-height: 36px !important;
        width: auto !important;
        height: auto !important;
    }

    /* --- "Create post" DarkButtonLink: icon-only square --- */
    aside.default-sidebar > div > div.flex.px-xl > a {
        width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
        border-radius: 10px !important;
        justify-content: center !important;
    }
    /* Hide the "Create post" label span — keep only the icon span */
    aside.default-sidebar > div > div.flex.px-xl > a > span:last-child:not(:first-child) {
        display: none !important;
    }
    aside.default-sidebar > div > div.flex.px-xl > a > span:first-child {
        margin: 0 !important;
    }
    aside.default-sidebar > div > div.flex.px-xl > a > span:first-child svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* --- MenuItem: hide label, enlarge icon, centered tile --- */
    aside.default-sidebar a.py-xs.flex.flex-row > .font-medium {
        display: none !important;
    }
    aside.default-sidebar a.py-xs.flex.flex-row {
        position: relative;
        justify-content: center !important;
        padding-top: 6px !important;
        padding-bottom: 6px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    aside.default-sidebar a.py-xs.flex.flex-row > div:first-child {
        display: grid !important;
        place-items: center !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 10px !important;
        transition: background-color 0.15s ease;
    }
    aside.default-sidebar a.py-xs.flex.flex-row > div:first-child svg {
        width: 22px !important;
        height: 22px !important;
    }
    /* Hover + active states on the icon tile */
    aside.default-sidebar a.py-xs.flex.flex-row:hover > div:first-child {
        background-color: rgba(15, 23, 42, 0.06) !important;
    }
    aside.default-sidebar a.py-xs.flex.flex-row.text-gray-900 > div:first-child {
        background-color: rgba(15, 23, 42, 0.09) !important;
    }

    /* --- MenuGroupHeader: hide the text label.
            If the header has a create-button, keep it centered;
            otherwise hide the whole row. --- */
    aside.default-sidebar div.flex.justify-between.items-center > div.font-semibold {
        display: none !important;
    }
    aside.default-sidebar div.flex.justify-between.items-center {
        justify-content: center !important;
        min-height: 4px;
    }
    /* Hide rows that have ONLY the title (no create+ link) */
    aside.default-sidebar div.flex.justify-between.items-center:not(:has(a)) {
        display: none !important;
    }

    /* --- UserMenu: compact paddings; hide any text spans --- */
    aside.default-sidebar > div > div.px-xl.pt-xl {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    aside.default-sidebar > div > div.px-xl.pt-xl .truncate,
    aside.default-sidebar > div > div.px-xl.pt-xl .text-xs,
    aside.default-sidebar > div > div.px-xl.pt-xl .text-sm {
        display: none !important;
    }
}

/* ============================================================
   AI DASHBOARD SIDEBAR VISIBILITY GUARANTEE — 2026-06-02
   ------------------------------------------------------------
   On the AI dashboard page (/hixy/{uuid}/dashboard) the trends
   iframe replaces <main> content and hides the NavBar — which
   is the only hamburger toggle for the sidebar below xl.
   Without these safety rules, users at <xl viewports lose
   their sidebar entirely on the AI page.
   ============================================================ */

/* 1. At md+ the sidebar must ALWAYS be on-screen — never -translate-x-full */
@media (min-width: 768px) {
    aside.default-sidebar {
        transform: translateX(0) !important;
        position: relative !important;
        visibility: visible !important;
        display: block !important;
        flex-shrink: 0 !important;
    }
    html[dir="rtl"] aside.default-sidebar {
        transform: translateX(0) !important;
    }
}

/* 2. Clamp the trends iframe to its container so it can NEVER
       overflow horizontally and cover the sidebar. */
main.hixy-trends-host {
    position: relative !important;
    overflow: hidden !important;
    min-width: 0 !important;
}
main.hixy-trends-host > iframe#hixy-trends-frame {
    position: relative !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 3. Above xl the sidebar uses its natural 240px (vendor default).
       Make sure the main column shrinks correctly on the AI page
       — even if some inline style was added by the JS injection. */
@media (min-width: 1280px) {
    main.w-full.hixy-trends-host,
    main.hixy-trends-host.w-full {
        width: calc(100% - 240px) !important;
    }
}

/* 4. At md → xl-1 the main column already gets calc(100% - 72px)
       from the collapsed-sidebar rule above; this is just a
       belt-and-braces override for the AI page specifically. */
@media (min-width: 768px) and (max-width: 1279.98px) {
    main.w-full.hixy-trends-host,
    main.hixy-trends-host.w-full {
        width: calc(100% - 72px) !important;
    }
}

/* ============================================================
   AI DASHBOARD — extra safety net (added because of hard-to-see
   issue reports). Whenever the trends iframe is active, force
   the sidebar to be on-screen with high z-index so it cannot
   be visually covered by the iframe.
   ============================================================ */

body:has(main.hixy-trends-host) aside.default-sidebar,
main.hixy-trends-host ~ aside.default-sidebar {
    transform: translateX(0) !important;
    visibility: visible !important;
    display: block !important;
    z-index: 100 !important;
}

/* On the AI dashboard at mobile (<md) — show the sidebar as a
   floating column on the left, 64px wide, icon-only. So even on
   a phone, you can reach the menu. The user can dismiss by
   tapping outside if showAside logic kicks in. */
@media (max-width: 767.98px) {
    body:has(main.hixy-trends-host) aside.default-sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        width: 64px !important;
        transform: translateX(0) !important;
        z-index: 100 !important;
        box-shadow: 2px 0 12px rgba(0,0,0,0.10) !important;
    }
    /* Hide menu item text labels on mobile-collapsed sidebar */
    body:has(main.hixy-trends-host) aside.default-sidebar a.py-xs.flex.flex-row > .font-medium {
        display: none !important;
    }
    body:has(main.hixy-trends-host) aside.default-sidebar a.py-xs.flex.flex-row {
        justify-content: center !important;
    }
    body:has(main.hixy-trends-host) aside.default-sidebar div.flex.justify-between.items-center > div.font-semibold {
        display: none !important;
    }
    body:has(main.hixy-trends-host) aside.default-sidebar .px-xl {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }
    /* Push the iframe right of the floating sidebar */
    main.hixy-trends-host {
        padding-left: 64px !important;
    }
    main.hixy-trends-host > iframe#hixy-trends-frame {
        width: calc(100% - 64px) !important;
        margin-left: 0 !important;
    }
}
