/* =========================================================
   CIRCORA — RESPONSIVE DESIGN
   ========================================================= */


/* =========================================================
   1. TABLETTE
   <= 1024px
   ========================================================= */

@media (max-width: 1024px) {

    /* Navigation */

    .nav-links {
        gap: 18px;
    }

    .nav-actions {
        gap: 8px;
    }

    .navbar {
        gap: 20px;
    }


    /* Hero */

    .hero {
        grid-template-columns: 1fr 1fr;

        gap: 40px;

        padding-top: 60px;
        padding-bottom: 60px;
    }

    .hero h1 {
        font-size: clamp(2.8rem, 6vw, 4.5rem);
    }


    /* Steps */

    .steps {
        grid-template-columns: repeat(3, 1fr);
    }


    /* Packs */

    .packs-grid {
        grid-template-columns: repeat(3, 1fr);
    }


    /* Cycles */

    .cycles-grid {
        gap: 18px;
    }


    /* Hero visual */

    .hero-visual {
        min-height: 450px;
    }

    .hero-orbit-one {
        width: 330px;
        height: 330px;
    }

    .hero-orbit-two {
        width: 245px;
        height: 245px;
    }

    .hero-logo {
        width: 145px;
        top: 65px;
    }

    .hero-card {
        right: 5%;
        bottom: 45px;
    }
}


/* =========================================================
   2. PETITE TABLETTE / GRAND MOBILE
   <= 768px
   ========================================================= */

@media (max-width: 768px) {

    :root {
        --site-header-height: 71px;
    }

    /* =====================================================
       NAVIGATION
       ===================================================== */

    .navbar {
        min-height: 70px;
    }

    .nav-actions {
        margin-left: auto;
    }

    .nav-actions .btn-outline {
        display: none;
    }

    .logo {
        width: 135px;
    }


    /* =====================================================
       HERO
       ===================================================== */

    .hero {
        grid-template-columns: 1fr;

        padding-top: 55px;
        padding-bottom: 55px;

        gap: 45px;
    }

    .hero-content {
        max-width: 100%;
        text-align: center;
    }

    .hero-badge {
        margin-bottom: 18px;
    }

    .hero h1 {
        font-size: clamp(3rem, 10vw, 4.5rem);
    }

    .hero p {
        margin-inline: auto;
    }

    .hero-actions {
        justify-content: center;
    }


    /* =====================================================
       HERO VISUAL
       ===================================================== */

    .hero-visual {
        min-height: 430px;

        width: 100%;
        max-width: 600px;

        margin-inline: auto;
    }


    /* =====================================================
       HIGHLIGHTS
       ===================================================== */

    .highlights {
        grid-template-columns: repeat(3, 1fr);

        margin-bottom: 60px;
    }


    /* =====================================================
       SECTIONS
       ===================================================== */

    .section {
        padding-top: 70px;
        padding-bottom: 70px;
    }

    .section-heading {
        margin-bottom: 35px;
    }


    /* =====================================================
       STEPS
       ===================================================== */

    .steps {
        grid-template-columns: repeat(2, 1fr);
    }


    /* =====================================================
       CYCLES
       ===================================================== */

    .cycles-grid {
        grid-template-columns: 1fr;
        max-width: 550px;
    }

    .cycle-card {
        padding: 30px;
    }


    /* =====================================================
       PACKS
       ===================================================== */

    .packs-grid {
        grid-template-columns: repeat(2, 1fr);
    }


    /* =====================================================
       PAYMENTS
       ===================================================== */

    .payment-grid {
        grid-template-columns: 1fr;
    }


    /* =====================================================
       FOOTER
       ===================================================== */

    .footer-content {
        flex-direction: column;
        gap: 30px;
    }

    .footer-links {
        gap: 18px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 900px) {
    .contribution-layout { grid-template-columns: 1fr; }
    .contribution-aside { position: static; }
    .workflow-grid { grid-template-columns: 1fr; }
    .chat-workspace { grid-template-columns: 1fr; }
    .chat-thread-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .workflow-card, .chat-panel, .chat-threads-panel { padding: 15px; }
    .contribution-summary > div { align-items: flex-start; flex-direction: column; gap: 2px; }
    .choice-grid { grid-template-columns: 1fr; }
    .chat-thread-list { grid-template-columns: 1fr; }
    .chat-composer { align-items: stretch; }
    .chat-composer textarea { flex-basis: 100%; }
    .chat-file-button, .chat-composer button { flex: 1 1 auto; }
    .admin-main { width: min(100% - 24px, 1440px); }
    .admin-tabs { position: static; flex-wrap: nowrap; overflow-x: auto; }
    .admin-tab { flex: 0 0 auto; }
    .admin-match-controls { grid-template-columns: 1fr; }
}


/* =========================================================
   3. MOBILE
   <= 480px
   ========================================================= */

@media (max-width: 480px) {

    /* =====================================================
       GLOBAL
       ===================================================== */

    .navbar,
    .hero,
    .highlights,
    .section,
    .cta-content,
    .footer-content,
    .footer-bottom {
        width: min(100% - 28px, var(--container-width));
    }


    :root {
        --site-header-height: 65px;
    }

    /* =====================================================
       NAVIGATION
       ===================================================== */

    .navbar {
        min-height: 64px;
        gap: 10px;
    }

    .logo {
        width: 100px;
    }

    .nav-actions .btn-primary {
        min-height: 38px;
        padding-inline: 10px;
        font-size: 0.74rem;
        white-space: nowrap;
    }


    /* =====================================================
       HERO
       ===================================================== */

    .hero {
        padding-top: 45px;
        padding-bottom: 45px;

        gap: 35px;
    }

    .hero h1 {
        font-size: clamp(2.25rem, 11vw, 3.2rem);
        letter-spacing: -0.055em;
    }

    .hero p {
        font-size: 0.98rem;
        line-height: 1.7;
    }

    .hero-actions {
        flex-direction: column;

        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
    }


    /* =====================================================
       HERO VISUAL
       ===================================================== */

    .hero-visual {
        min-height: 390px;

        border-radius: var(--radius-lg);
    }

    .hero-orbit-one {
        width: 290px;
        height: 290px;
    }

    .hero-orbit-two {
        width: 215px;
        height: 215px;
    }

    .hero-logo {
        width: 125px;
        top: 60px;

        padding: 16px;
    }

    .hero-card {
        right: 50%;
        bottom: 30px;

        transform: translateX(50%);

        width: calc(100% - 40px);

        padding: 23px;
    }

    .hero-card strong {
        font-size: 1.7rem;
    }


    /* =====================================================
       HIGHLIGHTS
       ===================================================== */

    .highlights {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 30px;
    }

    .highlight-card {
        min-width: 0;
        padding: 18px 12px;
    }

    .highlight-card:last-child {
        grid-column: 1 / -1;
    }


    /* =====================================================
       SECTION
       ===================================================== */

    .section {
        padding-top: 55px;
        padding-bottom: 55px;
    }

    .section.section-light {
        width: 100%;
        padding-inline: 14px;
    }

    .section-heading h2 {
        font-size: clamp(1.7rem, 8vw, 2rem);
    }


    /* =====================================================
       STEPS
       ===================================================== */

    .steps {
        grid-template-columns: 1fr;
    }

    .step-card {
        padding: 22px;
    }


    /* =====================================================
       CYCLES
       ===================================================== */

    .cycle-card {
        padding: 27px;
    }

    .cycle-card strong {
        font-size: 2.6rem;
    }


    /* =====================================================
       PACKS
       ===================================================== */

    .packs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .pack-card {
        min-width: 0;
        padding: 16px 13px;
    }

    .pack-card span {
        margin-bottom: 8px;
        font-size: 0.68rem;
    }

    .pack-card strong {
        font-size: 1.05rem;
        overflow-wrap: anywhere;
    }

    .pack-card small {
        display: block;
        font-size: 0.7rem;
        line-height: 1.5;
    }

    .pack-card small span {
        white-space: nowrap;
    }

    .info-grid,
    .pillars-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .marketing-grid {
        grid-template-columns: 1fr;
    }

    .info-card,
    .pillar-card {
        min-width: 0;
        padding: 18px 14px;
    }

    .info-card span,
    .pillar-card p {
        font-size: 0.82rem;
    }

    .pillar-card h3 {
        font-size: 0.9rem;
    }

    .distribution-grid {
        grid-template-columns: 1fr;
    }

    .currency-reference {
        padding: 20px;
    }


    /* =====================================================
       PAYMENTS
       ===================================================== */

    .payment-card {
        padding: 27px;
    }


    /* =====================================================
       CTA
       ===================================================== */

    .cta-section {
        margin: 40px 14px;

        padding: 60px 20px;

        border-radius: var(--radius-lg);
    }

    .cta-section h2 {
        font-size: clamp(1.9rem, 9vw, 2.4rem);
    }


    /* =====================================================
       FOOTER
       ===================================================== */

    .footer-content {
        padding-top: 45px;
        padding-bottom: 30px;
    }

    .footer-links {
        flex-direction: column;
        gap: 12px;
    }

    .footer-bottom {
        padding-bottom: 20px;
    }
}

/* Navigation d’application pour les membres connectés */
.mobile-app-nav,
.mobile-more-sheet,
.mobile-more-backdrop {
    display: none;
}

@media (max-width: 768px) {
    body.member-area {
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
    }

    .navbar.member-nav .nav-links,
    .navbar.member-nav .nav-actions,
    .navbar.member-nav .mobile-menu-button {
        display: none;
    }

    .mobile-app-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 160;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        min-height: 68px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid var(--color-border);
        box-shadow: 0 -8px 24px rgba(12, 48, 30, 0.1);
    }

    .mobile-app-nav-link {
        display: grid;
        min-width: 0;
        padding: 5px 2px;
        color: var(--color-text-secondary);
        place-items: center;
        gap: 2px;
        border: 0;
        background: transparent;
        font: inherit;
        text-decoration: none;
    }

    .mobile-app-nav-link > span {
        display: grid;
        width: 26px;
        height: 26px;
        place-items: center;
        border-radius: 9px;
        font-size: 1.25rem;
        font-weight: 700;
        line-height: 1;
    }

    .mobile-app-nav-link small {
        overflow: hidden;
        max-width: 100%;
        color: inherit;
        font-size: 0.62rem;
        font-weight: 700;
        line-height: 1.1;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-app-nav-link[aria-current="page"],
    .mobile-app-nav-link.is-current {
        color: var(--color-primary);
    }

    .mobile-app-nav-link[aria-current="page"] > span,
    .mobile-app-nav-link.is-current > span {
        background: rgba(17, 154, 80, 0.12);
    }

    .mobile-more-backdrop {
        position: fixed;
        inset: 0;
        z-index: 170;
        display: block;
        border: 0;
        background: rgba(9, 28, 18, 0.42);
    }

    .mobile-more-sheet {
        position: fixed;
        right: 0;
        bottom: calc(74px + env(safe-area-inset-bottom));
        left: 0;
        z-index: 180;
        display: block;
        max-height: min(70vh, 560px);
        overflow: auto;
        padding: 20px 18px;
        background: var(--color-white);
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -12px 36px rgba(12, 48, 30, 0.18);
    }

    .mobile-more-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;
    }

    .mobile-more-header strong,
    .mobile-more-header small {
        display: block;
    }

    .mobile-more-header strong { font-size: 1.15rem; }
    .mobile-more-header small { margin-top: 2px; color: var(--color-text-secondary); }

    .mobile-more-close {
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 50%;
        background: var(--color-background);
        color: var(--color-text);
        font-size: 1.8rem;
        line-height: 1;
    }

    .mobile-more-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .mobile-more-links a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 48px;
        padding: 10px 12px;
        border: 1px solid var(--color-border);
        border-radius: 12px;
        color: var(--color-text);
        font-size: 0.86rem;
        font-weight: 650;
        text-decoration: none;
    }

    .mobile-more-links a[aria-current="page"] {
        border-color: var(--color-primary);
        background: rgba(17, 154, 80, 0.1);
        color: var(--color-primary);
    }

    .mobile-more-logout {
        width: 100%;
        margin-top: 14px;
        padding: 12px;
        border: 1px solid #d64545;
        border-radius: 12px;
        background: transparent;
        color: #b52d2d;
        font: inherit;
        font-weight: 700;
    }

    body.mobile-more-open { overflow: hidden; }
}
/* =========================================================
   4. MOBILE MENU
   ========================================================= */

.mobile-menu-button {
    display: none;

    width: 36px;
    height: 36px;

    padding: 0;

    align-items: center;
    justify-content: center;
    flex-direction: column;

    gap: 2px;

    background: transparent;

    border: 1px solid var(--color-border);
    border-radius: 10px;

    cursor: pointer;
}


.mobile-menu-button span {
    width: 16px;
    height: 2px;
    margin: 0;

    background: var(--color-primary);

    border-radius: 999px;

    transition:
        transform 0.25s ease,
        opacity 0.25s ease;
}

.navbar.member-nav .nav-links a {
    white-space: nowrap;
}

.navbar.member-nav .nav-links a[aria-current="page"] {
    color: var(--color-primary);
    font-weight: 700;
}

.member-area .dashboard-layout {
    display: block;
}

.member-area [data-component="sidebar"] {
    display: none;
}

.member-area .dashboard-main {
    width: min(100%, 1400px);
}

@media (min-width: 1025px) {
    body.member-area {
        padding-top: 124px;
    }

    .navbar.member-nav {
        min-height: 0;
        flex-wrap: wrap;
        column-gap: 20px;
        row-gap: 0;
        padding-top: 12px;
    }

    .navbar.member-nav .logo {
        flex: 0 0 155px;
    }

    .navbar.member-nav .nav-actions {
        order: 2;
        margin-left: auto;
    }

    .navbar.member-nav .nav-links {
        order: 3;
        flex: 0 0 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px 22px;
        padding: 4px 0 12px;
    }

    .navbar.member-nav .mobile-menu-button {
        display: none;
    }

    .navbar.member-nav .nav-links a {
        font-size: 0.85rem;
    }
}

@media (min-width: 1025px) and (max-width: 1200px) {
    body.member-area {
        padding-top: 148px;
    }

    .navbar.member-nav .nav-links {
        gap: 8px 14px;
    }
}


/* ---------------------------------------------------------
   MOBILE
   --------------------------------------------------------- */

@media (max-width: 1024px) {

    :root {
        --site-header-height: 71px;
    }

    .mobile-menu-button {
        display: flex;
    }

    .navbar {
        position: relative;
        min-height: 70px;
        gap: 12px;
    }

    .navbar .logo {
        width: 135px;
        flex: 0 0 135px;
    }

    .nav-actions .btn-outline {
        display: none;
    }

    .navbar:not(.member-nav) .nav-actions {
        margin-left: auto;
    }

    .navbar:not(.member-nav) .nav-links {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        left: auto;
        width: min(320px, calc(100vw - 28px));
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 10px;
        background: var(--color-white);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-lg);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
        z-index: 120;
    }

    .navbar:not(.member-nav).menu-open .nav-links {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .navbar:not(.member-nav) .nav-links a {
        width: 100%;
        padding: 11px 13px;
        border-radius: 8px;
    }

    body.member-area {
        padding-top: var(--site-header-height);
    }

    .navbar.member-nav {
        flex-wrap: nowrap;
        gap: 10px;
        padding-top: 0;
    }

    .navbar.member-nav .logo {
        flex: 0 0 120px;
        width: 120px;
    }

    .navbar.member-nav .nav-actions {
        order: initial;
        margin-left: auto;
    }

    .navbar.member-nav .mobile-menu-button {
        order: 3;
    }

    .navbar.member-nav .nav-links {
        order: initial;
    }

    .navbar.member-nav .nav-actions .btn {
        white-space: nowrap;
    }

    .navbar.member-nav .mobile-menu-button {
        display: flex;
        flex: 0 0 36px;
        margin-left: auto;
    }

    .navbar.member-nav .nav-actions {
        display: flex;
        margin-left: auto;
    }

    .navbar.member-nav .nav-links {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        left: auto;
        width: min(320px, calc(100vw - 28px));
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 10px;
        background: var(--color-white);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-lg);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
        z-index: 120;
    }

    .navbar.member-nav.menu-open .nav-links {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .navbar.member-nav .nav-links a {
        display: block;
        width: 100%;
        padding: 11px 13px;
        border-radius: 8px;
        white-space: normal;
    }

    .navbar.member-nav .nav-links a[aria-current="page"] {
        background: rgba(17, 154, 80, 0.1);
    }

    .navbar.member-nav .nav-actions .btn-primary {
        display: inline-flex;
    }

    .nav-links {
        position: absolute;

        top: calc(100% + 10px);
        left: 0;
        right: 0;

        display: flex;
        flex-direction: column;

        gap: 0;

        padding: 10px;

        background: var(--color-white);

        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);

        box-shadow: var(--shadow-lg);

        opacity: 0;
        visibility: hidden;

        transform: translateY(-10px);

        transition:
            opacity 0.25s ease,
            transform 0.25s ease,
            visibility 0.25s ease;

        z-index: 100;
    }


    .nav-links a {
        display: block;

        width: 100%;

        padding: 13px 15px;

        border-radius: 8px;
    }


    .nav-links a:hover {
        background: var(--color-background);
    }


    /* Menu ouvert */

    .navbar.menu-open .nav-links {
        opacity: 1;
        visibility: visible;

        transform: translateY(0);
    }

    .dashboard-layout,
    .dashboard-main,
    .admin-main,
    .dashboard-section,
    .member-panel,
    .workflow-grid,
    .workflow-card {
        min-width: 0;
    }

    .dashboard-stats,
    .wallet-grid,
    .referral-grid,
    .profile-grid,
    .workflow-grid,
    .payment-zone-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-main {
        width: min(100% - 28px, 1440px);
        padding-inline: 0;
    }

    .admin-tabs {
        top: calc(var(--site-header-height) + 8px);
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
    }

    .admin-tab {
        flex: 0 0 auto;
    }

    .admin-main .data-table {
        min-width: 760px;
    }

    .payment-instruction {
        flex-direction: column;
    }

    .payment-instruction .btn-copy {
        width: 100%;
    }

    .list-item {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }

    .list-item .status-pill,
    .list-item > .btn {
        flex: 0 0 auto;
    }


    /* Transformation du hamburger en X */

    .navbar.menu-open .mobile-menu-button span:nth-child(1) {
        transform: translateY(4px) rotate(45deg);
    }

    .navbar.menu-open .mobile-menu-button span:nth-child(2) {
        opacity: 0;
    }

    .navbar.menu-open .mobile-menu-button span:nth-child(3) {
        transform: translateY(-4px) rotate(-45deg);
    }
}
/* =========================================
   DASHBOARD RESPONSIVE
========================================= */

@media (max-width: 1024px) {

    .dashboard-main {
        padding: 32px 24px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

}


@media (max-width: 768px) {

    .dashboard-main {
        padding: 28px 18px;
    }

    .dashboard-header h1 {
        font-size: 30px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .dashboard-section {
        padding: 22px;
    }

    .dashboard-section-header {
        align-items: flex-start;
        flex-direction: column;
    }

}


@media (max-width: 480px) {

    .dashboard-main {
        padding: 24px 14px;
    }

    .dashboard-header h1 {
        font-size: 26px;
    }

    .dashboard-stat-card strong {
        font-size: 24px;
    }

    .dashboard-section {
        padding: 18px;
        border-radius: 16px;
    }

    .dashboard-empty {
        padding: 40px 16px;
    }

}
/* =========================================
   CYCLES PAGE RESPONSIVE
========================================= */

@media (max-width: 1024px) {

    .cycles-page-grid {
        grid-template-columns: repeat(2, 1fr);
    }

}

@media (max-width: 768px) {

    .cycles-page-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 768px) {
    .dashboard-layout {
        display: block;
    }

    .sidebar {
        width: 100%;
        min-height: 0;
        padding: 14px;
        border-right: 0;
        border-bottom: 1px solid var(--color-border);
    }

    .sidebar-header {
        padding: 0 8px 10px;
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .sidebar-link {
        min-width: 0;
        padding: 10px;
        font-size: 0.82rem;
    }

    .dashboard-main {
        min-width: 0;
    }

    .wallet-grid,
    .referral-grid,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .table-card {
        overflow-x: auto;
    }

    .data-table {
        min-width: 560px;
    }

    .distribution-workflow {
        grid-template-columns: 1fr;
    }

    .chat-panel {
        padding: 18px;
    }

    .chat-message {
        max-width: 92%;
    }
}

@media (max-width: 480px) {
    .auth-page {
        padding: 42px 14px 56px;
    }

    .auth-card {
        padding: 24px 18px;
        border-radius: 18px;
    }

    .auth-card h2 {
        font-size: 1.65rem;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .auth-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .list-item {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .payment-instruction,
    .copyable-link {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .payment-instruction .btn-copy,
    .copyable-link .btn-copy {
        width: 100%;
    }

    .form-footer,
    .chat-confirmation,
    .chat-composer {
        align-items: stretch;
        flex-direction: column;
    }

    .chat-header {
        flex-wrap: wrap;
    }

    .chat-header > .btn {
        width: 100%;
    }

    .chat-composer .btn,
    .proof-form > .btn {
        width: 100%;
    }

    .split-line {
        align-items: flex-start;
    }
}
