/* ===== Command Page Container ===== */
.command-container {
  width: 80%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 200px 0 6rem;
}

/* ===== Two-column Layout ===== */

.command-content {
  display: flex;
  align-items: flex-start; /* Prevents equal height stretching */
  justify-content: space-between;
  gap: 40px;
}

/* ===== Left: Order summary ===== */

#order-summary {
  border: 1px solid #ddd;
  border-radius: 10px;
  background-color: #fff;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-section-delivery h2 {
  margin-top: 20;
  margin-bottom: 10px;
  font-size: 1.5rem;
  color: var(--primary-color);
}

/* ===== Right: Billing section ===== */
 
 #billing-section {
  flex: 1;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  height: auto; /* independent height */
}

/* ===== Order Table Styling ===== */
.order-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
  font-size: 1rem;
}

.order-table th,
.order-table td {
  padding: 10px 8px;
  text-align: center;
  vertical-align: middle; 
}

.order-table th {
  background-color: rgba(238, 181, 114, 0.4);
}

.order-table td:nth-child(3),
.order-table td:nth-child(5) {
  white-space: nowrap;
}

.order-product {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-product-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.order-product-name {
  font-weight: 600;
  color: var(--text-color);
  font-size: 1rem;
}

.order-product-volume {
  font-size: 0.9rem;
  color: #777;
}

.order-thumb {
  width: 55px;
  height: auto;
  border-radius: 4px;
}

.order-item {
  border-bottom: 1px solid #eee;
}

/* ===== Total Row Highlight ===== */
.order-total td {
  font-weight: 700;
  font-size: 1.2rem;
  background-color: rgba(238, 181, 114, 0.15);
  border-top: 2px solid rgba(238, 181, 114, 0.5);
  text-align: right;
  padding: 15px 10px;
}

.order-total td:first-child {
  text-align: right;
  font-size: 1.1rem;
}

/* ===== Billing Form Styling ===== */
.form-section {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 10px;
}

.form-section-delivery {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input[type="text"] {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1.1rem;
}

input[type="email"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1.1rem;
}

input[type="tel"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1.1rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

 
.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.terms-row {
  margin-top: 20px;
}

.terms-row a:hover {
  color: var(--text-color);
  background-image: linear-gradient(var(--text-color), var(--text-color));
}

input,
textarea {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px;
  font-size: 0.8rem;
  resize: vertical;
  transition: border-color 0.2s ease;
}

/* Only error fields turn red (after JS adds .error) */
input.error,
textarea.error {
  border-color: #d9534f !important;
}

/* Success visual */
input.success,
textarea.success {
  border-color: #5cb85c;
}

.error-message {
  color: #d9534f;
  font-size: 0.9rem;
  margin-top: -5px;
  margin-bottom: 8px;
}




.delivery-msg {
  margin-top: 0.5rem;
  font-style: italic;
  color: red;
  transition: opacity 0.3s ease;
}
.delivery-msg.hidden {
  opacity: 0;
}

.delivery-red {
  color: #d93025; /* red */
  font-weight: 600;
}

.delivery-green {
  color: #228B22; /* green */
  font-weight: 600;
}

#delivery-message {
  transition: opacity 0.4s ease;
}

.delivery-msg.charge {
  color: #c0392b; /* red for fee */
}
.delivery-msg.free {
  color: #27ae60; /* green for free */
}



/* ===== Payment Buttons ===== */
.payment-buttons {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-buttons button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.8rem 1.6rem;
  border-radius: 20px;
  font-size: 1.1rem !important;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.payment-buttons button:hover:enabled {
  background-color: var(--primary-color-dark);
  transform: translateY(-2px);
}

.payment-buttons button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ===== Back Buttons ===== */
.back-btn {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--primary-color);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
  margin: 20px 0 20px 0;
  width: 150px;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.back-btn:hover {
  background-color: var(--primary-color-dark);
  color: white;
  transform: translateY(-2px);
}

 
 /* ===== Payment Overlay ===== */
.payment-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 5vw;
  box-sizing: border-box;
  overflow-y: auto;
}

.payment-overlay.hidden {
  display: none !important;
}

.payment-overlay-content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
  max-width: 900px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.25);
  padding: 25px;
  margin: 20px;
  overflow: hidden;
}

.payment-upper {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;     
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 20px;
}

.payment-qr-container {
  flex: 1 1 60%;
  display: flex;
  align-items: center;   
  justify-content: center;   
}

.payment-qr {
  max-width: 90%;
  max-height: 90%;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
}

.payment-info {
  flex: 1 1 35%;
  display: flex;
  align-items: center;    
  justify-content: center;   
  text-align: left;
  font-size: 1rem;
  line-height: 1.5;
}

.payment-total {
  margin-bottom: 20px;
  text-align: left;
}

.payment-total-label {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-color);
}

.payment-total-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 4px;
}

.payment-lower {
  flex: 1 1 auto;
  font-size: 1rem;
  line-height: 1.5;
  text-align: justify;
  margin: 20px;
}

.payment-buttons,
.payment-buttonsOverlay {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.payment-confirm-btn,
.payment-back-btn {
  border-radius: 20px;
  padding: 10px 24px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.payment-confirm-btn{
  align-self: flex-start;
  background-color: var(--primary-color);
  color: white;
  border: none;
}

.payment-back-btn {
  align-self: flex-end;
  background-color: white; ;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.payment-confirm-btn:hover {
  background-color: var(--primary-color-dark);
  transform: translateY(-2px);
}

.payment-back-btn:hover {
  background-color: var(--primary-color-dark);
  transform: translateY(-2px);
}





/* === Success message === */
#payment-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}
#payment-success h2 {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 10px;
}
#payment-success p {
  font-size: 1rem;
  color: #333;
  line-height: 1.4;
}

/* Close "X" button */
.close-overlay {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #555;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-overlay:hover {
  color: var(--primary-color-dark);
}

/* Success message */
#payment-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

#payment-success h2 {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 10px;
}

#payment-success p {
  font-size: 1rem;
  color: #333;
  line-height: 1.4;
}






/* ===== Responsive Layout ===== */
@media (max-width: 1100px) {
  .command-content {
    flex-direction: column;
    gap: 40px;
  }

  #order-summary-section,
  #billing-section {
    width: 100%;
  }

  .command-container {
    width: 90%;
    padding-top: 120px;
  }

  .order-table th,
  .order-table td {
    font-size: 0.9rem;
  }

  .order-thumb {
    width: 45px;
  }

  .order-total td {
    font-size: 1rem;
  }  



}
/* ===== Responsive Layout for medium Screens (≤ 800px) ===== */
@media (max-width: 800px) {
  .payment-upper {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .payment-qr {
    max-width: 60%;
  }
  
  .payment-total {
    text-align: center;
  }
  
  .payment-info {
    font-size: 0.9rem;
  }

  .payment-lower {
    font-size: 0.9rem;
    text-align: center;
  }
  
  .payment-confirm-btn {
    align-self: center;
/*     width: 60%; */
    max-width: 250px;
  }

  .payment-back-btn {
    align-self: center;
    max-width: 250px;
  }
  
  .payment-overlay {
  padding: 4vw; 
  }

  .payment-overlay-content {
    width: 90%;
    max-width: 95%;
    padding: 10px;
  }
  
  .payment-info {
    align-items: center;
    text-align: center;
  }
}





/* ===== Responsive Layout for Small Screens (≤ 550px) ===== */
@media (max-width: 550px) {

  /* Layout & general scaling */
  .command-container {
    width: 95%;
    padding-top: 120px;
  }

  .command-content {
    flex-direction: column;
    gap: 40px;
    align-items: stretch;
  }

  #order-summary-section,
  #billing-section {
    width: 100%;
  }

  h1 {
    font-size: 1.4rem;
  }

  .back-btn {
    font-size: 0.9rem;
    width: auto;
  }

  /* ===== Order Summary as Card Layout ===== */
  .order-table thead {
    display: none;
  }

  .order-table,
  .order-table tbody,
  .order-table tr,
  .order-table td {
    display: block;
    width: 100%;
  }

  .order-table tr {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 18px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  }

  /* Cells become labeled rows */
  .order-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
    font-size: 0.95rem;
  }

  .order-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    text-align: left;
  }

  /* ===== Product cell ===== */
  .order-product {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
  }

  .order-thumb {
    width: 65px;
    height: auto;
    border-radius: 8px;
  }

  .order-product-info {
    align-items: center;
  }

  .order-product-name {
    font-size: 1rem;
    font-weight: 600;
  }

  .order-product-volume {
    font-size: 0.9rem;
    color: #666;
  }

  /* ===== Total Row ===== */

  #order-summary {
    position: relative;
  }

  .order-total {
    display: table-row;
  width: 100%;
  }
  
  .order-total td {
    display: table-cell;
    text-align: right;
    padding: 15px 10px;
    font-weight: 700;
    font-size: 1.2rem;
    background-color: rgba(238, 181, 114, 0.25);
    border-top: 2px solid rgba(238, 181, 114, 0.5);  
  }


  /* ===== Billing Section ===== */
  .form-section {
    width: 100%;
  }

  input[type="text"] {
    font-size: 1rem;
  }

  /* ===== Payment overlay ===== */
  .payment-overlay-content {
    width: 95%;
/*     padding: 12px; */
  }
  .payment-qr {
    max-width: 65%;
  }
  .payment-info {
    font-size: 0.9rem;
  }
  .payment-lower {
    font-size: 0.85rem;
  }
  .payment-confirm-btn {
/*     width: 70%; */
    font-size: 0.95rem;
  }
}
