/**
 * Molivaplus — Responsive Global Stylesheet
 * Injecté dans toutes les pages via le routeur (index.php)
 * Cible : Mobile 320px → Tablette 768px → Desktop 1200px+
 */

/* ============================================
   BASE RESETS & GLOBAL RESPONSIVE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

table {
    max-width: 100%;
}

/* ============================================
   VITRINE — HEADER RESPONSIVE
   ============================================ */
.hamburger-btn {
    display: none;
    background: #1a4d5a;
    border: none;
    color: #fff;
    width: 45px;
    height: 45px;
    border-radius: 4px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 3000;
    position: relative;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.hamburger-btn:hover {
    background: #c9b366;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 992px) {
    .header-nav { display: none !important; }
    .top-bar-content {
        justify-content: center !important;
    }
    .tools {
        width: 100%;
        text-align: center !important;
        padding: 5px 0;
    }
}

@media (max-width: 991px) {
    .hamburger-btn { display: flex; }

    .main-header-content {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 15px !important;
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -300px;
        width: 300px;
        height: 100vh;
        background: #1a4d5a;
        z-index: 2800;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        padding: 80px 0 30px;
        display: block !important;
        box-shadow: -5px 0 25px rgba(0,0,0,0.2);
        left: auto !important;
    }
    
    .main-nav.mobile-open {
        right: 0 !important;
    }
    
    .main-nav ul {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 0 30px !important;
        margin: 0 !important;
    }
    
    .main-nav ul li {
        width: 100%;
        margin: 0 !important;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .main-nav ul li a {
        color: #fff !important;
        font-size: 1.2rem !important;
        font-weight: 600 !important;
        display: block;
        padding: 15px 0 !important;
        text-decoration: none !important;
        transition: color 0.2s;
    }

    .main-nav ul li a:hover {
        color: #c9b366 !important;
        padding-left: 5px !important;
    }
}

@media (max-width: 576px) {
    .header__auth a {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }
    .header__logo {
        height: 34px !important;
    }
}

/* ============================================
   VITRINE — HERO RESPONSIVE & FIX
   ============================================ */
.hero__home {
    position: relative !important;
    background-color: #006d44 !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
}

.hero__img, 
picture.hero__img img,
.hero__home picture img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    z-index: 1 !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.hero__text, 
.hero__home .container {
    position: relative !important;
    z-index: 10 !important;
    pointer-events: none; /* Permet de cliquer  travers si besoin, mais attention aux liens */
}

.hero__home .container * {
    pointer-events: auto;
}

@media (max-width: 768px) {
    .hero__title {
        font-size: 1.6rem !important;
    }
    .hero__baseline {
        font-size: 0.95rem !important;
    }
    .hero__home {
        min-height: 350px !important; /* Augmenté pour mobile */
    }
}

@media (max-width: 480px) {
    .hero__title {
        font-size: 1.25rem !important;
    }
    .hero__baseline {
        font-size: 0.85rem !important;
    }
}

/* ============================================
   VITRINE — CONTENT BLOCKS
   ============================================ */
@media (max-width: 768px) {
    .wp-block-columns {
        flex-direction: column !important;
    }
    .wp-block-column {
        flex-basis: 100% !important;
        margin-bottom: 16px;
    }
    .blocks-container {
        padding: 0 12px;
    }
    .block-moliva-key-figures__items {
        flex-wrap: wrap;
        gap: 12px;
    }
    .block-moliva-key-figures__item {
        flex: 1 1 30%;
        min-width: 80px;
    }
    .block-moliva-push-picture__wrapper {
        flex-direction: column !important;
    }
    .block-moliva-push-picture__item {
        width: 100% !important;
    }
    .block-moliva-push-news .news-list {
        flex-direction: column !important;
    }
    .block-news {
        width: 100% !important;
    }
    .wp-block-cover {
        min-height: 240px !important;
    }
    .wp-block-cover h2 {
        font-size: 1.3rem !important;
    }
}

/* ============================================
   VITRINE — FOOTER RESPONSIVE
   ============================================ */
.main-footer { background: #0d2b33; color: white; padding: 60px 0 30px; }
.footer-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 40px; margin-bottom: 50px; }
.footer-col { flex: 1; min-width: 250px; }
.footer-col h3 { color: #c9b366; font-size: 1.5rem; margin-bottom: 20px; }
.footer-col h4 { color: white; margin-bottom: 20px; }
.footer-col ul { list-style: none; padding: 0; color: #cbd5e1; font-size: 0.9rem; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { color: inherit; text-decoration: none; transition: color 0.2s; }
.footer-col ul li a:hover { color: #c9b366; }
.footer-col p { color: #cbd5e1; line-height: 1.6; font-size: 0.95rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 30px; text-align: center; }
.footer-bottom .copyright { color: #94a3b8; font-size: 0.85rem; }

@media (max-width: 768px) {
    .footer-row {
        flex-direction: column !important;
        gap: 30px !important;
    }
    .footer-col {
        width: 100% !important;
        min-width: 100% !important;
        text-align: center;
    }
    .footer-col ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    .footer-col ul li {
        margin-bottom: 0;
    }
}

/* ============================================
   DASHBOARD — SIDEBAR + MAIN LAYOUT
   ============================================ */
@media (max-width: 992px) {
    .dashboard-layout,
    .admin-layout,
    .dash-container {
        flex-direction: column !important;
        min-height: auto !important;
    }
    .sidebar,
    .dash-sidebar,
    .admin-sidebar {
        width: 100% !important;
        min-width: unset !important;
        max-width: 100% !important;
        position: relative !important;
        height: auto !important;
        min-height: auto !important;
    }
    .sidebar .nav-links,
    .dash-sidebar .nav-links {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        padding: 8px !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .sidebar .nav-links::-webkit-scrollbar {
        display: none;
    }
    .sidebar .nav-links a,
    .dash-sidebar .nav-links a {
        white-space: nowrap;
        padding: 8px 14px !important;
        font-size: 0.8rem !important;
        border-radius: 20px;
        flex-shrink: 0;
    }
    .sidebar .nav-links a span:not(.icon) {
        display: inline !important;
    }
    .main-content,
    .dash-main,
    .admin-main {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 16px !important;
    }
}

/* ============================================
   DASHBOARD — STATS CARDS
   ============================================ */
@media (max-width: 768px) {
    .stats-grid,
    .cards-grid,
    .stat-cards,
    .overview-cards {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .stat-card,
    .overview-card {
        padding: 16px !important;
    }
}

@media (min-width: 480px) and (max-width: 768px) {
    .stats-grid,
    .cards-grid,
    .stat-cards,
    .overview-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
   DASHBOARD — TRANSACTION TABLES
   ============================================ */
@media (max-width: 768px) {
    .table-responsive,
    .transactions-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }
    table {
        min-width: 600px;
    }
    table th, table td {
        padding: 8px 10px !important;
        font-size: 0.8rem !important;
        white-space: nowrap;
    }
    /* Card-style tables on very small screens */
    .mobile-card-table thead {
        display: none;
    }
    .mobile-card-table tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 12px;
        background: #fff;
    }
    .mobile-card-table td {
        display: flex;
        justify-content: space-between;
        padding: 6px 0 !important;
        border: none !important;
        font-size: 0.85rem !important;
    }
    .mobile-card-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        margin-right: 12px;
    }
}

/* ============================================
   ADMIN DASHBOARD — SPECIFIC
   ============================================ */
@media (max-width: 992px) {
    .admin-grid,
    .client-grid {
        grid-template-columns: 1fr !important;
    }
    .modal-content,
    .admin-modal {
        width: 95% !important;
        max-width: 95vw !important;
        margin: 10px auto !important;
        padding: 16px !important;
    }
    .admin-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    .admin-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    .admin-actions button,
    .admin-actions a {
        font-size: 0.8rem !important;
        padding: 6px 12px !important;
    }
}

/* ============================================
   FORMS — RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .form-card,
    .card {
        padding: 20px !important;
        border-radius: 12px !important;
    }
    .btn-row, .btn-group {
        flex-direction: column !important;
    }
    .btn-row .btn, .btn-group .btn {
        width: 100% !important;
    }
    .grid {
        grid-template-columns: 1fr !important;
    }
    .full {
        grid-column: span 1 !important;
    }
    .form-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   PROFILE / RIB / CARDS — RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .profile-grid,
    .rib-grid,
    .card-grid {
        grid-template-columns: 1fr !important;
    }
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    .profile-avatar {
        margin: 0 auto;
    }
    .bank-card {
        width: 100% !important;
        max-width: 340px;
        margin: 0 auto;
    }
}

/* ============================================
   VIREMENT / TRANSFER FORMS
   ============================================ */
@media (max-width: 768px) {
    .virement-form,
    .transfer-form {
        padding: 16px !important;
    }
    .virement-grid {
        grid-template-columns: 1fr !important;
    }
    .amount-display {
        font-size: 1.5rem !important;
    }
}

/* ============================================
   MODALS — RESPONSIVE
   ============================================ */
@media (max-width: 576px) {
    .modal-content,
    .modal-card,
    .modal-box {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 20px !important;
        margin: 10px !important;
        border-radius: 12px !important;
    }
}

/* ============================================
   UTILITY — TOUCH TARGETS
   ============================================ */
@media (max-width: 768px) {
    button, a.btn, input[type="submit"],
    .btn-submit, .btn-login, .btn-primary, .btn-next {
        min-height: 44px;
        min-width: 44px;
    }
    input, select, textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar, .dash-sidebar, .admin-sidebar,
    .header, .footer, .header__pre,
    .no-print, .btn, button {
        display: none !important;
    }
    .main-content, .dash-main {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
}

/* ============================================
   VUES SECONDAIRES DASHBOARD (cards, rib, profile, coinbase)
   Sidebar slide depuis la gauche — mobile
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 1100 !important;
        width: 280px !important;
        position: fixed !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 70px 16px 20px !important;
        max-width: 100% !important;
    }

    .hamburger-btn {
        display: flex !important;
        position: fixed !important;
        top: 15px !important;
        left: 15px !important;
        z-index: 1200 !important;
    }

    .cards-grid {
        grid-template-columns: 1fr !important;
    }

    .rib-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .transfer-grid {
        grid-template-columns: 1fr !important;
    }

    .form-row {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .rib-grid {
        grid-template-columns: 1fr !important;
    }
    .rib-container {
        padding: 24px !important;
    }
}
