/* Exchangifi Design System — Color Tokens (Figma-aligned) */
:root {
    /* Base / Surfaces */
    --color-white: #FFFFFF;
    --color-off-white: #F8FAFC;
    --color-black: #000000;

    /* Neutral (Gray Scale — Figma DS) */
    --color-neutral-100: #F1F5F9;
    --color-neutral-200: #E5E7EB;
    --color-neutral-300: #C4C9D4;
    --color-neutral-400: #9CA3AF;
    --color-neutral-500: #6B7280;
    --color-neutral-700: #374151;
    --color-neutral-800: #1F2937;
    --color-neutral-900: #141414;

    /* Brand (Blue) */
    --color-brand-50: #EFF6FF;
    --color-brand-100: #DBEAFE;
    --color-brand-200: #BFDBFE;
    --color-brand-500: #3B82F6;
    --color-brand-600: #2563EB;
    --color-brand-700: #1D4ED8;
    --color-brand-800: #1E3A8A;

    /* Success (Emerald) */
    --color-success-50: #ECFDF5;
    --color-success-200: #A7F3D0;
    --color-success-500: #10B981;
    --color-success-600: #059669;

    /* Warning (Amber) */
    --color-warning-50: #FFFBEB;
    --color-warning-200: #FDE68A;
    --color-warning-500: #F59E0B;
    --color-warning-600: #D97706;
    --color-warning-800: #92400E;

    /* Error (Red) */
    --color-error-50: #FEF2F2;
    --color-error-200: #FECACA;
    --color-error-500: #EF4444;
    --color-error-600: #DC2626;

    /* Info (reuses Brand) */
    --color-info-50: #EFF6FF;
    --color-info-200: #BFDBFE;
    --color-info-500: #3B82F6;

    /* Semantic Text (Figma DS) */
    --text-primary: #141414;
    --text-secondary: #525252;
    --text-tertiary: #737373;
    --text-quaternary: #a3a3a3;

    /* Semantic UI (Figma DS) */
    --fg-primary: #141414;
    --bg-primary: #FFFFFF;
    --bg-secondary: #f7f7f7;
    --border-primary: #E5E7EB;
    --border-secondary: #e5e5e5;

    /* Legacy aliases (kept for backward compat during migration) */
    --ef-contrast: var(--color-neutral-900);
    --ef-contrast-2: #475569;
    --ef-contrast-3: var(--color-neutral-400);
    --ef-base-3: var(--color-white);
    --ef-base-2: var(--color-off-white);
    --ef-base: #f0f0f0;
    --ef-accent: var(--color-brand-800);
    --ef-accent-2: var(--color-brand-600);
}

html,
body {
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background-color: #edf2fb;
    color: var(--text-primary);
}

h1, h2, h3, h4, h5, h6, .heading-font {
    font-family: "Montserrat", system-ui, -apple-system, sans-serif;
}

/* Brand button utility */
.cta-button {
    background-color: var(--ef-accent);
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.cta-button:hover,
.cta-button:focus {
    opacity: 0.9;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Card surface */
.surface-card {
    background: var(--ef-base-3);
    border-radius: 1rem;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
}

/* Consistent data cards
   Keeps repeated cards aligned when names, tags, issuers, or amounts are long. */
.ui-card-grid {
    align-items: stretch;
}

.ui-card {
    min-width: 0;
    height: 100%;
}

.ui-card *,
.ui-card *::before,
.ui-card *::after {
    min-width: 0;
}

.ui-card-header {
    min-height: 3.25rem;
}

.ui-card-kicker,
.ui-card-subtitle,
.ui-card-pill,
.ui-card-amount {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ui-card-kicker,
.ui-card-subtitle,
.ui-card-pill {
    white-space: nowrap;
}

.ui-card-title {
    min-height: 3rem;
    overflow-wrap: anywhere;
}

.ui-card-tags {
    min-height: 1.5rem;
    max-height: 3.75rem;
    overflow: hidden;
}

.ui-card-tags > * {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ui-card-summary {
    min-height: 2.75rem;
    overflow-wrap: anywhere;
}

.ui-card-details {
    min-height: 7.25rem;
}

.ui-card-footer {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: 2.375rem;
}

@media (max-width: 480px) {
    .ui-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .ui-card-footer > a,
    .ui-card-footer > button {
        justify-content: center;
        width: 100%;
    }
}

/* Home hero gradient (light only) */
.ef-home-hero {
    background-image: linear-gradient(to bottom right, #f3f4f6, #dbeafe);
}

/* ── Header ── */
.custom-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
}

.logo-text-header {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ef-contrast);
}

.text-accent {
    color: var(--ef-accent-2);
}

.main-nav .menu-list {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-list li a {
    color: #475569;
    text-decoration: none;
    transition: color .2s;
}

.menu-list li a:hover {
    color: #1e293b;
}

/* Nav link styles */
.nav-link {
    position: relative;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.nav-link:hover {
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.nav-link:hover::before {
    width: 80%;
}

.nav-link.active {
    color: #2563eb;
    background: rgba(59, 130, 246, 0.1);
}

.nav-link.active::before {
    width: 80%;
}

.header-cta {
    display: flex;
    align-items: center;
}

.mobile-only {
    display: none;
}

.menu-toggle,
.drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #475569;
}

.menu-toggle:hover,
.drawer-close:hover {
    background-color: #1e293b29;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    background: #fff;
    z-index: 60;
    padding: 1.5rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
    transition: right .3s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.mobile-drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header div {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.mobile-menu-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-list a {
    color: #475569;
    text-decoration: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }
}


/* ── Utilities ── */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.line-clamp-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

/* ── Sidebar ── */
.sidebar-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.sidebar-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scrollbar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}
.sidebar-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Active nav item: icon turns blue, text stays dark */
.nav-item-active > svg {
    color: #004eba;
}

.nav-item-active {
    position: relative;
}

/* Alpine.js cloak */
[x-cloak] {
    display: none !important;
}

/* Sub-panel hidden state (vanilla JS managed, not Alpine x-show) */
.panel-hidden {
    display: none !important;
}

/* ── HTMX indicator overrides ── */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: flex;
}

.htmx-request.htmx-indicator {
    display: flex;
}

/* ── Investor card selection (used in conversion create) ── */
.investor-card-selectable {
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.investor-card-selectable::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 1rem;
    padding: 2px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.investor-card-selectable:hover::before {
    opacity: 1;
}

.investor-card-selectable:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.investor-card-selectable:hover .investor-card-select-badge {
    opacity: 1;
    transform: scale(1);
}

.investor-card-select-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

/* ── Notification slide-in animation ── */
@keyframes notif-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
