/* ========================================
   DASHBOARD MOBILE FIX - CIBLE ET STABLE
   Date: 2026-02-13
======================================== */

/* Utilisé aussi en desktop pour les ratios dans progress bars */
.dashboard-progress-wrapper {
    position: relative;
}

.dashboard-progress-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--dashboard-dark-blue);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
    pointer-events: none;
}

/* Tablette/mobile */
@media (max-width: 768px) {
    .dashboard-main-content {
        overflow-x: hidden;
    }

    /* ---------- Header page ---------- */
    .dashboard-page-header {
        padding: 0.9rem !important;
        margin-bottom: 1rem !important;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .dashboard-header-left h1,
    .dashboard-header-left h2 {
        font-size: 1.2rem !important;
        line-height: 1.25;
        margin-bottom: 0.25rem;
    }

    .dashboard-header-left p {
        font-size: 0.88rem !important;
        margin-bottom: 0;
    }

    .dashboard-header-right {
        width: 100%;
    }

    .dashboard-header-right .dashboard-btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    /* ---------- Cards ---------- */
    .dashboard-card {
        margin-bottom: 1rem;
    }

    .dashboard-card-header {
        padding: 0.9rem !important;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.6rem;
    }

    .dashboard-card-title {
        margin: 0;
        flex: 1 1 auto;
        min-width: 0;
        font-size: 1.05rem;
        line-height: 1.25;
    }

    .dashboard-card-header .dashboard-btn,
    .dashboard-card-header .btn {
        min-height: 44px;
        white-space: nowrap;
        flex: 0 0 auto;
    }

    /* "Ma boutique" + "Mes dernières annonces" bouton non débordant */
    .dashboard-card-header .btn-sm,
    .dashboard-card-header .dashboard-btn.btn-sm {
        padding: 0.45rem 0.8rem !important;
        font-size: 0.9rem !important;
        width: auto !important;
        max-width: 100%;
    }

    .dashboard-card-body {
        padding: 0.9rem !important;
    }

    /* ---------- Stats cards ---------- */
    .dashboard-stat-card {
        padding: 0.95rem !important;
    }

    .stat-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.2rem !important;
    }

    .stat-label {
        font-size: 0.78rem !important;
    }

    .stat-value {
        font-size: 1.6rem !important;
        line-height: 1.15;
    }

    .stat-value small {
        font-size: 0.95rem !important;
    }

    .stat-trend {
        font-size: 0.76rem !important;
        line-height: 1.25;
    }

    /* ---------- Bloc Utilisation abonnement ---------- */
    .dashboard-progress {
        height: 24px !important;
        overflow: hidden;
    }

    .dashboard-progress-bar {
        font-size: 0.76rem !important;
        line-height: 24px;
        white-space: nowrap;
    }

    /* Evite les textes tronqués "x jours ..." */
    .dashboard-card-body .d-flex.justify-content-between.small {
        gap: 0.4rem;
        flex-wrap: wrap;
        line-height: 1.2;
    }

    /* ---------- Section Ma boutique ---------- */
    .dashboard-card .rounded-circle,
    .dashboard-card img.rounded-circle {
        width: 96px !important;
        height: 96px !important;
        object-fit: cover;
        margin-left: auto;
        margin-right: auto;
    }

    .dashboard-card h4.text-center {
        font-size: 1.2rem !important;
    }

    .dashboard-card .text-muted.text-center.small {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* ---------- Mes dernières annonces (dashboard home) ---------- */
    .dashboard-card .list-group-item,
    .dashboard-recent-items .dashboard-recent-item {
        display: grid !important;
        grid-template-columns: 72px 1fr auto;
        gap: 0.7rem !important;
        align-items: center !important;
        padding: 0.8rem 0 !important;
    }

    .dashboard-card .list-group-item > .rounded,
    .dashboard-card .list-group-item > img,
    .dashboard-recent-items .dashboard-recent-item > .rounded,
    .dashboard-recent-items .dashboard-recent-item > img {
        width: 72px !important;
        height: 72px !important;
        object-fit: cover;
    }

    .dashboard-card .list-group-item .flex-fill {
        min-width: 0;
    }

    .dashboard-card .list-group-item .flex-fill h6 {
        margin-bottom: 0.35rem;
        font-size: 1rem !important;
        line-height: 1.25;
        word-break: break-word;
    }

    .dashboard-card .list-group-item .flex-fill .d-flex.gap-2 {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.4rem !important;
    }

    .dashboard-card .list-group-item .text-orange.fw-bold {
        font-size: 1.05rem;
        line-height: 1;
        white-space: nowrap;
    }

    .dashboard-card .list-group-item .dashboard-badge {
        padding: 0.22rem 0.5rem !important;
        font-size: 0.74rem !important;
        white-space: nowrap;
    }

    .dashboard-card .list-group-item .btn {
        width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        align-self: center;
    }

    /* ---------- Abonnement: chiffres toujours visibles ---------- */
    .dashboard-progress-overlay {
        font-size: 0.75rem;
    }

    /* ---------- Profil ---------- */
    #dashboard-profile-page .dashboard-page-header {
        align-items: stretch !important;
    }

    #dashboard-profile-page .dashboard-page-header .dashboard-btn {
        width: 100%;
        justify-content: center;
    }

    #dashboard-profile-page .dashboard-card .rounded-circle {
        width: 110px !important;
        height: 110px !important;
    }

    #dashboard-profile-page .dashboard-card .d-flex.justify-content-center {
        flex-wrap: wrap;
    }

    #dashboard-profile-page .profile-info-table tbody tr {
        display: block;
        border-bottom: 1px solid var(--dashboard-border);
        padding: 0.45rem 0;
    }

    #dashboard-profile-page .profile-info-table tbody tr:last-child {
        border-bottom: 0;
    }

    #dashboard-profile-page .profile-info-table td {
        display: block;
        width: 100% !important;
        padding: 0.18rem 0 !important;
        white-space: normal;
        word-break: break-word;
    }

    #dashboard-profile-page .profile-info-table td.fw-bold {
        font-size: 0.82rem;
        color: var(--dashboard-dark-blue);
        opacity: 0.9;
    }

    /* ---------- Notifications ---------- */
    .dashboard-alert {
        overflow-wrap: anywhere;
    }

    /* ---------- Abonnement: plans ---------- */
    .dashboard-card .card.h-100 {
        margin-bottom: 0.9rem;
    }

    .dashboard-card .card-body.text-center {
        padding: 1.1rem 0.95rem !important;
    }

    .dashboard-card .card-body .display-4 {
        font-size: 2rem !important;
        line-height: 1.1;
        word-break: break-word;
    }

    .dashboard-card .card-body ul.list-unstyled.text-start {
        margin-bottom: 1rem !important;
    }

    .dashboard-card .card-body ul.list-unstyled.text-start li {
        display: flex;
        align-items: flex-start;
        gap: 0.35rem;
        line-height: 1.35;
    }

    /* Badge RECOMMANDÉ centré et lisible */
    .dashboard-card .card-body.text-center.position-relative .badge.bg-orange.position-absolute {
        position: static !important;
        display: inline-flex;
        margin: 0 auto 0.65rem;
        transform: none !important;
        white-space: nowrap;
    }

    /* Alerte "Bon à savoir" */
    .alert.alert-info {
        padding: 0.75rem 0.85rem;
        font-size: 0.92rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    /* ---------- Tableau paiements ---------- */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-table {
        min-width: 720px;
        font-size: 0.82rem;
    }

    .dashboard-table th,
    .dashboard-table td {
        white-space: nowrap;
        vertical-align: middle;
    }

    .dashboard-table td {
        padding-top: 0.7rem !important;
        padding-bottom: 0.7rem !important;
    }

    .dashboard-table .dashboard-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
        white-space: nowrap !important;
        word-break: normal;
        padding: 0.26rem 0.55rem !important;
        font-size: 0.74rem !important;
    }

    /* ---------- Page produits (cards mobiles dédiées) ---------- */
    .products-controls {
        padding: 0.75rem !important;
    }

    #mobileProductsList .product-card-mobile {
        padding: 0.85rem;
    }

    #mobileProductsList .product-card-mobile > .d-flex.gap-3 {
        gap: 0.75rem !important;
    }

    #mobileProductsList .product-mobile-img {
        width: 84px;
        height: 84px;
    }

    #mobileProductsList .product-mobile-title {
        font-size: 1rem;
        line-height: 1.25;
        padding-right: 0.25rem;
    }

    #mobileProductsList .product-mobile-title a {
        color: inherit;
        text-decoration: none;
    }

    #mobileProductsList .product-mobile-price {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 0.35rem;
    }

    #mobileProductsList .price-current {
        font-size: 1.05rem;
        line-height: 1.1;
    }

    #mobileProductsList .price-old {
        margin-left: 0;
    }

    #mobileProductsList .dropdown .btn.btn-sm {
        min-width: 36px;
        min-height: 36px;
        padding: 0.25rem;
    }

    /* ---------- Garde-fous overflow ---------- */
    .dashboard-card,
    .dashboard-card-header,
    .dashboard-card-body,
    .dashboard-page-header {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* Petit mobile */
@media (max-width: 576px) {
    .dashboard-main-content {
        padding: 0.75rem !important;
    }

    .dashboard-page-header {
        padding: 0.75rem !important;
    }

    .dashboard-header-left h1,
    .dashboard-header-left h2 {
        font-size: 1.08rem !important;
    }

    .dashboard-card-header {
        padding: 0.75rem !important;
    }

    .dashboard-card-title {
        font-size: 1rem;
    }

    .dashboard-card-header .dashboard-btn,
    .dashboard-card-header .btn {
        min-height: 40px;
        font-size: 0.86rem;
        padding: 0.42rem 0.7rem !important;
    }

    .dashboard-stat-card {
        padding: 0.85rem !important;
    }

    .stat-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.1rem !important;
    }

    .stat-value {
        font-size: 1.45rem !important;
    }

    .dashboard-card .list-group-item,
    .dashboard-recent-items .dashboard-recent-item {
        grid-template-columns: 64px 1fr auto;
        gap: 0.6rem !important;
    }

    .dashboard-card .list-group-item > .rounded,
    .dashboard-card .list-group-item > img,
    .dashboard-recent-items .dashboard-recent-item > .rounded,
    .dashboard-recent-items .dashboard-recent-item > img {
        width: 64px !important;
        height: 64px !important;
    }

    .dashboard-card .list-group-item .text-orange.fw-bold {
        font-size: 1rem;
    }

    .dashboard-card .rounded-circle,
    .dashboard-card img.rounded-circle {
        width: 86px !important;
        height: 86px !important;
    }

    #dashboard-profile-page .dashboard-card .rounded-circle {
        width: 96px !important;
        height: 96px !important;
    }

    .dashboard-table {
        min-width: 680px;
        font-size: 0.78rem;
    }

    #mobileProductsList .product-mobile-img {
        width: 76px;
        height: 76px;
    }

    #mobileProductsList .product-mobile-title {
        font-size: 0.95rem;
    }
}
