/**
 * MagicMedia Vendor Marketplace - Dashboard Styles
 */

/* Universal box-sizing reset for dashboard elements */
.mm-dashboard-wrapper *,
.mm-dashboard-wrapper *::before,
.mm-dashboard-wrapper *::after {
    box-sizing: border-box;
}

/* Dashboard-specific overrides */
.mm-dashboard-wrapper .mm-content {
    padding: 24px 32px;
    max-width: 100%;
    overflow-x: hidden;
}

/* Products list in dashboard */
.mm-products-list {
    display: grid;
    gap: 16px;
}

.mm-product-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--mm-bg-white);
    border-radius: var(--mm-radius);
    border: 1px solid var(--mm-border-light);
    transition: var(--mm-transition);
    box-sizing: border-box;
}

.mm-product-list-item:hover {
    box-shadow: var(--mm-shadow-md);
    border-color: var(--mm-border);
}

.mm-product-list-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--mm-radius-sm);
    overflow: hidden;
    background: var(--mm-bg);
    flex-shrink: 0;
}

.mm-product-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mm-product-list-thumb .mm-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mm-border);
}

.mm-product-list-info {
    flex: 1;
}

.mm-product-list-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--mm-text);
}

.mm-product-list-info p {
    font-size: 13px;
    color: var(--mm-text-muted);
}

.mm-product-list-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.mm-product-list-actions .mm-btn {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
}

/* Withdrawal list */
.mm-withdrawal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--mm-bg-white);
    border-radius: var(--mm-radius);
    border: 1px solid var(--mm-border-light);
    margin-bottom: 8px;
}

.mm-withdrawal-info {
    display: flex;
    flex-direction: column;
}

.mm-withdrawal-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--mm-primary);
}

.mm-withdrawal-date {
    font-size: 12px;
    color: var(--mm-text-muted);
}

.mm-withdrawal-wallet {
    font-size: 12px;
    color: var(--mm-text-light);
    font-family: monospace;
}

/* Commission list */
.mm-commission-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--mm-border-light);
}

.mm-commission-item:last-child {
    border-bottom: none;
}

.mm-commission-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mm-commission-level {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
}

.mm-commission-level-l1 { background: var(--mm-primary); }
.mm-commission-level-l2 { background: var(--mm-success); }
.mm-commission-level-l3 { background: var(--mm-warning); }

.mm-commission-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--mm-success);
}

/* Admin withdrawal action buttons */
.mm-admin-actions {
    display: flex;
    gap: 8px;
}

.mm-admin-actions .mm-btn {
    padding: 6px 14px;
    font-size: 12px;
}

/* Admin wallet display */
.mm-admin-wallet-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--mm-primary-bg);
    border-radius: var(--mm-radius);
    margin-bottom: 12px;
}

.mm-admin-wallet-box code {
    font-size: 14px;
    color: var(--mm-primary-dark);
    word-break: break-all;
    flex: 1;
}

/* Featured image preview */
.mm-featured-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--mm-radius-sm);
    object-fit: cover;
}

/* Gallery preview thumbnails */
.mm-gallery-thumb {
    position: relative;
    width: 80px;
    height: 80px;
}

.mm-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--mm-radius-sm);
}

.mm-gallery-thumb-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--mm-danger);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Plans in dashboard */
.mm-plans-dashboard {
    max-width: 900px;
    margin: 0 auto;
}

/* Wallet button styling */
.mm-btn-wallet {
    background: linear-gradient(135deg, #0d652d, #34a853) !important;
    color: white !important;
    border: none !important;
    margin-top: 8px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100%;
}

.mm-btn-wallet:hover {
    background: linear-gradient(135deg, #0d652d, #2e7d32) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(13, 101, 45, 0.3);
}

.mm-btn-wallet .dashicons {
    color: white;
}

/* Plan actions container */
.mm-plan-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    flex-shrink: 0;
}

/* Limit actions */
.mm-limit-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Load more */
.mm-load-more {
    text-align: center;
    padding: 32px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mm-product-list-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
        gap: 12px;
    }

    .mm-product-list-thumb {
        width: 100%;
        height: 120px;
        border-radius: 8px;
    }

    .mm-product-list-info {
        width: 100%;
    }

    .mm-product-list-info h4 {
        font-size: 14px;
    }

    .mm-product-list-actions {
        width: 100%;
        margin-top: 4px;
        gap: 6px;
    }

    .mm-product-list-actions .mm-btn {
        flex: 1;
        justify-content: center;
        font-size: 12px;
        padding: 8px 10px;
    }

    .mm-withdrawal-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }

    .mm-commission-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 12px;
    }

    /* Dashboard-specific overrides for mobile */
    .mm-dashboard-wrapper .mm-content {
        padding: 12px;
    }

    /* Make form cards stack properly */
    .mm-form-card {
        padding: 16px;
    }

    /* Current plan card */
    .mm-current-plan-card {
        padding: 20px;
    }

    .mm-current-plan-price {
        font-size: 28px;
    }

    /* Referral link box */
    .mm-referral-link-box {
        flex-direction: column;
    }

    .mm-referral-link-box .mm-btn {
        width: 100%;
        justify-content: center;
    }

    /* Wallet display */
    .mm-wallet-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Admin actions */
    .mm-admin-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .mm-admin-actions .mm-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

    /* Enquiry payment card */
    .mm-enquiry-payment-card .mm-payment-wallet-box {
        flex-direction: column;
        align-items: center;
    }

    .mm-enquiry-payment-card .mm-payment-wallet-info {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mm-product-list-item {
        padding: 10px;
    }

    .mm-product-list-thumb {
        height: 100px;
    }

    .mm-product-list-info h4 {
        font-size: 13px;
    }

    .mm-product-list-actions .mm-btn {
        font-size: 11px;
        padding: 6px 8px;
    }

    .mm-dashboard-wrapper .mm-content {
        padding: 8px;
    }

    .mm-form-card {
        padding: 12px;
    }

    .mm-current-plan-card {
        padding: 16px;
    }

    .mm-current-plan-price {
        font-size: 24px;
    }

    /* Extra mobile fixes for 480px */
    .mm-limit-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .mm-limit-actions .mm-btn {
        width: 100%;
        justify-content: center;
    }

    .mm-plan-actions {
        gap: 6px;
    }

    .mm-plan-actions .mm-btn-plan {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* ============================================
   Vendor Dashboard — Comprehensive Mobile Fixes
   ============================================ */

/* Fix for Elementor/shortcode embedded dashboard */
@media (max-width: 768px) {
    /* Prevent horizontal overflow from parent theme */
    .mm-dashboard-wrapper {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        position: relative;
    }

    /* Ensure main content doesn't overflow */
    .mm-dashboard-wrapper .mm-main {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        min-width: 0 !important;
    }

    /* Fix content area */
    .mm-dashboard-wrapper .mm-content {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        padding: 12px !important;
    }

    /* Fix all sections to prevent overflow */
    .mm-section {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Fix form rows */
    .mm-form-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }

    /* Fix stats grid */
    .mm-stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .mm-stat-card {
        padding: 12px !important;
        min-width: 0 !important;
    }

    .mm-stat-value {
        font-size: 18px !important;
    }

    .mm-stat-icon {
        width: 40px !important;
        height: 40px !important;
        border-radius: 10px !important;
    }

    .mm-stat-icon .dashicons {
        width: 20px !important;
        height: 20px !important;
        font-size: 20px !important;
    }

    /* Fix topbar */
    .mm-topbar {
        padding: 10px 12px !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 50 !important;
    }

    .mm-topbar-left {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .mm-page-title {
        font-size: 16px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .mm-topbar-right {
        flex-shrink: 0 !important;
    }

    .mm-topbar-balance {
        display: none !important;
    }

    .mm-topbar-user .mm-user-name {
        display: none !important;
    }

    /* Fix sidebar */
    .mm-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 1000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: none !important;
        width: 280px !important;
        min-width: 280px !important;
    }

    .mm-sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15) !important;
    }

    .mm-sidebar-overlay {
        display: none !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 999 !important;
        transition: opacity 0.3s ease !important;
    }

    .mm-sidebar-overlay.active {
        display: block !important;
    }

    /* Show mobile menu button */
    .mm-mobile-menu {
        display: block !important;
    }

    /* Fix cards */
    .mm-card {
        margin-bottom: 16px !important;
    }

    .mm-card-header {
        padding: 12px 16px !important;
    }

    .mm-card-body {
        padding: 12px 16px !important;
    }

    /* Fix form cards */
    .mm-form-card {
        padding: 16px !important;
        margin-bottom: 16px !important;
    }

    /* Fix section headers */
    .mm-section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
        padding-bottom: 12px !important;
    }

    /* Fix subscription plans (scoped to dashboard only) */
    .mm-plans-dashboard {
        max-width: 100% !important;
    }

    .mm-plans-dashboard .mm-plan-card {
        padding: 16px !important;
    }

    .mm-plans-dashboard .mm-plan-amount {
        font-size: 36px !important;
    }

    /* Fix plan actions */
    .mm-plan-actions {
        flex-direction: row !important;
        gap: 6px !important;
    }

    .mm-plan-actions .mm-btn-plan {
        flex: 1 !important;
        font-size: 12px !important;
        padding: 8px 10px !important;
    }

    /* Fix current plan card */
    .mm-current-plan-card {
        padding: 16px !important;
    }

    .mm-current-plan-price {
        font-size: 28px !important;
    }

    /* Fix products grid */
    .mm-products-grid {
        grid-template-columns: 1fr !important;
    }

    /* Fix referral link box */
    .mm-referral-link-box {
        flex-direction: column !important;
    }

    .mm-referral-link-box .mm-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Fix wallet display */
    .mm-wallet-display {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }

    /* Fix payment wallet box */
    .mm-payment-wallet-box {
        flex-direction: column !important;
        align-items: center !important;
    }

    .mm-payment-wallet-info {
        width: 100% !important;
    }

    /* Fix coupon input group */
    .mm-coupon-input-group {
        flex-direction: column !important;
    }

    .mm-coupon-input-group .mm-btn {
        width: 100% !important;
    }

    /* Fix wallet copy box */
    .mm-wallet-copy-box {
        flex-direction: column !important;
    }

    .mm-wallet-copy-box input {
        font-size: 10px !important;
    }

    /* Fix tables */
    .mm-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .mm-table-wrapper table {
        min-width: 500px !important;
    }

    /* Fix modals */
    .mm-modal-content {
        max-width: 95% !important;
        margin: 0 auto !important;
    }

    /* Fix enquiry section */
    .mm-enquiry-payment-card .mm-payment-wallet-box {
        flex-direction: column !important;
        align-items: center !important;
    }

    .mm-enquiry-payment-card .mm-payment-wallet-info {
        width: 100% !important;
    }

    /* Fix limit actions */
    .mm-limit-actions {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .mm-limit-actions .mm-btn {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* Extra small screens */
@media (max-width: 400px) {
    .mm-stats-grid {
        grid-template-columns: 1fr !important;
    }

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

    .mm-stat-value {
        font-size: 16px !important;
    }

    .mm-page-title {
        font-size: 14px !important;
    }

    .mm-plan-actions {
        flex-direction: column !important;
    }

    .mm-plan-actions .mm-btn-plan {
        font-size: 11px !important;
        padding: 6px 8px !important;
    }
}

/* Product Detail Modal — Mobile Enhancements */
@media (max-width: 768px) {
    .mm-modal-lg {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        max-height: 100vh !important;
        height: 100vh !important;
    }
    .mm-modal-lg .mm-modal-header {
        padding: 14px 16px !important;
        position: sticky !important;
        top: 0 !important;
        background: #fff !important;
        z-index: 10 !important;
        border-bottom: 1px solid #e8eaed !important;
    }
    .mm-modal-lg .mm-modal-header h3 {
        font-size: 16px !important;
    }
    .mm-modal-lg .mm-modal-body {
        padding: 16px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .mm-detail-container {
        gap: 16px !important;
    }
    .mm-detail-media {
        gap: 10px !important;
    }
    .mm-detail-main-image {
        max-height: 220px !important;
        border-radius: 10px !important;
    }
    .mm-detail-main-image img {
        max-height: 220px !important;
        border-radius: 10px !important;
    }
    .mm-detail-thumbs {
        gap: 6px !important;
        padding: 2px 0 !important;
    }
    .mm-detail-thumb {
        width: 48px !important;
        height: 48px !important;
        border-radius: 6px !important;
    }
    .mm-detail-info {
        gap: 10px !important;
    }
    .mm-detail-title {
        font-size: 18px !important;
        line-height: 1.3 !important;
    }
    .mm-detail-vendor {
        font-size: 13px !important;
        gap: 5px !important;
    }
    .mm-detail-vendor .dashicons {
        font-size: 14px !important;
        width: 14px !important;
        height: 14px !important;
    }
    .mm-detail-desc {
        font-size: 14px !important;
        line-height: 1.65 !important;
    }
    .mm-detail-tags {
        gap: 5px !important;
    }
    .mm-detail-tag {
        padding: 3px 8px !important;
        font-size: 11px !important;
    }
    .mm-detail-stats {
        gap: 12px !important;
        font-size: 12px !important;
    }
    .mm-detail-info .mm-btn-full {
        padding: 14px 16px !important;
        font-size: 15px !important;
        border-radius: 10px !important;
    }
    /* Product cards in dashboard marketplace */
    .mm-products-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    .mm-product-card {
        border-radius: 10px !important;
    }
    .mm-product-image {
        height: 130px !important;
    }
    .mm-product-body {
        padding: 10px !important;
    }
    .mm-product-name {
        font-size: 13px !important;
        margin-bottom: 4px !important;
        line-height: 1.3 !important;
    }
    .mm-product-desc {
        font-size: 11px !important;
        margin-bottom: 8px !important;
        line-height: 1.4 !important;
    }
    .mm-product-vendor {
        font-size: 11px !important;
        margin-bottom: 4px !important;
    }
    .mm-product-category {
        font-size: 10px !important;
        padding: 2px 6px !important;
        margin-bottom: 4px !important;
    }
}

@media (max-width: 480px) {
    .mm-modal-lg .mm-modal-header {
        padding: 12px 14px !important;
    }
    .mm-modal-lg .mm-modal-body {
        padding: 14px !important;
    }
    .mm-detail-main-image {
        max-height: 180px !important;
    }
    .mm-detail-main-image img {
        max-height: 180px !important;
    }
    .mm-detail-title {
        font-size: 16px !important;
    }
    .mm-detail-desc {
        font-size: 13px !important;
        line-height: 1.6 !important;
    }
    .mm-detail-thumb {
        width: 42px !important;
        height: 42px !important;
        border-radius: 5px !important;
    }
    .mm-detail-info .mm-btn-full {
        padding: 12px 14px !important;
        font-size: 14px !important;
    }
    .mm-detail-stats {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    /* Single column product cards on very small screens */
    .mm-products-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .mm-product-image {
        height: 200px !important;
    }
    .mm-product-body {
        padding: 14px !important;
    }
    .mm-product-name {
        font-size: 15px !important;
        margin-bottom: 6px !important;
    }
    .mm-product-desc {
        font-size: 13px !important;
        margin-bottom: 10px !important;
        line-height: 1.5 !important;
    }
    .mm-product-vendor {
        font-size: 12px !important;
        margin-bottom: 6px !important;
    }
}

/* Enquiry product list item in vendor dashboard */
.mm-product-list-enquiry { border-left: 3px solid #1a73e8; background: linear-gradient(90deg, rgba(26,115,232,0.03), transparent); }
.mm-product-list-enquiry .mm-product-list-thumb { background: linear-gradient(135deg, #e8f0fe, #f0f4ff) !important; }
.mm-product-list-enquiry .mm-product-list-info h4 { color: #0d47a1; }
.mm-product-list-enquiry .mm-thumb-placeholder svg { color: #1a73e8; }
