/**
 * Babi Meet — couche design inspirée Tribu
 * Typo Nunito, shell grid, espacements, pills — couleurs Babi Meet conservées
 */

:root {
    --tribu-font: 'Nunito', system-ui, -apple-system, sans-serif;
    --font: var(--tribu-font);
    --font-display: var(--tribu-font);

    /* Neutres — bordures grises (comme mobile) */
    --grey-100: var(--surface-2, #F3F4F6);
    --grey-200: var(--border, #E5E7EB);
    --grey-400: #8a8578;
    --grey-500: var(--text-secondary, #6B5A5E);
    --grey-700: var(--text-primary, #1A0F12);
    --cream: var(--bg, #F8F8F8);

    /* Layout Tribu */
    --nav-w: 260px;
    --sidebar-w: 260px;
    --feed-w: 680px;
    --rail-w: 300px;
    --page-pad-x: clamp(16px, 5vw, 10%);

    /* Rayons & ombres Tribu */
    --radius: 12px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ── Typographie ── */
body.app-body,
body.auth-body {
    font-family: var(--tribu-font);
    font-size: 15px;
    line-height: 1.55;
    font-weight: 400;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
    font: inherit;
}

h1, h2, h3, h4 {
    font-family: var(--tribu-font);
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* ── Shell application (grid Tribu) ── */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
    background: var(--cream);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--sidebar-w);
    padding: 12px 12px 16px;
    border-right: 1px solid var(--grey-200);
    background: var(--cream);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-brand-block {
    padding: 4px 4px 8px;
}

.sidebar-logo,
.brand-wordmark-link .brand-wordmark {
    font-family: var(--tribu-font);
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.5px;
    border-bottom: none;
    margin-bottom: 0;
    padding: 4px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
}

.sidebar-section-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--grey-500);
    padding: 8px 14px 6px;
    margin: 0;
}

.sidebar-nav .nav-item {
    gap: 14px;
    width: calc(100% - 8px);
    margin: 0 4px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--grey-700);
    transition: background 0.12s;
}

.sidebar-nav .nav-item:hover {
    background: var(--grey-100);
    color: var(--grey-700);
}

.sidebar-nav .nav-item.active {
    background: #dc143c;
    color: #fff;
    font-weight: 800;
}

.sidebar-nav .nav-item.active .lucide-icon,
.sidebar-nav .nav-item.active i {
    color: #fff;
}

.sidebar-nav .nav-item.active::before {
    display: none;
}

.sidebar-nav .nav-item i,
.sidebar-nav .nav-item .nav-icon-wrap {
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.app-main-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--cream);
}

.app-main {
    flex: 1;
    background: var(--cream);
}

/* ── Header / topbar ── */
.premium-header {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 58px;
    padding: 10px var(--page-pad-x);
    background: var(--cream);
    border-bottom: 1px solid var(--grey-200);
    gap: 10px;
}

.header-page-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.header-search {
    max-width: 360px;
}

.header-search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    background: var(--grey-100);
    color: var(--grey-700);
}

.header-search input:focus {
    outline: none;
    background: var(--grey-200);
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.22);
}

.header-btn,
.header-avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--grey-100);
    border: none;
    color: var(--grey-700);
    transition: background 0.12s;
}

.header-btn:hover,
.header-avatar-btn:hover {
    background: var(--grey-200);
}

.header-btn .badge,
.nav-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

/* ── Pages & titres ── */
.lum-page {
    max-width: 1180px;
    padding: 1.25rem var(--page-pad-x) 2.5rem;
}

.lum-head {
    gap: 14px;
    margin-bottom: 1.25rem;
}

.lum-head-titles h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.lum-head-titles p {
    font-size: 14px;
    font-weight: 500;
    color: var(--grey-500);
    line-height: 1.5;
}

.section-title,
.lum-section-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--grey-500);
}

/* ── Boutons (pills Tribu) ── */
.btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-ghost,
.lum-btn,
.lum-btn-primary,
.lum-btn-secondary {
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 18px;
    transition: transform 0.12s, filter 0.12s, background 0.12s;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn-primary:hover:not(:disabled),
.lum-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(0.97);
}

.btn-outline {
    background: #1A0F12;
    border: 1px solid #1A0F12;
    color: #fff;
}

.btn-outline:hover {
    background: #000;
    border-color: #000;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--grey-500);
}

.btn-ghost:hover {
    background: var(--grey-100);
    color: var(--grey-700);
}

/* ── Formulaires ── */
.field-label,
label.field-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--grey-700);
}

.field-input,
input:not([type="checkbox"]):not([type="radio"]):not(.code-input),
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--grey-200);
    border-radius: 12px;
    font-size: 14px;
    background: var(--surface, #fff);
    color: var(--grey-700);
    margin-bottom: 14px;
}

.field-input:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.25);
}

/* ── Cartes & panneaux ── */
.card,
.settings-group,
.dash-card,
.dash-welcome,
.modal-box,
.panel,
.explore-tile,
.group-card,
.notif-item,
.empty-state {
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background-color: var(--surface, #fff);
}

.fav-grid .empty-state,
.fav-grid-empty {
    grid-column: 1 / -1;
    width: 100%;
    max-width: min(640px, 92vw);
    margin: 3rem auto;
    min-height: min(546px, 68vh);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 4.55rem 2.5rem;
    text-align: center;
    box-sizing: border-box;
}

.fav-grid-empty h2 {
    margin: 0.75rem 0 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--grey-900, #1a0f12);
}

.fav-grid-empty p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--grey-500, #6b5a5e);
    max-width: 38ch;
}

.fav-grid-empty .lum-btn {
    margin-top: 1rem;
}

.fav-grid-empty .lucide-icon {
    color: var(--grey-400, #94a3b8);
    opacity: 0.85;
}

.explore-tile:hover,
.group-card:hover {
    border-color: var(--grey-400);
    box-shadow: var(--shadow-hover);
}

/* ── Auth (split Tribu) ── */
.auth-split-main {
    background: var(--cream);
    padding: 48px clamp(24px, 5vw, 56px);
}

.auth-split-form-wrap {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-card {
    max-width: 400px;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.auth-card h1 {
    font-family: var(--tribu-font);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 8px;
}

.auth-sub {
    font-size: 14px;
    font-weight: 500;
    color: var(--grey-500);
    line-height: 1.5;
    margin-bottom: 28px;
}

.auth-split-headline {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.12;
}

.auth-split-tagline {
    font-size: clamp(15px, 2vw, 17px);
    line-height: 1.6;
}

.auth-card .btn-primary.btn-block {
    width: 100%;
    padding: 13px;
    font-weight: 700;
}

.auth-switch,
.auth-forgot-link {
    font-size: 14px;
    color: var(--grey-500);
    line-height: 1.6;
}

.auth-switch a,
.auth-forgot-link a {
    font-weight: 700;
    color: var(--primary);
}

/* ── Discovery & chips ── */
.disc-chip,
.chip,
.feed-tab,
.lum-tab {
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
}

.disc-chip.is-active,
.feed-tab.is-active,
.lum-tab.is-active {
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

/* ── Toast & badges ── */
.toast {
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.badge,
.ay-badge {
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ── Bottom nav mobile (style Tribu) ── */
@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .app-bottomnav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        display: flex;
        align-items: stretch;
        gap: 2px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        background: var(--cream);
        border-top: 1px solid var(--grey-200);
    }

    .app-bottomnav .nav-item {
        flex: 1;
        flex-direction: column;
        gap: 4px;
        margin: 0;
        width: auto;
        padding: 8px 4px;
        border-radius: 10px;
        font-size: 10px;
        font-weight: 600;
        color: var(--grey-500);
    }

    .app-bottomnav .nav-item i {
        font-size: 1.15rem;
    }

    .app-bottomnav .nav-item.active {
        color: var(--primary);
        background: var(--primary-soft);
        font-weight: 800;
    }
}

/* ── Dark mode : conserver couleurs Babi Meet ── */
[data-theme="dark"] {
    --cream: var(--bg);
    --grey-100: var(--surface-2);
    --grey-200: var(--border);
    --grey-500: var(--text-secondary);
    --grey-700: var(--text-primary);
}

[data-theme="dark"] .app-layout,
[data-theme="dark"] .app-sidebar,
[data-theme="dark"] .app-main-col,
[data-theme="dark"] .app-main,
[data-theme="dark"] .premium-header,
[data-theme="dark"] .app-bottomnav,
[data-theme="dark"] .auth-split-main {
    background: var(--bg);
}

[data-theme="dark"] .header-search input {
    background: var(--surface-2);
    color: var(--text-primary);
}

[data-theme="dark"] .header-btn,
[data-theme="dark"] .header-avatar-btn {
    background: var(--surface-2);
}

[data-theme="dark"] .sidebar-nav .nav-item:hover {
    background: var(--surface-2);
}

/* ── Icônes Lucide (style Tribu) ── */
.lucide-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    stroke-width: 1.75;
}

.sidebar-nav .nav-item .lucide-icon,
.app-bottomnav .nav-item .lucide-icon,
.header-btn .lucide-icon,
.header-search .lucide-icon,
.nav-icon-wrap .lucide-icon {
    flex-shrink: 0;
}

.auth-flow-step-icon .lucide-icon {
    width: 18px !important;
    height: 18px !important;
}

[data-theme="dark"] .field-input,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}
