/* ================================================================
   CHECKOUT PAGE STYLES (Desktop & Mobile Responsive)
   Premium Gold & Ivory Luxury Aesthetic for Jewelers
   ================================================================ */

.mg-checkout-wrap {
    background: #faf8f5;
    min-height: 80vh;
}

/* Header Banner */
.customer-portal-header {
    background: linear-gradient(135deg, #1b2430 0%, #0f1722 100%) !important;
    padding: 24px 0 !important;
    border-bottom: 2px solid rgba(212, 175, 55, 0.4) !important;
}

.customer-portal-header h1 {
    color: #ffffff !important;
    font-size: 1.55rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.8px !important;
    margin-bottom: 6px !important;
}

.customer-portal-header .page-breadcrumb-links {
    font-size: 0.85rem;
    color: #c9b185;
}

.customer-portal-header .page-breadcrumb-links a {
    color: #f1dfb8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.customer-portal-header .page-breadcrumb-links a:hover {
    color: #ffffff;
}

.customer-portal-header .page-breadcrumb-links .sep {
    margin: 0 8px;
    opacity: 0.6;
}

.customer-portal-header .page-breadcrumb-links .current-page {
    color: #e5c378;
    font-weight: 600;
}

/* Avoid overlapping floating rate button on checkout */
.today_rate_block {
    z-index: 99 !important;
}

/* Address Selection Segmented Tabs */
.mg-checkout-tabs-container {
    margin-bottom: 24px;
}

.mg-checkout-tabs-bar {
    display: flex;
    gap: 12px;
    background: #f0ede6;
    padding: 6px;
    border-radius: 16px;
    border: 1px solid rgba(212, 175, 55, 0.25);
}

.mg-checkout-tab {
    flex: 1 1 0;
    margin: 0;
    padding: 14px 18px;
    border-radius: 12px;
    background: transparent;
    border: 1.5px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s ease;
    color: #475569;
    position: relative;
    user-select: none;
}

.mg-checkout-tab:hover {
    background: rgba(255, 255, 255, 0.6);
    color: #1e293b;
}

.mg-checkout-tab.active {
    background: #ffffff;
    border-color: rgba(212, 175, 55, 0.6);
    color: #1e293b;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.mg-checkout-tab .tab-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #64748b;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.mg-checkout-tab.active .tab-icon {
    background: linear-gradient(135deg, #d4af37 0%, #aa820a 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(170, 130, 10, 0.3);
}

.mg-checkout-tab .tab-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mg-checkout-tab .tab-text strong {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
}

.mg-checkout-tab .tab-text small {
    font-size: 0.76rem;
    color: #64748b;
    margin-top: 2px;
}

.mg-checkout-tab.active .tab-text small {
    color: #8c671a;
}

.mg-checkout-tab .tab-check {
    font-size: 1.15rem;
    color: #cbd5e1;
    transition: all 0.25s ease;
}

.mg-checkout-tab.active .tab-check {
    color: #16a34a;
}

/* Remove old crude green arrows */
a.address_tabs.active:before,
label.address_tabs.active:before {
    display: none !important;
    content: "" !important;
}

/* Checkout Form Card */
.mg-checkout-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.04);
    padding: 24px;
    margin-bottom: 24px;
}

.mg-checkout-card-header {
    border-bottom: 1px solid #f0ede6;
    padding-bottom: 14px;
    margin-bottom: 20px;
}

.mg-checkout-card-header h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
}

.mg-checkout-card-header p {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0;
}

/* Form Groups & Inputs */
.mg-checkout-card .form-group {
    margin-bottom: 18px;
}

.mg-input-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
    display: block;
}

.mg-input-label.required::after {
    content: " *";
    color: #dc2626;
    font-weight: 700;
}

.mg-checkout-card .form-control {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.92rem;
    color: #1e293b;
    background: #ffffff;
    height: auto;
    transition: all 0.2s ease;
}

.mg-checkout-card .form-control:focus {
    border-color: #d4af37;
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
    background: #ffffff;
}

.mg-checkout-card select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8802a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 38px;
    cursor: pointer;
}

.mg-checkout-card textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Right Column: Order Summary & Payment */
.mg-summary-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Order Summary Box */
.mg-summary-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.mg-summary-header {
    background: linear-gradient(135deg, #2b2118 0%, #17110c 100%);
    padding: 16px 20px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid rgba(212, 175, 55, 0.4);
}

.mg-summary-header h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f1dfb8;
    margin: 0;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.mg-summary-badge {
    background: rgba(212, 175, 55, 0.25);
    color: #f8e8c8;
    border: 1px solid rgba(212, 175, 55, 0.45);
    font-size: 0.74rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
}

.mg-summary-body {
    padding: 20px;
}

/* Products List in Summary */
.mg-summary-product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1ece4;
}

.mg-summary-product-item:last-child {
    border-bottom: none;
}

.mg-summary-p-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mg-summary-p-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    object-fit: contain;
    background: #faf8f5;
    padding: 2px;
    flex-shrink: 0;
}

.mg-summary-p-details {
    min-width: 0;
}

.mg-summary-p-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mg-summary-p-qty {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
}

.mg-summary-p-price {
    font-size: 0.92rem;
    font-weight: 700;
    color: #241c14;
    white-space: nowrap;
}

/* Cost Breakdown */
.mg-summary-breakdown {
    border-top: 1.5px dashed #e2e8f0;
    padding-top: 14px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mg-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.86rem;
    color: #64748b;
}

.mg-breakdown-row strong {
    color: #1e293b;
}

/* Total Box */
.mg-summary-total-box {
    background: linear-gradient(135deg, #fdfbf7 0%, #f6edd9 100%);
    border: 1.5px solid rgba(212, 175, 55, 0.4);
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mg-total-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #3d3024;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mg-total-amount {
    font-size: 1.35rem;
    font-weight: 800;
    color: #8c671a;
    letter-spacing: -0.5px;
}

/* Payment Methods Box */
.mg-payment-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.04);
    padding: 20px;
}

.mg-payment-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
}

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

.mg-gateway-option {
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s ease;
    background: #fafafa;
    position: relative;
    user-select: none;
}

.mg-gateway-option:hover {
    border-color: rgba(212, 175, 55, 0.5);
    background: #fdfbf7;
}

.mg-gateway-option.selected {
    border-color: #d4af37;
    background: linear-gradient(135deg, #fdfbf7 0%, #faf3e3 100%);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
}

.mg-gateway-option input[type="radio"] {
    accent-color: #d4af37;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.mg-gw-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mg-gw-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
}

.mg-gw-subtitle {
    font-size: 0.75rem;
    color: #64748b;
}

.mg-gw-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #16a34a;
    background: rgba(22, 163, 74, 0.1);
    padding: 3px 8px;
    border-radius: 8px;
}

/* Place Order Button */
.mg-btn-placeorder {
    background: linear-gradient(135deg, #d4af37 0%, #aa820a 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 1.05rem !important;
    letter-spacing: 0.6px !important;
    padding: 14px 24px !important;
    border-radius: 30px !important;
    border: none !important;
    box-shadow: 0 6px 20px rgba(168, 128, 42, 0.4) !important;
    width: 100% !important;
    text-transform: uppercase !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: all 0.25s ease !important;
    cursor: pointer !important;
    margin-top: 16px;
}

.mg-btn-placeorder:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(168, 128, 42, 0.5) !important;
    color: #ffffff !important;
}

/* Trust Badges Strip */
.mg-checkout-trust-strip {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
}

.mg-checkout-trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #555555;
    font-weight: 500;
}

.mg-checkout-trust-item i {
    color: #a8802a;
    font-size: 0.95rem;
}

/* ---------- Tablet & Mobile Responsiveness (< 992px) ---------- */
@media (max-width: 991.98px) {
    .mg-checkout-wrap {
        padding-top: 14px !important;
        padding-bottom: 95px !important; /* Space above mobile bottom nav */
        overflow-x: hidden !important;
    }

    .mg-checkout-tabs-bar {
        flex-direction: column;
        gap: 8px;
    }

    .mg-checkout-card {
        padding: 18px 14px;
        border-radius: 16px;
    }

    .mg-summary-card,
    .mg-payment-card {
        border-radius: 16px;
    }

    .mg-summary-body,
    .mg-payment-card {
        padding: 16px;
    }

    .mg-total-amount {
        font-size: 1.25rem;
    }

    .mg-btn-placeorder {
        padding: 13px 18px !important;
        font-size: 0.98rem !important;
    }
}

/* ---------- Phone View (< 768px) Specific Optimizations ---------- */
@media (max-width: 767.98px) {
    .mg-checkout-wrap {
        padding-top: 10px !important;
        padding-bottom: 95px !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .mg-checkout-wrap .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .mg-checkout-wrap .col-12 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .customer-portal-header {
        padding: 16px 0 !important;
    }

    .customer-portal-header h1 {
        font-size: 1.25rem !important;
    }

    .customer-portal-header .page-breadcrumb-links {
        font-size: 0.76rem !important;
    }

    /* Tabs on Phone */
    .mg-checkout-tabs-container {
        margin-bottom: 16px;
    }

    .mg-checkout-tabs-bar {
        padding: 4px;
        border-radius: 12px;
        gap: 6px;
    }

    .mg-checkout-tab {
        padding: 10px 12px;
        gap: 10px;
        border-radius: 10px;
    }

    .mg-checkout-tab .tab-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .mg-checkout-tab .tab-text strong {
        font-size: 0.85rem;
    }

    .mg-checkout-tab .tab-text small {
        font-size: 0.7rem;
    }

    /* Form Card on Phone */
    .mg-checkout-card {
        padding: 16px 12px;
        border-radius: 14px;
        margin-bottom: 16px;
    }

    .mg-checkout-card-header {
        padding-bottom: 10px;
        margin-bottom: 12px;
    }

    .mg-checkout-card-header h4 {
        font-size: 1rem;
    }

    .mg-checkout-card-header p {
        font-size: 0.76rem;
    }

    .mg-checkout-card .form-group {
        margin-bottom: 14px;
    }

    .mg-input-label {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }

    .mg-checkout-card .form-control {
        font-size: 0.9rem;
        padding: 10px 12px;
        border-radius: 8px;
    }

    .mg-checkout-card textarea.form-control {
        min-height: 90px;
    }

    /* Summary Card on Phone */
    .mg-summary-card,
    .mg-payment-card {
        border-radius: 14px;
    }

    .mg-summary-header {
        padding: 12px 14px;
    }

    .mg-summary-header h4 {
        font-size: 0.95rem;
    }

    .mg-summary-badge {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    .mg-summary-body {
        padding: 14px 12px;
    }

    .mg-summary-p-thumb {
        width: 38px;
        height: 38px;
    }

    .mg-summary-p-title {
        font-size: 0.82rem;
    }

    .mg-summary-p-qty {
        font-size: 0.7rem;
    }

    .mg-summary-p-price {
        font-size: 0.86rem;
    }

    .mg-breakdown-row {
        font-size: 0.8rem;
    }

    .mg-summary-total-box {
        padding: 12px 14px;
        border-radius: 10px;
        margin-top: 12px;
    }

    .mg-total-label {
        font-size: 0.85rem;
    }

    .mg-total-amount {
        font-size: 1.25rem;
    }

    /* Payment Card on Phone */
    .mg-payment-card {
        padding: 16px 12px;
    }

    .mg-payment-title {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }

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

    .mg-gw-title {
        font-size: 0.86rem;
    }

    .mg-gw-subtitle {
        font-size: 0.7rem;
    }

    .mg-btn-placeorder {
        padding: 13px 16px !important;
        font-size: 0.94rem !important;
        border-radius: 25px !important;
        margin-top: 14px;
        letter-spacing: 0.3px;
    }

    .mg-checkout-trust-strip {
        gap: 6px;
        margin-top: 12px;
        padding-top: 10px;
    }

    .mg-checkout-trust-item {
        font-size: 0.74rem;
        gap: 6px;
    }
}

/* Extra Small Phones (<= 360px) */
@media (max-width: 360px) {
    .mg-checkout-wrap {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    .mg-checkout-card,
    .mg-summary-body,
    .mg-payment-card {
        padding: 12px 8px !important;
    }

    .mg-total-amount {
        font-size: 1.15rem !important;
    }

    .mg-btn-placeorder {
        font-size: 0.88rem !important;
        padding: 12px 10px !important;
    }
}