#checkout-view-scoped {
  /* Scope Page Colors */
  --co-bg: #f6f9f8;
  --co-card-bg: #ffffff;
  --co-text-main: #1a1d20;
  --co-text-muted: #8a94a0;
  --co-text-link: #495057;
  --co-accent: #0ea5e9;
  --co-border: #e5e7eb;
  --co-border-dark: #111827;
  --co-btn-dark: #1e293b;
  --co-yellow: #ffca18;
  --co-badge-bg: #e2e8f0;

  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--co-bg);
  color: var(--co-text-main);
  min-height: 100vh;
  padding: 40px 20px;
  display: flex;
  justify-content: center;
  box-sizing: border-box;

  /* Nested Box Sizing Reset within scope */
  & *, & *::before, & *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  .checkout-container {
    width: 100%;
    max-width: 1100px;
  }

  /* --- Stepper Layout --- */
  .stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
  }

  .step {
    display: flex;
    align-items: center;
    gap: 8px;

    .step-num {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--co-text-muted);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      font-weight: 600;
    }

    .step-label {
      font-size: 13px;
      font-weight: 500;
      color: var(--co-text-muted);
    }

    &.completed .step-num, 
    &.active .step-num {
      background: var(--co-btn-dark);
    }

    &.active .step-label,
    &.completed .step-label {
      color: var(--co-text-main);
      font-weight: 600;
    }

    &.disabled {
      opacity: 0.4;
    }
  }

  .step-line {
    height: 2px;
    width: 60px;
    background: var(--co-border);
    margin: 0 12px;

    &.active {
      background: var(--co-accent);
    }
  }

  /* --- Grid Columns --- */
  .main-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 30px;
    align-items: start;
  }

  .card {
    background: var(--co-card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    margin-bottom: 24px;
  }

  .card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--co-text-main);
  }

  /* --- Address Components --- */
  .address-box {
    border: 2px solid var(--co-border);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: border-color 0.2s;
    margin-bottom: 20px;

    &.selected {
      border-color: var(--co-border-dark);
    }
  }

  .address-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
  }

  /* Checkbox & Radios styling scoped */
  .radio-container {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    padding-left: 28px;
    user-select: none;

    input {
      position: absolute;
      opacity: 0;
      cursor: pointer;
    }

    .radio-checkmark {
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      height: 18px;
      width: 18px;
      background-color: #fff;
      border: 2px solid var(--co-text-muted);
      border-radius: 50%;
    }

    input:checked ~ .radio-checkmark {
      background-color: var(--co-btn-dark);
      border-color: var(--co-btn-dark);

      &::after {
        display: block;
      }
    }

    .radio-checkmark::after {
      content: "";
      position: absolute;
      display: none;
      top: 4px;
      left: 4px;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: white;
    }
  }

  .user-name {
    font-weight: 700;
    font-size: 15px;
    margin-left: 4px;
  }

  .badge {
    background: var(--co-badge-bg);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    color: #475569;
  }

  .address-details {
    p {
      font-size: 13px;
      color: var(--co-text-muted);
      line-height: 1.6;
    }
    .phone-number {
      margin-top: 10px;
      color: #475569;
    }
  }

  .btn-add-address-checkout {
    background: transparent;
    border: none;
    font-family: inherit;
    width: 30%;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    padding: 8px;
    border-radius: 12px;
    background-color: rgb(35, 38, 35);
    color: #dbe3e5;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    cursor: pointer;
  }

  .btn-edit{
    text-decoration: none;
    font-size: 10px;
    background-color: #1a1c1c;
    color: #dcdfe5;
    padding:2px 10px ;
    border-radius: 12px;
    border: none;
  }

    .btn-delete{
    text-decoration: none;
    font-size: 10px;
    background-color: #dc0715;
    color: #dcdfe5;
    padding:2px 10px ;
    border-radius: 12px;
    border: none;
  }
  /* --- Summary Row Elements --- */
  .cart-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
  }

  .item-row {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .item-img-wrapper {
    width: 52px;
    height: 52px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .item-image {
    max-width: 100%;
    object-fit: contain;
  }

  .item-info {
    flex-grow: 1;
  }

  .item-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--co-text-main);
    margin-bottom: 2px;
  }

  .item-qty {
    font-size: 12px;
    color: var(--co-text-muted);
  }

  .item-price {
    font-size: 14px;
    font-weight: 600;
  }

  /* Coupons section setup */
  .coupon-section {
    border-bottom: 1px solid var(--co-border);
    padding-bottom: 20px;
    margin-bottom: 20px;
  }

  .coupon-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
  }

  .coupon-input {
    flex-grow: 1;
    border: 1px solid var(--co-border);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
  }

  .btn-apply {
    background: var(--co-btn-dark);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding:15px 20px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 400;
    cursor: pointer;
  }

  .view-coupons-link {
    font-size: 11px;
    font-weight: 700;
    color: var(--co-text-link);
    text-decoration: none;
    letter-spacing: 0.5px;
  }

  /* Price breakdowns metrics */
  .price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid var(--co-border);
    padding-bottom: 20px;
    margin-bottom: 24px;
  }

  .price-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--co-text-muted);
  }

  .free-text {
    color: var(--co-text-main);
    font-weight: 600;
  }

  .total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;

    span:first-child {
      font-size: 16px;
      font-weight: 700;
    }
  }

  .total-price {
    font-size: 22px;
    font-weight: 800;
  }

  /* --- Payment Methods Block --- */
  .payment-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
  }

  .payment-step-badge {
    background: var(--co-badge-bg);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
  }

  .payment-card .card-title {
    margin-bottom: 0;
  }

  .payment-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .payment-option {
    border: 1px solid var(--co-border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    position: relative;
    display: block;

    input {
      position: absolute;
      opacity: 0;
    }

    &:has(input:checked) {
      border-width: 2px;
      border-color: var(--co-border-dark);
      padding: 15px; 
    }
  }

  .payment-option-content {
    display: flex;
    gap: 14px;
    align-items: flex-start;
  }

  .payment-icon {
    color: #334155;
    margin-top: 2px;
    flex-shrink: 0;
  }

  .payment-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .method-title {
    font-size: 14px;
    font-weight: 700;

    &.dim {
      color: #64748b;
    }
  }

  .method-desc {
    font-size: 11px;
    color: var(--co-text-muted);
    line-height: 1.4;
  }

  /* --- Checkout Submission Panel --- */
  .action-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
  }

  .btn-place-order {
    width: 100%;
    background: var(--co-yellow);
    color: var(--co-text-main);
    border: none;
    border-radius: 30px;
    padding: 16px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(255, 202, 24, 0.3);
    transition: transform 0.1s;

    &:active {
      transform: scale(0.99);
    }
  }

  .back-to-cart {
    font-size: 12px;
    font-weight: 600;
    color: var(--co-text-muted);
    text-decoration: none;
  }

  /* Responsive layout viewport break rules scoped */
  @media (max-width: 850px) {
    .main-layout {
      grid-template-columns: 1fr;
    }
  }
}


.failure-container {
    display: flex;
    justify-content: center;
    padding: 50px 20px;
    background-color: #f8fafc;
    min-height: 100vh;
}

.failure-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    max-width: 450px;
    width: 100%;
    text-align: center;
}

.icon-circle {
    width: 60px;
    height: 60px;
    background: #fff0f0;
    border: 2px solid #ffdede;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e53e3e;
    font-size: 30px;
    font-weight: bold;
}

.order-details {
    margin: 30px 0;
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #718096;
}

.btn-retry, .btn-cart {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    font-weight: 600;
}

.btn-retry { background: #48bb78; color: white; }
.btn-cart { background: #007bff; color: white; }

.refund-note {
    font-size: 0.75em;
    color: #a0aec0;
    margin-top: 20px;
}


#editCategoryModal.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
}

#editCategoryModal .modal-container {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
}

#editCategoryModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem 0.25rem 1.5rem;
}

#editCategoryModal .modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

#editCategoryModal .modal-close-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #94a3b8;
    cursor: pointer;
}

#editCategoryModal .error-container {
    display: none;
    background: #fee2e2;
    color: #b91c1c;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #fecaca;
    text-align: center;
}

#editCategoryModal .modal-body {
    padding: 0.75rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

#editCategoryModal .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

#editCategoryModal .form-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: capitalize;
}

#editCategoryModal .form-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #334155;
    outline: none;
    box-sizing: border-box;
}

#editCategoryModal .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

#editCategoryModal .checkbox-text {
    font-size: 0.75rem;
    color: #334155;
}

#editCategoryModal .parent-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

#editCategoryModal .form-select {
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #334155;
    outline: none;
    background: #fff;
    box-sizing: border-box;
}

#editCategoryModal .offer-section {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-top: 1px dashed #f1f5f9;
    padding-top: 0.6rem;
}

#editCategoryModal .offer-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

#editCategoryModal .offer-badge {
    padding: 0.35rem 0.65rem;
    border: 1px solid #64748b;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #334155;
    background: #fff;
}

#editCategoryModal .offer-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

#editCategoryModal .offer-input {
    width: 55px;
    padding: 0.35rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.75rem;
    text-align: center;
    outline: none;
}

#editCategoryModal .offer-symbol {
    font-size: 0.75rem;
    color: #475569;
}

#editCategoryModal .modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1.5rem 1.25rem 1.5rem;
}

#editCategoryModal .btn-cancel {
    background: none;
    border: none;
    font-size: 0.75rem;
    color: #94a3b8;
    cursor: pointer;
}

#editCategoryModal .btn-submit {
    background: #1e293b;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}

/* ===========================
   Coupon Section
=========================== */

.coupon-input-group{
    display:flex;
    gap:10px;
    margin-bottom:10px;
}

.coupon-input{
    flex:1;
    padding:12px 15px;
    border:1px solid #dcdcdc;
    border-radius:8px;
    font-size:15px;
    outline:none;
    transition:.3s;
}

.coupon-input:focus{
    border-color:#111827;
    box-shadow:0 0 0 3px rgba(17,24,39,.08);
}

.btn-apply{
    background:#111827;
    color:#fff;
    border:none;
    padding:0 22px;
    border-radius:8px;
    cursor:pointer;
    font-weight:600;
    transition:.3s;
}

.btn-apply:hover{
    background:#2563eb;
}

.view-coupons-link{
    color:#2563eb;
    text-decoration:none;
    font-size:14px;
    font-weight:600;
}

.view-coupons-link:hover{
    text-decoration:underline;
}


/* ===========================
   Coupon Modal
=========================== */

.modal{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.45);
    justify-content:center;
    align-items:center;
    z-index:9999;
    padding:200px;
}



/* Scrollbar */

.modal-content-coupon::-webkit-scrollbar{
    width:6px;
}

.modal-content-coupon::-webkit-scrollbar-thumb{
    background:#d1d5db;
    border-radius:20px;
}

/* Heading */



/* ===========================
   Coupon Card
=========================== */


.coupon-item:hover{
    background:#eef2ff;
    transform:translateY(-2px);
    box-shadow:0 10px 20px rgba(0,0,0,.08);
}

.coupon-left{
    display:flex;
    flex-direction:column;
    gap:6px;
}

.coupon-code{
    font-size:18px;
    font-weight:700;
    color:#111827;
    letter-spacing:.4px;
}

.coupon-discount{
    color:#16a34a;
    font-size:16px;
    font-weight:600;
}

.coupon-text{
    color:#6b7280;
    font-size:13px;
}

/* ===========================
   Apply Button
=========================== */

.apply-btn{
    background:#111827;
    color:#fff;
    border:none;
    border-radius:8px;
    padding:11px 22px;
    cursor:pointer;
    font-weight:600;
    transition:.25s;
}

.apply-btn:hover{
    background:#2563eb;
}

/* ===========================
   Empty State
=========================== */

.no-coupon{
    text-align:center;
    padding:30px;
    color:#6b7280;
    font-size:15px;
}

/* ===========================
   Close Button
=========================== */

.modal-content-coupon>button{
    width:100%;
    margin-top:10px;
    border:none;
    background:#ef4444;
    color:#fff;
    padding:13px;
    border-radius:10px;
    font-size:15px;
    font-weight:600;
    cursor:pointer;
    transition:.25s;
}

.modal-content-coupon>button:hover{
    background:#dc2626;
}

/* ===========================
   Animation
=========================== */

@keyframes popup{

    from{
        opacity:0;
        transform:translateY(-20px) scale(.95);
    }

    to{
        opacity:1;
        transform:translateY(0) scale(1);
    }

}
/* ==========================================
   MODAL CONTAINER & BACKDROP
   ================================---------- */
.modal {
    display: none; /* Controlled by JS ('flex' or 'none') */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6); /* Modern dark slate backdrop */
    backdrop-filter: blur(4px); /* Soft blur effect */
    justify-content: center;
    align-items: center;
    z-index: 1050;
    padding: 40px;
    animation: fadeIn 0.2s ease-out;
}

/* ==========================================
   MODAL CONTENT BOX
   ================================---------- */
.modal-content-coupon {
    background: #ffffff;
    padding: 28px;
    border-radius: 12px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content-coupon h3 {
    margin: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    border-bottom: 2px solid #f1f5f9;
}

/* ==========================================
   COUPON LIST & ITEMS
   ================================---------- */
#couponList {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 30px;
}

/* Scrollbar styling for a cleaner look */
#couponList::-webkit-scrollbar {
    width: 6px;
}
#couponList::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.coupon-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.coupon-item:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

.coupon-item span {
    font-size: 0.95rem;
    color: #334155;
}

.coupon-item strong {
    color: #1e293b;
    letter-spacing: 0.5px;
}

/* ==========================================
   BUTTONS
   ================================---------- */
.coupon-item button {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    padding: 10px 20px; 
    font-size: 12px; /* Scaled up so text fits the button naturally */
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    display: inline-block;
    box-sizing: border-box; /* Ensures padding doesn't break width calculations */
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.coupon-item button:hover {
    background-color: #1d4ed8;
}

.coupon-item button:active {
    transform: scale(0.96);
}

.modal-content-coupon > button {
    display: block;
    width: 100%;
    
    border: none;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-content-coupon > button:hover {
    background: #2563eb;
}

/* Container for the applied coupon state */
.applied-coupon-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    color: #166534;
}

/* Style for the remove button */
.btn-remove-coupon {
    background-color: #ef4444;
    color: #f7f5f5;
    padding: 15px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

/* Hover state for the remove button */
.btn-remove-coupon:hover {
    background-color: #ef4444;
    color: #ffffff;
}

/* ==========================================
   ANIMATIONS
   ================================---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ==========================================
   Responsive Breakpoints & Adjustments
   ========================================== */

/* --- Medium Screens / Tablets (Max 850px) --- */
@media (max-width: 850px) {
  #checkout-view-scoped {
    padding: 20px 12px;

    /* Switch the 2-column checkout grid to a single column */
    .main-layout {
      grid-template-columns: 1fr;
      gap: 20px;
    }

    /* Adjust card padding for smaller screens */
    .card {
      padding: 20px;
    }

    /* Allow the add address button to take up more space if needed */
    .btn-add-address-checkout {
      width: 50%;
    }
  }
}

/* --- Small Screens / Mobile Phones (Max 480px) --- */
@media (max-width: 480px) {
  #checkout-view-scoped {
    padding: 10px 8px;

    /* Compress stepper labels or stack them if space is tight */
    .stepper {
      margin-bottom: 24px;
      overflow-x: auto;
      justify-content: flex-start;
      padding-bottom: 8px;
    }

    .step-line {
      width: 30px;
      margin: 0 6px;
    }

    /* Make buttons full width on mobile */
    .btn-add-address-checkout {
      width: 40%;
    }

    .coupon-input-group {
      flex-direction: column;
    }

    .btn-apply {
        width: 20%;
        padding: 5px;
        font-size: 10px;
    }
  }

  /* Adjust Modal padding on mobile */
  .modal, 
  #editCategoryModal.modal-overlay {
    padding: 15px;
  }

  .modal-content-coupon {
    width: 95%;
    padding: 20px 16px;
  }

  #couponList {
    padding: 10px;
  }

  /* Failure Card responsiveness */
  .failure-card {
    padding: 24px 16px;
  }

  .card-title{
    font-size: 10px;
  }

   .action-group .btn-place-order {
    width: 50%;
    font-size: 10px;
    padding: 5px 10px;
  }

  .step-label{
    font-size: 10px;
  }
}