/**
 * Dapin47 v2 — Order Page & WhatsApp Checkout Styling
 * Layout Split 2-Kolom (Desktop), Single Column (Tablet), Floating Bar (Mobile).
 */

.order-page {
  background-color: var(--light-bg);
  padding: 40px 0 80px;
}

@media (max-width: 768px) {
  .order-page {
    padding: 25px 0 110px; /* Padding bottom lega agar form tidak tertutup floating bar [BUG-2] */
  }
}

.order-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
}

.order-summary-col {
  height: 100%;
  position: relative;
}

@media (max-width: 991px) {
  .order-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ==========================================================================
   Order Form Card
   ========================================================================== */
.order-card {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

@media (max-width: 576px) {
  .order-card {
    padding: 20px 16px;
  }
}

.order-card-title {
  font-family: var(--heading-font);
  font-size: 2.2rem;
  color: var(--heading-color);
  margin-bottom: 6px;
  line-height: 1.1;
}

.order-card-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Category Filter Tabs in Order Page */
.order-category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.cat-tab-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-family: var(--nav-font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.cat-tab-btn:hover,
.cat-tab-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

/* ==========================================================================
   Visual Product Selection Items
   ========================================================================== */
.order-product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.order-product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  gap: 12px;
}

.order-product-row:hover {
  border-color: #d1d5db;
}

.order-product-row.has-qty {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

.order-product-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.order-product-thumb {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}

.order-product-info {
  min-width: 0;
}

.order-product-name {
  font-family: var(--nav-font);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--heading-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.order-product-pricing {
  font-size: 0.85rem;
  color: var(--primary-color);
  font-weight: 700;
}

.order-product-pricing small {
  color: var(--text-muted);
  font-weight: 400;
}

/* Quantity Stepper Component */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
}

.qty-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--heading-color);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.qty-btn:hover:not(:disabled) {
  background: var(--surface-alt);
  color: var(--primary-color);
}

.qty-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.qty-input {
  width: 36px;
  text-align: center;
  border: none;
  font-family: var(--nav-font);
  font-weight: 700;
  font-size: 0.95rem;
  background: transparent;
  color: var(--heading-color);
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ==========================================================================
   Form Controls
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-family: var(--nav-font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--heading-color);
  margin-bottom: 6px;
}

.form-label .req {
  color: var(--primary-color);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  font-size: 0.92rem;
  color: var(--text-color);
  background: #ffffff;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(206, 18, 18, 0.12);
}

.form-error {
  font-size: 0.8rem;
  color: #dc2626;
  margin-top: 4px;
  display: none;
}

.has-error .form-control {
  border-color: #dc2626;
}

.has-error .form-error {
  display: block;
}

/* Radio Pills */
.radio-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-pill {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
  transition: var(--transition-fast);
}

.radio-pill:hover {
  border-color: #d1d5db;
}

.radio-pill input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--primary-color);
}

.radio-pill-content {
  flex: 1;
}

.radio-pill-title {
  font-family: var(--nav-font);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 2px;
}

.radio-pill-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.radio-pill input[type="radio"]:checked ~ .radio-pill-content .radio-pill-title {
  color: var(--primary-color);
}

/* ==========================================================================
   Sticky Receipt / Order Summary Panel
   ========================================================================== */
.order-summary-panel {
  position: -webkit-sticky;
  position: sticky;
  top: 96px;
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-md);
  border: 1.5px solid var(--border-color);
  z-index: 10;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  transition: box-shadow 0.25s ease, transform 0.2s ease, border-color 0.25s ease;
}

@keyframes panelPulse {
  0% { transform: scale(1); border-color: var(--border-color); }
  50% { transform: scale(1.015); border-color: var(--primary-color); box-shadow: 0 8px 30px rgba(206, 18, 18, 0.18); }
  100% { transform: scale(1); border-color: var(--border-color); }
}

.order-summary-panel.panel-highlight {
  animation: panelPulse 0.35s ease-out;
}

.summary-title {
  font-family: var(--heading-font);
  font-size: 2rem;
  color: var(--heading-color);
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 8px;
}

.summary-items-list {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding-right: 4px;
}

.summary-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-light);
}

.summary-item-name {
  color: var(--heading-color);
  font-weight: 500;
  flex: 1;
  padding-right: 8px;
}

.summary-item-val {
  font-weight: 700;
  color: var(--text-color);
  white-space: nowrap;
}

.summary-subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 18px;
  font-size: 1.1rem;
  font-family: var(--nav-font);
  font-weight: 700;
  border-top: 2px solid var(--border-color);
}

.summary-subtotal-val {
  font-size: 1.35rem;
  color: var(--primary-color);
}

.btn-checkout-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: var(--whatsapp-color);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-family: var(--nav-font);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
}

.btn-checkout-wa:hover:not(:disabled) {
  background: var(--whatsapp-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.4);
}

.btn-checkout-wa:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(40%);
}

.checkout-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  line-height: 1.4;
}

/* ==========================================================================
   Mobile Floating Checkout Bar [BUG-2, BUG-6 FIXED]
   ========================================================================== */
.mobile-checkout-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 72px;
  background: #ffffff;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  border-top: 1px solid var(--border-color);
  padding: 10px 16px;
  z-index: 999;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: transform 0.25s ease;
}

@media (max-width: 991px) {
  .mobile-checkout-bar {
    display: flex;
  }
}

.mobile-checkout-info {
  display: flex;
  flex-direction: column;
}

.mobile-checkout-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.mobile-checkout-total {
  font-family: var(--nav-font);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
}

.mobile-checkout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--whatsapp-color);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-family: var(--nav-font);
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

/* Hide when virtual keyboard is active to prevent overlapping inputs [BUG-6] */
body.keyboard-open .mobile-checkout-bar {
  display: none !important;
}
