/* ============================================
   RESPONSIVE GLOBAL - Smile Dental Lab
   Mobile, Tablet, Desktop
   ============================================ */

/* ---- HEADER / TOPBAR ---- */

/* Tablet: hide text labels, show only icons */
@media (max-width: 991.98px) {
    .site-header-top {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 0;
    }

    .site-header-actions {
        gap: 10px !important;
    }

    .site-header-actions > a > span,
    .site-header-actions > .dropdown > a > span,
    .site-header-actions > .btn > span {
        display: none;
    }

    .site-header-actions > a,
    .site-header-actions > .dropdown > a,
    .site-header-actions .btn {
        font-size: 18px;
        padding: 6px 10px !important;
        gap: 0 !important;
    }

    .site-header-cart-badge {
        font-size: 10px;
        min-width: 16px;
        height: 16px;
        line-height: 16px;
    }

    /* Dropdown menus: full width on tablet */
    .site-header-actions .dropdown-menu {
        width: calc(100vw - 30px) !important;
        max-width: 360px !important;
        right: -10px !important;
    }

    /* Navbar brand logo smaller */
    .navbar-brand img {
        max-height: 36px !important;
    }
}

/* Mobile */
@media (max-width: 575.98px) {
    .site-header-actions {
        gap: 6px !important;
    }

    .site-header-actions > a,
    .site-header-actions > .dropdown > a {
        font-size: 16px;
        padding: 4px 8px !important;
    }

    .site-header-actions .btn {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }

    .site-header-search .form-control {
        font-size: 14px;
        padding: 8px 12px;
    }

    .navbar-brand img {
        max-height: 30px !important;
    }

    /* Mini cart dropdown */
    .site-header-actions .dropdown-menu {
        width: calc(100vw - 20px) !important;
        max-width: 100vw !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
    }
}

/* ---- MEGAMENU ---- */
@media (max-width: 991.98px) {
    .megamenu-bar__list {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0;
    }
    .megamenu-bar__list::-webkit-scrollbar { display: none; }

    .megamenu-bar__link {
        white-space: nowrap;
        font-size: 12px;
        padding: 10px 12px;
    }

    .megamenu-panel {
        position: fixed;
        left: 0;
        right: 0;
        width: 100vw;
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* ---- MI CUENTA ---- */
@media (max-width: 991.98px) {
    .list_menu {
        margin-bottom: 20px;
    }

    .list_menu h5 {
        font-size: 16px;
    }

    .list-menu_user {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .list-menu_user li a {
        display: inline-block;
        padding: 6px 14px;
        background: #f0f2f5;
        border-radius: 20px;
        font-size: 13px;
        text-decoration: none;
        color: #333;
        white-space: nowrap;
    }

    .list-menu_user li a:hover {
        background: #0b5aa6;
        color: #fff;
    }
}

@media (max-width: 575.98px) {
    .list-menu_user li a {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* ---- CHECKOUT ---- */
@media (max-width: 991.98px) {
    .checkout-main {
        grid-template-columns: 1fr !important;
    }

    .cart-summary {
        position: static !important;
    }

    .checkout-form {
        padding: 1.25rem !important;
    }

    .shipping-methods {
        flex-direction: column !important;
    }

    .shipping-card {
        min-width: 0 !important;
    }

    .payment-methods {
        flex-direction: column !important;
    }

    .payment-option {
        flex: none !important;
        width: 100% !important;
    }
}

@media (max-width: 575.98px) {
    .checkout-container {
        padding: 1rem 0 !important;
    }

    .checkout-header {
        padding: 1rem 0 !important;
        margin-bottom: 1rem !important;
        border-radius: 0 !important;
    }

    .checkout-title {
        font-size: 1.3rem !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .checkout-form {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        border-radius: 8px !important;
    }

    .section-title {
        font-size: 1rem !important;
    }

    .checkout-btn {
        font-size: 1rem !important;
        padding: 0.85rem !important;
    }

    .cart-summary {
        padding: 1rem !important;
    }

    .summary-row.total {
        font-size: 1.05rem !important;
    }

    .cart-item {
        grid-template-columns: 40px 1fr !important;
        padding: 0.75rem !important;
        gap: 0.75rem !important;
    }

    .cart-item-image {
        width: 40px !important;
        height: 40px !important;
        font-size: 1rem !important;
    }

    .mp-card-form{
        max-width: none !important;
        padding: 16px !important;
    }

    .mp-form-row{
        flex-direction: column !important;
        gap: 12px !important;
    }

    .coupon-input{
        flex-direction: column !important;
    }

    .coupon-input button{
        width: 100% !important;
    }
}

/* ---- TABLES (Admin + General) ---- */
@media (max-width: 767.98px) {
    .table-responsive-custom {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Make all tables in admin scrollable */
    .card-body > table,
    .container-fluid table.table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 13px;
    }

    .card-body > table th,
    .card-body > table td {
        white-space: nowrap;
        padding: 8px 10px !important;
    }

    .card-body > table .btn-sm {
        padding: 3px 6px;
        font-size: 11px;
    }
}

/* ---- ADMIN PEDIDOS TIENDA ---- */
@media (max-width: 991.98px) {
    .content-wrapper {
        padding: 10px;
    }

    .content-wrapper .row.mb-3 .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 10px;
    }

    .content-wrapper .card-body {
        padding: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper .row.mb-3 .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .content-wrapper .row.mb-3 .col-md-3 h3 {
        font-size: 1.3rem;
    }

    .content-wrapper .card-body {
        padding: 0.5rem;
        overflow-x: auto;
    }
}

/* ---- SURTIDOR PANEL ---- */
@media (max-width: 575.98px) {
    .topbar {
        padding: 10px 15px !important;
    }

    .topbar h1 {
        font-size: 16px !important;
    }

    .topbar .user-info {
        font-size: 12px !important;
        gap: 8px !important;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding: 12px !important;
    }

    .stat-card {
        padding: 12px !important;
    }

    .stat-card .number {
        font-size: 24px !important;
    }

    .stat-card .label {
        font-size: 11px !important;
    }

    .orders-container {
        padding: 0 12px 12px !important;
    }

    .order-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
        padding: 12px 15px !important;
    }

    .order-meta {
        flex-wrap: wrap !important;
        gap: 6px !important;
        font-size: 11px !important;
    }

    .order-body {
        padding: 12px 15px !important;
    }

    .order-actions {
        padding: 10px 15px !important;
    }

    .order-actions button {
        flex: 1;
        padding: 10px 12px !important;
        font-size: 13px !important;
    }

    .product-row {
        padding: 8px 0 !important;
    }

    .product-qty {
        width: 30px !important;
        height: 30px !important;
        font-size: 14px !important;
        margin-right: 10px !important;
    }

    .product-name {
        font-size: 13px !important;
    }

    .shipping-info {
        font-size: 12px !important;
    }
}

/* ---- PRODUCT DETAIL ---- */
@media (max-width: 767.98px) {
    .product-detail-container {
        flex-direction: column !important;
    }

    .product-gallery,
    .product-info {
        width: 100% !important;
        max-width: 100% !important;
    }

    .product-gallery img {
        max-height: 300px;
        object-fit: contain;
    }
}

/* ---- GENERAL UTILITIES ---- */
@media (max-width: 575.98px) {
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }

    .btn {
        font-size: 14px;
    }

    .form-control,
    .form-select {
        font-size: 14px;
        padding: 8px 10px;
    }

    /* Ensure images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* ---- FOOTER ---- */
@media (max-width: 767.98px) {
    footer .row > [class*="col-"] {
        margin-bottom: 20px;
    }
}

/* Fix horizontal overflow globally */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Smooth scrolling for all anchor links */
html {
    scroll-behavior: smooth;
}

/* Touch-friendly tap targets */
@media (max-width: 991.98px) {
    a, button, .btn, input, select, textarea {
        min-height: 38px;
    }

    .nav-link {
        padding: 10px 12px !important;
    }
}
