/**
 * My Elia Navigation v5
 * Sticky top header — 5 items (Ma journée, Mon cycle, Bilan, Chat IA, Plus)
 * Chat IA is a direct tab. FAB hidden on mobile (≤768px).
 */

/* ── Fonts ──────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,900;1,400&family=Roboto:wght@400;500;700&display=swap');

/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
    --elia-black:      #000000;
    --elia-white:      #ffffff;
    --elia-cream:      #efe9dd;
    --elia-cream-dark: #e5ddd0;
    --elia-terra:      #d1b67d;
    --elia-accent:     #a90000;
    --elia-secondary:  #b8aa8e;

    /* Legacy aliases (keeps existing pages happy) */
    --green:      #000000;
    --green-light: #1a1a1a;
    --terra:      #d1b67d;
    --terra-light: #e0c999;
    --cream:      #efe9dd;
    --cream-dark: #e5ddd0;
    --text:       #000000;
    --text-muted: #000000;
    --accent:     #a90000;
    --accent-hover: #8a0000;
}

/* ── Page background gradient (all pages) — fixed diagonal ────────────────── */
html {
    background: linear-gradient(135deg, #f8f6f2, #efe9dd);
    background-attachment: fixed;
    min-height: 100%;
}

body {
    background: transparent !important;
    min-height: 100vh;
}

/* ── Default widget / card background ───────────────────────────────────────── */
.card, .widget, .info-card, .summary-card, .stat-card, .section-card,
.dashboard-card, .widget-card, .content-card, .feature-card {
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-radius: 16px;
}

/* ── Star widget — 1 per page max, applied to the most important widget ──────── */
.widget-star {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.widget-star h1,
.widget-star h2,
.widget-star h3,
.widget-star h4,
.widget-star p,
.widget-star span,
.widget-star small,
.widget-star label,
.widget-star .card-title,
.widget-star .section-title {
    color: #000000 !important;
}

/* ── Editorial typography ────────────────────────────────────────────────────── */
h1, h2, h3, h4,
.page-title, .section-title, .card-title {
    font-family: 'Playfair Display', serif !important;
    font-weight: 900 !important;
    color: var(--elia-black) !important;
    line-height: 1.15 !important;
}
h1 { font-size: clamp(1.75rem, 4.5vw, 3.75rem) !important; letter-spacing: -1px !important; position: relative; }
h2 { font-size: clamp(1.3rem, 3.35vw, 2.4rem) !important; letter-spacing: -0.5px !important; }
h3 { font-size: clamp(1.2rem, 2.55vw, 1.9rem) !important; letter-spacing: -0.3px !important; }
h4 { font-size: clamp(1rem, 1.9vw, 1.45rem) !important; letter-spacing: -0.2px !important; }
@media (max-width: 400px) {
    h1 { font-size: clamp(1.4rem, 6.0vw, 1.95rem) !important; }
    h2 { font-size: clamp(1.15rem, 4.5vw, 1.4rem) !important; }
    h3 { font-size: clamp(1rem, 4.3vw, 1.35rem) !important; }
    h4 { font-size: clamp(0.9rem, 3.4vw, 1.1rem) !important; }
}

/* ── Anti-grey global override ────────────────────────────────────────────────── */
:root { --text-muted: #000000 !important; }

p, span, small, label, li, td, th, dt, dd,
.hint, .caption, .subtitle, .helper-text, .note,
.text-muted, .text-secondary, .text-gray,
.muted, .secondary, .description,
[class*="subtitle"], [class*="caption"], [class*="helper"],
[class*="hint"], [class*="muted"] {
    color: #000000;
}

/* ═══════════════════════════════════════════════════════════════════
   STICKY TOP HEADER
═══════════════════════════════════════════════════════════════════ */

#elia-nav-container {
    position: sticky;
    top: 0;
    z-index: 500;
    background: var(--elia-white);
    border-bottom: 1px solid var(--elia-cream-dark);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    /* Full width — no margins, no max-width constraints */
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0;
    padding-right: 0;
    align-self: stretch;
    flex-shrink: 0;
    box-sizing: border-box;
}

.elia-sticky-header {
    width: 100%;
    background: var(--elia-white);
}

/* ── Full-width body override — prevents body max-width from clipping nav (spec v18) ── */
body {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
}

/* Inner nav bar */
.elia-header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 90px;
    gap: 16px;
}

/* Logo */
.elia-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.elia-logo-img {
    /* Preserve original proportions — never force both width AND height */
    width: auto;
    height: 80px;
    max-width: 150px;
    object-fit: contain;
    display: block;
    padding: 4px 0;
}

/* ── 4 header tab items ───────────────────────────────────────────────────── */
.elia-header-tabs {
    display: flex;
    align-items: stretch;
    gap: 4px;
    height: 100%;
}

.elia-header-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 20px;
    text-decoration: none;
    color: var(--elia-black);
    position: relative;
    border-bottom: 2px solid transparent;
    transition: border-color 0.18s, opacity 0.18s;
    min-width: 72px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.elia-header-tab:hover {
    opacity: 0.7;
}

.elia-header-tab.active {
    border-bottom-color: var(--elia-black);
}

.elia-tab-icon {
    width: 28px !important;
    height: 28px !important;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.elia-tab-label {
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #000000;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.5px;
    line-height: 1;
}

.elia-header-tab.active .elia-tab-label {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    color: #000000;
    text-transform: uppercase;
}

/* ── Mobile responsive header (5 tabs) ────────────────────────────────── */
@media (max-width: 600px) {
    .elia-header-nav {
        padding: 0 8px;
        height: 80px;
        gap: 4px;
    }

    .elia-logo-img {
        width: auto;
        height: 70px;
        max-width: 100px;
        object-fit: contain;
        padding: 4px 0;
    }

    .elia-header-tabs {
        flex: 1;
        justify-content: flex-end;
        gap: 0;
    }

    .elia-header-tab {
        padding: 0 4px;
        min-width: 0;
        flex: 1;
    }

    .elia-tab-icon {
        width: 22px !important;
        height: 22px !important;
    }

    .elia-tab-label {
        font-size: 9px;
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .elia-header-nav {
        padding: 0 16px;
    }

    .elia-header-tab {
        padding: 0 14px;
    }

    .elia-tab-icon {
        width: 24px !important;
        height: 24px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   FLOATING CHAT FAB — all screen sizes
═══════════════════════════════════════════════════════════════════ */

.elia-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--elia-black);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 400;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.elia-chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}

.elia-chat-fab:active {
    transform: scale(0.95);
}

.elia-chat-fab-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: invert(1);
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   BODY — no bottom padding (no bottom bar anymore)
═══════════════════════════════════════════════════════════════════ */
body {
    padding-bottom: 0 !important;
}

/* Bottom bar completely disabled */
.mobile-nav {
    display: none !important;
}

/* Smooth tap highlight removal */
* { -webkit-tap-highlight-color: transparent; }

/* ═══════════════════════════════════════════════════════════════════
   LEGACY COMPATIBILITY — keep old class names working where used
   (prevents layout breaks on pages that reference old selectors)
═══════════════════════════════════════════════════════════════════ */

/* Logo (legacy) */
.app-nav .logo {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 24px;
    color: var(--elia-black);
    text-decoration: none;
}

/* nav-link still styled if any page uses it directly */
.nav-link {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #000000;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-link.active {
    border-bottom: 2px solid #000000;
}

/* Mobile menu overlay (sidebar) — keep for /plus page */
.mobile-menu-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.mobile-menu-overlay.visible {
    opacity: 1;
    visibility: visible;
}
.mobile-menu-drawer {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 85%;
    max-width: 360px;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.mobile-menu-overlay.visible .mobile-menu-drawer {
    transform: translateX(0);
}

/* Elia icon base — 44px per spec v34 */
.elia-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block !important; /* v20: force visibility — prevent any display:none override */
}

/* ── Phase card icon — always visible (fix: Bilan du jour icon hidden) ── */
.phase-card-icon img {
    display: inline-block !important;
}

/* ── .top-nav — transparent background (spec v18) ─────────────────────────── */
.top-nav {
    background: transparent !important;
}

/* ── No black/dark backgrounds on widgets (spec v18) ─────────────────────── */
.chat-preview-card {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-radius: 16px;
}
.chat-preview-card * {
    color: #000000 !important;
}

/* ── .card-label .icon — 44px (spec v34) ─────────────────────────────────── */
.card-label .icon,
.card-label img {
    width: 44px !important;
    height: 44px !important;
    object-fit: contain;
}

/* ── Global icon size overrides (spec-mandated sizes v34) ─────────────────── */
.card-icon {
    width: 44px !important;
    height: 44px !important;
    object-fit: contain;
}

.quick-link img {
    width: 44px !important;
    height: 44px !important;
    object-fit: contain;
    display: inline-block !important; /* v34: fix display:none override from button img rule */
}

.wellbeing-img {
    width: 56px !important;
    height: 56px !important;
    object-fit: contain;
    flex-shrink: 0;
}

.mini-card .mc-icon img {
    width: 44px !important;
    height: 44px !important;
    object-fit: contain;
}

.card-title img {
    width: 50px !important;
    height: 50px !important;
    object-fit: contain;
}

/* ── /plus page section list ─────────────────────────────────────────────── */
.plus-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 32px 20px 120px;
}

.plus-section {
    margin-bottom: 32px;
}

.plus-section-title {
    font-family: 'Playfair Display', serif !important;
    font-size: 18px !important;
    font-weight: 900 !important;
    color: #000 !important;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--elia-cream-dark);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.plus-item-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.plus-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--elia-black);
    font-size: 16px;
    font-weight: 600;
    transition: background 0.15s;
    background: white;
}

.plus-item:hover {
    background: var(--elia-cream);
}

.plus-item:active {
    background: var(--elia-cream-dark);
}

.plus-item-arrow {
    font-size: 16px;
    color: #999;
    flex-shrink: 0;
}

.plus-logout-btn {
    width: 100%;
    padding: 16px 20px;
    background: var(--elia-black);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Playfair Display', serif;
    letter-spacing: 0.2px;
    transition: opacity 0.15s;
    margin-top: 32px;
}

.plus-logout-btn:hover { opacity: 0.8; }
.plus-logout-btn:active { opacity: 0.6; }

/* ═══════════════════════════════════════════════════════════════════
   "PLUS" DROPDOWN OVERLAY
   Slides down from the header on all screen sizes.
   z-index 600 — above header (500) and FAB (400)
═══════════════════════════════════════════════════════════════════ */

.elia-plus-dropdown {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 600;
}

.elia-plus-dropdown.open {
    display: block;
}

/* ── Semi-transparent backdrop ── */
.elia-dropdown-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    animation: elia-fade-in 0.22s ease;
}

/* ── Sliding panel ── */
.elia-dropdown-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    max-height: 88vh;
    background: var(--elia-white);
    border-radius: 0 0 20px 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: elia-slide-down 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

@keyframes elia-slide-down {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

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

/* ── Panel header ── */
.elia-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--elia-cream-dark);
    flex-shrink: 0;
}

.elia-dropdown-title {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 900;
    color: var(--elia-black);
    letter-spacing: -0.3px;
}

.elia-dropdown-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--elia-cream);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--elia-black);
    transition: background 0.15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.elia-dropdown-close:hover  { background: var(--elia-cream-dark); }
.elia-dropdown-close:active { transform: scale(0.9); }

/* ── Scrollable body ── */
.elia-dropdown-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0 24px;
    flex: 1;
}

/* ── Category section ── */
.elia-dropdown-section {
    padding: 12px 0 4px;
}

.elia-dropdown-section-title {
    font-family: 'Playfair Display', serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #888;
    padding: 0 20px 8px;
}

.elia-dropdown-items {
    display: flex;
    flex-direction: column;
}

/* ── Each menu item ── */
.elia-dropdown-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    text-decoration: none;
    color: var(--elia-black);
    font-size: 15px;
    font-weight: 600;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
}

.elia-dropdown-item:hover  { background: var(--elia-cream); }
.elia-dropdown-item:active { background: var(--elia-cream-dark); }

.elia-dropdown-item-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.elia-dropdown-item-label {
    flex: 1;
    line-height: 1.3;
}

.elia-dropdown-item-arrow {
    font-size: 18px;
    color: #bbb;
    flex-shrink: 0;
    line-height: 1;
}

/* ── Logout inside dropdown ── */
.elia-dropdown-logout {
    padding: 20px 20px 0;
    border-top: 1px solid var(--elia-cream-dark);
    margin-top: 12px;
}

.elia-dropdown-logout-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--elia-black);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Playfair Display', serif;
    letter-spacing: 0.2px;
    transition: opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.elia-dropdown-logout-btn:hover  { opacity: 0.82; }
.elia-dropdown-logout-btn:active { opacity: 0.6; }

/* ── Desktop: narrower panel, right-aligned ── */
@media (min-width: 640px) {
    .elia-dropdown-panel {
        left: auto;
        right: 0;
        width: 380px;
        max-height: 80vh;
        border-radius: 0 0 20px 20px;
    }
}

@media (min-width: 1024px) {
    .elia-dropdown-panel {
        right: max(20px, calc((100vw - 1100px) / 2));
        width: 360px;
        border-radius: 0 0 16px 16px;
    }
}

/* ── Prevent body scroll when dropdown open ── */
body.elia-dropdown-body-open {
    overflow: hidden;
}

/* ── Plus button — reset browser button defaults ── */
button.elia-header-tab {
    background: none;
    border: none;
    outline: none;
    font-family: inherit;
    cursor: pointer;
}

/* ── Blob decoration under section titles ────────────────────────────────── */
.section-title-wrapper,
.page-title-wrapper {
    position: relative;
    display: inline-block;
}

.section-title-wrapper::before,
.page-title-wrapper::before,
h1::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    background-image: url('https://cdn.shopify.com/s/files/1/0045/2244/2786/files/blob.png?v=1774093762');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.35;
    z-index: -1;
    pointer-events: none;
}

/* ── Secondary text color ─────────────────────────────────────────────────── */
.text-secondary,
.hint,
.caption,
.subtitle,
.helper-text,
.note,
.elia-dropdown-section-title,
.plus-item-arrow {
    color: #b8aa8e !important;
}

/* ── Buttons: text only, no icons/emojis ──────────────────────────────────── */
/* v34: exclude .quick-link buttons (bilan du jour, etc.) to keep widget icons visible */
/* v430117: exclude .notif-btn — [class*="btn"] substring match was hiding notification icon */
button:not(.quick-link):not(.notif-btn) img:not(.elia-tab-icon):not(.elia-logo-img):not(.elia-chat-fab-icon):not(.elia-dropdown-item-icon):not(.elia-icon),
.btn:not(.quick-link):not(.notif-btn) img:not(.elia-tab-icon):not(.elia-logo-img):not(.elia-chat-fab-icon):not(.elia-dropdown-item-icon):not(.elia-icon),
[class*="btn"]:not([class*="quick"]):not(.notif-btn) img:not(.elia-tab-icon):not(.elia-logo-img):not(.elia-chat-fab-icon):not(.elia-dropdown-item-icon):not(.elia-icon) {
    display: none !important;
}

/* ── Card spacing — minimum 16px gap ──────────────────────────────────── */
.card + .card,
.widget + .widget,
.dashboard-card + .dashboard-card,
.section-card + .section-card {
    margin-top: 16px;
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE BOTTOM TAB BAR (≤ 768px)
   On mobile the sticky header moves to a fixed bottom bar.
   Desktop (> 768px) is unchanged — top sticky header.
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Reposition container to bottom ────────────────────────────────── */
    #elia-nav-container {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        border-top: 1px solid var(--elia-cream-dark) !important;
        border-bottom: none !important;
        box-shadow: 0 -1px 0 rgba(0,0,0,0.04), 0 -4px 16px rgba(0,0,0,0.07) !important;
        /* iOS safe area (notch/home bar) */
        padding-bottom: env(safe-area-inset-bottom, 0) !important;
    }

    /* ── Inner nav bar: full width, fixed height ────────────────────────── */
    .elia-header-nav {
        padding: 0 !important;
        height: 64px !important;
        max-width: 100% !important;
        justify-content: stretch !important;
        gap: 0 !important;
    }

    /* ── Hide logo — not needed in a bottom tab bar ─────────────────────── */
    .elia-logo {
        display: none !important;
    }

    /* ── Tabs fill the full width ────────────────────────────────────────── */
    .elia-header-tabs {
        flex: 1 !important;
        width: 100% !important;
        justify-content: space-around !important;
        height: 100% !important;
        gap: 0 !important;
    }

    .elia-header-tab {
        flex: 1 !important;
        padding: 0 4px !important;
        min-width: 0 !important;
        /* Active indicator moves to top for bottom bar */
        border-bottom: none !important;
        border-top: 2px solid transparent !important;
        transition: border-color 0.18s, opacity 0.18s !important;
    }

    .elia-header-tab.active {
        border-top-color: var(--elia-black) !important;
        border-bottom: none !important;
    }

    .elia-tab-icon {
        width: 24px !important;
        height: 24px !important;
    }

    .elia-tab-label {
        font-size: 9px !important;
        letter-spacing: 0.3px !important;
    }

    /* ── Body: add bottom padding so content isn't hidden behind bottom bar */
    /* 64px nav height + safe area */
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0)) !important;
    }

    /* ── Chat FAB: hidden on mobile — Chat is now a direct bottom tab ──── */
    .elia-chat-fab {
        display: none !important;
    }

    /* ── "Plus" dropdown: always slides from top, full width ────────────── */
    .elia-dropdown-panel {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 85vh !important;
        border-radius: 0 0 20px 20px !important;
    }
}

/* ── Custom Shopify icons ────────────────────────────────────────────────────── */
.elia-icon {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    display: inline-block;
    object-fit: contain;
}
