/* 
 * Ma Gestion - Modern Dashboard CSS
 */

:root {
    
    
    --mg-bg: var(--mg-surface);
    --mg-card-bg: #ffffff;
    --mg-text: #1e293b;
    --mg-text-muted: #64748b;
    --mg-border: #e2e8f0;
    --mg-sidebar-bg: #1e293b;
    --mg-sidebar-text: #94a3b8;
    --mg-sidebar-hover: #334155;
    --mg-sidebar-active: #4f46e5;
    --mg-radius: 12px;
    --mg-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.mg-dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--mg-bg);
    color: var(--mg-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: -20px -20px 0 -20px; /* Offset WP page padding if any */
}

/* Sidebar */
.mg-sidebar {
    width: 260px;
    background: var(--mg-sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
}

.mg-sidebar-logo {
    padding: 30px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.mg-sidebar-logo .dashicons {
    font-size: 24px;
    color: var(--mg-primary-light);
}

.mg-sidebar-nav {
    flex: 1;
    padding: 0 16px;
}

.mg-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--mg-sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.mg-nav-item:hover {
    background: var(--mg-sidebar-hover);
    color: #fff;
}

.mg-nav-item.active {
    background: var(--mg-sidebar-active);
    color: #fff;
}

.mg-nav-item .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.mg-sidebar-footer {
    padding: 24px 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.mg-logout {
    color: var(--mg-accent);
}

.mg-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--mg-accent);
}

/* Main */
.mg-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mg-topbar {
    height: 70px;
    background: #fff;
    border-bottom: 1px solid var(--mg-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mg-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mg-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--mg-text);
}

.mg-page-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.mg-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mg-user-info {
    text-align: right;
}

.mg-user-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.mg-user-role {
    font-size: 12px;
    color: var(--mg-text-muted);
}

.mg-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--mg-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.mg-content-wrapper {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Stats Cards */
.mg-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.mg-stat-card {
    background: #fff;
    padding: 24px;
    border-radius: var(--mg-radius);
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--mg-shadow);
    border: 1px solid var(--mg-border);
}

.mg-stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mg-stat-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.mg-stat-data {
    display: flex;
    flex-direction: column;
}

.mg-stat-value {
    font-size: 24px;
    font-weight: 700;
}

.mg-stat-label {
    font-size: 13px;
    color: var(--mg-text-muted);
}

/* Table Card */
.mg-section-card {
    background: #fff;
    border-radius: var(--mg-radius);
    box-shadow: var(--mg-shadow);
    border: 1px solid var(--mg-border);
    margin-bottom: 24px;
}

.mg-section-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--mg-border);
}

.mg-section-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.mg-table-container {
    overflow-x: auto;
}

.mg-table-modern {
    width: 100%;
    border-collapse: collapse;
}

.mg-table-modern th {
    padding: 16px 24px;
    background: var(--mg-surface);
    text-align: left;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--mg-text-muted);
    font-weight: 600;
    letter-spacing: 0.025em;
}

.mg-table-modern td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--mg-border);
    font-size: 14px;
}

.mg-badge-modern {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: color-mix(in srgb, var(--badge-color), transparent 85%);
    color: var(--badge-color);
}

.mg-action-btn {
    display: inline-flex;
    padding: 6px;
    color: var(--mg-text-muted);
    border-radius: 6px;
    transition: all 0.2s;
}

.mg-action-btn:hover {
    background: #f1f5f9;
    color: var(--mg-primary);
}

/* Forms */
.mg-form-modern {
    padding: 24px;
}

.mg-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.mg-input-group.full-width {
    grid-column: span 2;
}

.mg-input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--mg-text);
}

.mg-input-group input, 
.mg-input-group textarea, 
.mg-input-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--mg-border);
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    transition: all 0.2s;
}

.mg-input-group input:focus {
    border-color: var(--mg-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.mg-btn-modern {
    background: var(--mg-primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.mg-btn-modern:hover {
    background: var(--mg-primary-light);
    transform: translateY(-1px);
}

/* Media Grid */
.mg-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 24px;
}

.mg-media-item {
    background: #fff;
    border: 1px solid var(--mg-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s;
}

.mg-media-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--mg-shadow);
}

.mg-media-thumb {
    height: 140px;
    background-size: cover;
    background-position: center;
    background-color: #f1f5f9;
}

.mg-media-thumb.file {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mg-media-thumb.file .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: var(--mg-text-muted);
}

.mg-media-info {
    padding: 12px;
}

.mg-media-info strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mg-media-info small {
    display: block;
    font-size: 11px;
    color: var(--mg-text-muted);
    margin-bottom: 8px;
}

.mg-btn-download {
    display: block;
    text-align: center;
    font-size: 12px;
    padding: 6px;
    background: #f1f5f9;
    border-radius: 6px;
    text-decoration: none;
    color: var(--mg-text);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 991px) {
    .mg-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    
    .mg-sidebar.active {
        transform: translateX(0);
    }
    
    .mg-sidebar-toggle {
        display: block;
    }
    
    .mg-content-wrapper {
        padding: 20px;
    }
}

@media (max-width: 640px) {
    .mg-form-grid {
        grid-template-columns: 1fr;
    }
    .mg-input-group.full-width {
        grid-column: span 1;
    }
}
/* Loading Feedback */
@keyframes mg-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mg-spin {
    display: inline-block;
    animation: mg-spin 1s linear infinite;
    line-height: 1;
}

.mg-btn-modern:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.mg-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.mg-loader-container {
    padding: 40px;
    text-align: center;
    width: 100%;
}

.mg-loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--mg-border);
    border-top-color: var(--mg-primary);
    border-radius: 50%;
    display: inline-block;
    animation: mg-spin 1s linear infinite;
}

.mg-saving {
    opacity: 0.7;
    pointer-events: none;
    cursor: wait !important;
    position: relative;
}
.mg-saving::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mg-spin 0.7s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

/* ─── Payment Button ───────────────────────────── */
.mg-pay-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.mg-pay-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.mg-pay-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.mg-pay-btn:active {
    transform: translateY(0);
}

.mg-facture-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* ─── Amount styling ───────────────────────────── */
.mg-amount-due {
    color: var(--mg-accent);
}

.mg-amount-paid {
    color: #10b981;
    font-weight: 600;
    font-size: 13px;
}

/* ─── Payment Modal ────────────────────────────── */
.mg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: mg-fadeIn 0.25s ease;
}

@keyframes mg-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mg-slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.mg-modal-card {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: mg-slideUp 0.3s ease;
    overflow: hidden;
}

.mg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--mg-border);
    background: var(--mg-surface);
}

.mg-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--mg-text);
}

.mg-modal-header h3 .dashicons {
    color: #10b981;
}

.mg-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--mg-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
    line-height: 1;
}

.mg-modal-close:hover {
    background: #fee2e2;
    color: var(--mg-accent);
}

.mg-modal-body {
    padding: 24px;
}

.mg-payment-summary {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.mg-payment-summary p {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: var(--mg-text-muted);
}

.mg-payment-summary p:last-child {
    margin-bottom: 0;
}

.mg-payment-summary strong {
    color: var(--mg-text);
}

.mg-payment-summary .mg-amount-due {
    font-size: 20px;
}

.mg-gateway-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--mg-text);
    margin: 0 0 12px 0;
}

.mg-gateway-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mg-gateway-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: #fff;
    border: 2px solid var(--mg-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 15px;
    font-weight: 600;
    color: var(--mg-text);
    text-align: left;
    width: 100%;
}

.mg-gateway-option:hover {
    border-color: var(--mg-primary);
    background: rgba(79, 70, 229, 0.04);
    transform: translateX(4px);
}

.mg-gateway-option:active {
    transform: translateX(2px);
}

.mg-gw-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.mg-gw-title {
    flex: 1;
}

.mg-gateway-option .dashicons {
    color: var(--mg-text-muted);
    transition: color 0.2s;
}

.mg-gateway-option:hover .dashicons {
    color: var(--mg-primary);
}

/* Processing State */
.mg-payment-processing {
    text-align: center;
    padding: 32px 0;
}

.mg-payment-processing .mg-loader {
    margin: 0 auto 16px;
}

.mg-payment-processing p {
    color: var(--mg-text-muted);
    font-size: 14px;
    margin: 0;
}

/* Error State */
.mg-payment-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--mg-accent);
    padding: 12px 16px;
    border-radius: 10px;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
}

/* Toast Notification */
.mg-front-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 14px 24px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    z-index: 99999;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    animation: mg-slideUp 0.3s ease, mg-fadeOut 0.3s ease 3s forwards;
}

@keyframes mg-fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.mg-front-toast.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.mg-front-toast.error {
    background: linear-gradient(135deg, var(--mg-accent), var(--mg-accent));
}

.mg-front-toast.info {
    background: linear-gradient(135deg, var(--mg-primary), var(--mg-primary));
}

/* ═══════════════════════════════════════════════════════════════
   SHOP — Product Grid, Cart Sidebar, Checkout
   ═══════════════════════════════════════════════════════════════ */

/* ── Shop wrapper ── */
.mg-shop-wrapper {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 15px;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Shop Header ── */
.mg-shop-header {
    margin-bottom: 28px;
}

.mg-shop-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.mg-shop-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--mg-text, #1e293b);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.mg-shop-title .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: var(--mg-primary, #6366f1);
}

/* ── Cart toggle button ── */
.mg-cart-toggle {
    position: relative;
    background: var(--mg-primary, #6366f1);
    color: #fff;
    border: none;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.mg-cart-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.mg-cart-toggle .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.mg-cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--mg-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mg-cart-count.has-items {
    opacity: 1;
    transform: scale(1);
}

/* ── Filter Buttons ── */
.mg-shop-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mg-filter-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mg-filter-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.mg-filter-btn.active {
    background: var(--mg-primary, #6366f1);
    color: #fff;
    border-color: var(--mg-primary, #6366f1);
}

/* ── Products Grid ── */
.mg-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* ── Product Card ── */
.mg-product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e8edf2;
    display: flex;
    flex-direction: column;
}

.mg-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ── Product Image ── */
.mg-product-image-link {
    position: relative;
    display: block;
    text-decoration: none;
    height: 200px;
    overflow: hidden;
    background: var(--mg-surface);
}

.mg-product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    transition: transform 0.4s ease;
}

.mg-product-card:hover .mg-product-img {
    transform: scale(1.05);
}

.mg-product-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.mg-product-placeholder .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #cbd5e1;
}

/* ── Badges ── */
.mg-product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 1;
}

.mg-badge-digital {
    background: var(--mg-primary);
    color: #fff;
}

.mg-badge-reservation {
    background: var(--mg-primary);
    color: #fff;
}

.mg-badge-oos {
    background: var(--mg-accent);
    color: #fff;
}

/* ── Product Info ── */
.mg-product-info {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.mg-product-name,
.mg-shop-wrapper .mg-product-card .mg-product-name,
.mg-shop-wrapper h3.mg-product-name {
    font-size: 14px !important;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    line-height: 1.35 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}
.mg-product-name a {
    text-decoration: none;
    color: inherit;
    font-size: inherit !important;
}
.mg-product-name a:hover {
    color: var(--mg-primary);
}

.mg-product-category {
    font-size: 12px;
    color: var(--mg-secondary);
    margin: 0 0 8px 0;
    line-height: 1.4;
}

/* ── Star Rating ── */
.mg-product-rating {
    display: flex;
    gap: 1px;
    margin-bottom: 8px;
}
.mg-star {
    color: #d1d5db;
    font-size: 14px;
    line-height: 1;
}
.mg-star.filled {
    color: #f59e0b;
}

/* ── Stock Status ── */
.mg-product-stock {
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 6px 0;
}
.mg-in-stock {
    color: #16a34a;
}
.mg-out-of-stock {
    color: var(--mg-accent);
}

/* ── Price ── */
.mg-product-price {
    font-size: 17px;
    font-weight: 800;
    color: var(--mg-accent);
    margin: 0 0 12px 0;
}

/* ── Add to Cart button (full-width, blue) ── */
.mg-add-to-cart-btn {
    background: var(--mg-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    white-space: nowrap;
    transition: background 0.25s ease, transform 0.15s ease;
    margin-top: auto; /* Push to bottom of card */
}

.mg-add-to-cart-btn:hover {
    background: var(--mg-primary);
    transform: translateY(-1px);
}

.mg-add-to-cart-btn:disabled {
    background: var(--mg-secondary);
    cursor: not-allowed;
    transform: none;
}

.mg-add-to-cart-btn.mg-added {
    background: #16a34a;
}

.mg-add-to-cart-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ── Shop Empty State ── */
.mg-shop-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    color: #94a3b8;
}

.mg-shop-empty .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════
   CART SIDEBAR
   ═══════════════════════════════════════════════════ */

.mg-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    z-index: 99990;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mg-cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mg-cart-sidebar {
    position: fixed;
    top: 0;
    right: -380px;
    width: 370px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 99991;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mg-cart-overlay.open .mg-cart-sidebar {
    right: 0;
}

.mg-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.mg-cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mg-cart-header h3 .dashicons {
    color: var(--mg-primary, #6366f1);
}

.mg-cart-close {
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mg-cart-close:hover {
    background: #fee2e2;
    color: var(--mg-accent);
}

/* ── Cart Items ── */
.mg-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.mg-cart-empty {
    text-align: center;
    padding: 40px 0;
    color: #94a3b8;
}

.mg-cart-empty .dashicons {
    font-size: 40px;
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.mg-cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    animation: mg-slideIn 0.3s ease;
}

@keyframes mg-slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.mg-cart-item-img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.mg-cart-item-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mg-cart-item-placeholder .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #94a3b8;
}

.mg-cart-item-info {
    flex: 1;
    min-width: 0;
}

.mg-cart-item-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mg-cart-item-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--mg-primary, #6366f1);
}

.mg-cart-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mg-cart-qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
    padding: 0;
}

.mg-cart-qty-btn:hover {
    background: var(--mg-primary, #6366f1);
    color: #fff;
    border-color: var(--mg-primary, #6366f1);
}

.mg-cart-qty {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    min-width: 20px;
    text-align: center;
}

.mg-cart-remove {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
    margin-left: 4px;
    transition: color 0.2s ease;
}

.mg-cart-remove:hover {
    color: var(--mg-accent);
}

.mg-cart-remove .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ── Cart Footer ── */
.mg-cart-footer {
    padding: 16px 20px;
    border-top: 2px solid #f1f5f9;
    background: #fafbfc;
}

.mg-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 16px;
    color: #334155;
}

.mg-cart-total strong {
    font-size: 20px;
    font-weight: 800;
    color: var(--mg-primary, #6366f1);
}

.mg-checkout-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--mg-primary, #6366f1), #818cf8);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.mg-checkout-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* ═══════════════════════════════════════════════════
   CHECKOUT MODAL
   ═══════════════════════════════════════════════════ */

.mg-checkout-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 13px;
}

.mg-checkout-table th {
    background: var(--mg-surface);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.mg-checkout-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.mg-checkout-table tfoot td {
    border-bottom: none;
    border-top: 2px solid #e2e8f0;
    padding-top: 12px;
}

.mg-checkout-table tfoot strong {
    color: var(--mg-primary, #6366f1);
    font-size: 15px;
}

.mg-checkout-section {
    margin-bottom: 20px;
}

.mg-checkout-section h4 {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.mg-checkout-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f0fdf4;
    border-radius: 10px;
    color: #166534;
    font-size: 14px;
    margin: 0;
}

.mg-checkout-user .dashicons {
    color: #22c55e;
}

.mg-checkout-submit {
    background: linear-gradient(135deg, var(--mg-primary, #6366f1), #818cf8) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 14px 24px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.mg-checkout-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.mg-checkout-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ── Success modal icon ── */
.mg-success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mg-scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mg-scaleIn {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

.mg-success-icon .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: #fff;
}

/* ─── Shop Filters ─────────────────────────────── */
.mg-shop-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.mg-filter-btn {
    padding: 8px 18px;
    border: 1px solid var(--mg-border);
    border-radius: 20px;
    background: #fff;
    color: var(--mg-text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mg-filter-btn:hover {
    border-color: var(--mg-primary, #6366f1);
    color: var(--mg-primary, #6366f1);
    background: #f0f0ff;
}

.mg-filter-btn.active {
    background: var(--mg-primary, #6366f1);
    color: #fff;
    border-color: var(--mg-primary, #6366f1);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ─── Reservation Badge ────────────────────────── */
.mg-reservation-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.mg-reservation-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* ─── Payment Error ────────────────────────────── */
.mg-payment-error {
    background: #fef2f2;
    color: var(--mg-accent);
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
}

/* ─── Gateway Selection (Checkout) ─────────────── */
.mg-gateway-section {
    margin-top: 20px;
}

.mg-gateway-section label.mg-section-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--mg-text);
    margin-bottom: 10px;
    display: block;
}

.mg-gateway-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mg-gateway-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--mg-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.mg-gateway-option:hover {
    border-color: var(--mg-primary, #6366f1);
    background: #fafaff;
}

.mg-gateway-option input[type="radio"] {
    accent-color: var(--mg-primary, #6366f1);
    width: 16px;
    height: 16px;
}

.mg-gateway-option input[type="radio"]:checked ~ span {
    color: var(--mg-primary, #6366f1);
    font-weight: 600;
}

.mg-gateway-option span {
    font-size: 14px;
    color: var(--mg-text);
}

/* ─── Spinner (inline loading) ─────────────────── */
.mg-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mg-spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes mg-spin {
    to { transform: rotate(360deg); }
}

/* ─── Booking Modal Adjustments ────────────────── */
#mg-booking-modal .mg-modal-header h3 .dashicons {
    color: #f59e0b;
}

#mg-booking-modal .mg-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

#mg-booking-modal .mg-input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--mg-text);
    margin-bottom: 6px;
    display: block;
}

#mg-booking-modal .mg-input-group input[type="datetime-local"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--mg-border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--mg-text);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#mg-booking-modal .mg-input-group input[type="datetime-local"]:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

#mg-booking-modal .mg-btn-modern {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

#mg-booking-modal .mg-btn-modern:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — Shop
   ═══════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .mg-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }

    .mg-product-image-link {
        height: 150px;
    }

    .mg-shop-title {
        font-size: 20px;
    }

    .mg-filter-btn {
        padding: 6px 14px;
        font-size: 12px;
    }

    .mg-cart-sidebar {
        width: 100%;
        max-width: 100vw;
    }

    #mg-booking-modal .mg-form-grid {
        grid-template-columns: 1fr;
    }

    .mg-shop-filters {
        gap: 6px;
    }

    .mg-gateway-option {
        padding: 10px 12px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   MODERN PREMIUM CATALOG STYLE
   ═══════════════════════════════════════════════════════════════ */
.mg-products-grid[data-style="modern"] {
    gap: 24px;
}

.mg-products-grid[data-style="modern"] .mg-product-card {
    border: none;
    background: var(--mg-surface);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.mg-products-grid[data-style="modern"] .mg-product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.mg-products-grid[data-style="modern"] .mg-product-image-link {
    height: 240px;
    background: transparent;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.mg-products-grid[data-style="modern"] .mg-product-img {
    padding: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.mg-products-grid[data-style="modern"] .mg-product-card:hover .mg-product-img {
    transform: scale(1.1);
}

.mg-products-grid[data-style="modern"] .mg-product-info {
    padding: 20px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 10%, #fff 30%);
    position: relative;
    /* Glassmorphism over the image slightly */
    margin-top: -30px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
}

.mg-products-grid[data-style="modern"] .mg-product-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--mg-text);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.mg-products-grid[data-style="modern"] .mg-product-category {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--mg-primary);
    margin-bottom: 12px;
}

.mg-products-grid[data-style="modern"] .mg-product-price {
    font-size: 20px;
    font-weight: 900;
    color: var(--mg-accent);
    margin-bottom: 16px;
}

.mg-products-grid[data-style="modern"] .mg-add-to-cart-btn {
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--mg-primary), var(--mg-primary));
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mg-products-grid[data-style="modern"] .mg-add-to-cart-btn:hover {
    background: linear-gradient(135deg, var(--mg-accent), var(--mg-accent));
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.mg-products-grid[data-style="modern"] .mg-product-badge {
    top: 15px;
    left: 15px;
    border-radius: 8px;
    padding: 6px 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(4px);
    background: rgba(255,255,255,0.9);
    color: var(--mg-primary);
    border: 1px solid rgba(255,255,255,0.5);
}
.mg-products-grid[data-style="modern"] .mg-badge-oos {
    background: rgba(239,68,68,0.9);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   VITRINE MODE CSS (Slider & Search)
   ═══════════════════════════════════════════════════════════════ */

/* Slider */
.mg-vitrine-slider {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto 40px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    background: #000;
}

.mg-slider-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    height: 100%;
}

.mg-slide {
    flex: 0 0 100%;
    width: 100%;
    opacity: 0.5;
    transition: opacity 0.6s ease;
    position: relative;
    aspect-ratio: 1400 / 480;
}

@media (max-width: 768px) {
    .mg-slide {
        aspect-ratio: 600 / 400;
    }
}

.mg-slide.active {
    opacity: 1;
}

.mg-slide-link {
    display: block;
    width: 100%;
    height: 100%;
}

.mg-slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Arrows */
.mg-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: var(--mg-text);
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0;
}

.mg-vitrine-slider:hover .mg-slider-arrow {
    opacity: 1;
}

.mg-slider-prev {
    left: 20px;
}
.mg-slider-next {
    right: 20px;
}

.mg-slider-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

/* Dots */
.mg-slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.mg-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.mg-slider-dot.active {
    background: #fff;
    transform: scale(1.3);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Search Bar */
.mg-vitrine-search-section {
    max-width: 800px;
    margin: 0 auto 40px;
    position: relative;
    z-index: 20;
}

.mg-vitrine-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 30px;
    padding: 8px 24px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.mg-vitrine-search-wrap:focus-within {
    border-color: var(--mg-primary);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.mg-vitrine-search-icon {
    color: var(--mg-text-muted);
    margin-right: 12px;
}

.mg-vitrine-search-input {
    flex: 1;
    border: none;
    padding: 12px 0;
    font-size: 16px;
    background: transparent;
    color: var(--mg-text);
    outline: none;
}

.mg-vitrine-search-clear {
    background: none;
    border: none;
    color: var(--mg-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.mg-vitrine-search-clear:hover {
    background: #f1f5f9;
    color: var(--mg-accent);
}

/* Toolbar & Filters for vitrine */
.mg-vitrine-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

@media (max-width: 768px) {
    .mg-vitrine-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mg-shop-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }
}

