/* ========================================
   Components — PrintX Reference Match
   ======================================== */

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
}

.card-body {
  padding: 24px;
}

.card-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0; /* Handled by header padding */
}

/* Field labels — uppercase, small, muted */
.field-group {
  margin-bottom: var(--space-xl);
}

.field-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* Inputs — simple grey */
.input-field {
  width: 100%;
  height: 48px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--fs-base);
  transition: border-color var(--transition-fast);
}

.input-field:focus {
  border-color: var(--accent-pink);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.08);
}

.input-field:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-primary);
}

.input-fixed {
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
}

/* Custom Select Dropdown Arrow */
select.input-field {
  -webkit-appearance: none;
  -moz-appearance: none;
  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='%236b7280' stroke-width='2' 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: 40px; /* Space for the custom arrow */
}

/* Custom Number Spinner UI */
.number-input-group {
  display: flex;
  align-items: stretch;
  height: 48px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.number-input-group:focus-within {
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.08);
}

.number-input-group .input-field {
  border: none;
  border-radius: 0;
  text-align: center;
  padding: 0 var(--space-xs);
  height: 100%;
}

.number-input-group .input-field:focus {
  box-shadow: none;
}

.btn-spin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  background: var(--bg-input);
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.btn-spin:hover {
  background: #e5e7eb;
  color: var(--text-primary);
}

.btn-spin:active {
  background: #d1d5db;
}

/* Hide native number spin arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield; /* Firefox */
}


/* Selected Format Badge */
.format-badge {
  background: #fdf2f8;
  border: 1px solid #fce7f3;
  border-radius: var(--radius-md);
  padding: 0 var(--space-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 48px;
  box-sizing: border-box;
}

.format-badge-name {
  color: #9d174d;
  font-weight: var(--fw-bold);
  font-size: 14px;
  line-height: 1.2;
}

.format-badge-dims {
  color: #be185d;
  font-size: 11px;
  margin-top: 2px;
  line-height: 1.1;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.input-col {
  display: flex;
  flex-direction: column;
}

/* ========================================
   Buttons — Gradient pills (PrintX style)
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 24px;
  font-family: var(--font-family);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.btn:hover {
  background: #e5e7eb;
  color: var(--text-primary);
}

.btn-group {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Toggle buttons — inactive: grey pill, active: gradient */
.btn-select {
  padding: 11px 21px; /* adjusted to compensate for removed border */
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: none;
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
  flex: 1; /* Stretch to fill space evenly */
}

.btn-select.active {
  background: var(--gradient-primary);
  color: #fff;
  font-weight: var(--fw-semibold);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.2);
}

.btn-select.active:hover {
  background: var(--gradient-primary-hover);
  color: #fff;
}

.btn-select:not(.active):hover {
  background: #e5e7eb;
}

/* Specific button for adding conversions to prevent mobile overrides */
.btn-add-conversion {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-add-conversion:hover {
  background: #f3f4f6;
  color: var(--text-primary);
  border-color: var(--border-active);
}

/* Primary (gradient) */
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  font-weight: var(--fw-semibold);
  box-shadow: var(--gradient-btn-shadow);
  border: none;
}

.btn-primary:hover {
  background: var(--gradient-primary-hover);
  color: #fff;
}

.btn-success {
  background: var(--success) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3) !important;
}

/* WhatsApp — green brand color */
.btn-whatsapp {
  background: linear-gradient(135deg, #25D366, #1da851);
  border: none;
  color: #fff;
  font-weight: var(--fw-semibold);
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
  background: linear-gradient(135deg, #1da851, #128c7e);
  color: #fff;
}

/* Chips */
.chip-group {
  display: flex;
  gap: var(--space-sm);
}

.chip {
  padding: 5px 14px;
  font-family: var(--font-family);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip:hover {
  border-color: var(--border-active);
}

.chip.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
}

/* ========================================
   Partner cards
   ======================================== */

.partner-card {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.partner-card:hover {
  border-color: var(--border-active);
  background: #fff;
}

.partner-card.selected {
  border-color: var(--accent-orange);
  background: var(--warning-bg);
}

.partner-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.partner-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.partner-name {
  font-weight: var(--fw-semibold);
  font-size: 14px;
  color: var(--text-primary);
}

.partner-track {
  font-size: 11px;
  color: var(--accent-pink);
  text-decoration: none;
  font-weight: var(--fw-medium);
}
.partner-track:hover {
  text-decoration: underline;
}

.partner-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.partner-cost {
  font-size: 18px;
  font-weight: var(--fw-bold);
  color: var(--accent-orange);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.kpi-block {
  padding: 12px 14px;
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center; /* Center content vertically */
  min-height: 116px;
}

.kpi-label {
  font-size: 14px;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 12px;
}

.kpi-value {
  font-size: 22px;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.1;
  white-space: nowrap;
}

.kpi-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  line-height: 1.4;
  white-space: nowrap;
}

/* Delivery KPI — orange accent */
.kpi-block.kpi-delivery {
  background: var(--warning-bg);
  border-color: #ffedd5;
}

.kpi-block.kpi-delivery .kpi-label,
.kpi-block.kpi-delivery .kpi-value,
.kpi-block.kpi-delivery .kpi-sub {
  color: #ea580c;
}

/* Breakdown Badges */
.breakdown-badge {
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  display: inline-block;
  width: fit-content;
}

.breakdown-print-badge {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.breakdown-delivery-badge {
  background: var(--warning-bg);
  color: #ea580c;
}

/* ========================================
   Final Total
   ======================================== */

.final-total-label {
  font-size: 13px;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.final-total-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--success);
  line-height: 1;
}

/* ========================================
   Validation error
   ======================================== */

.validation-error {
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  margin-top: var(--space-md);
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.badge-recommended {
  background: #fef08a; /* Yellow-200 */
  color: #854d0e; /* Yellow-800 */
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

/* ========================================
   Responsive Components (Mobile)
   ======================================== */

@media (max-width: 768px) {
  .card {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 16px;
  }
  .card-header {
    padding: 16px;
  }
  .card-body {
    padding: 16px;
  }
  .btn, .btn-select {
    width: 100%;
    min-height: 44px;
    height: 48px;
    font-size: 14px; /* Reduced from 15px for better hierarchy */
    justify-content: center;
  }
  /* Secondary Button Hierarchy Fix */
  .btn:not(.btn-primary):not(.btn-success):not(.btn-whatsapp):not(.btn-select) {
    background: transparent;
    border: 1px solid var(--border-color);
    font-weight: 500; /* Lighter visual weight */
    color: var(--text-primary);
  }
  .btn-select:not(.active) {
    background: #f8f9fa; /* Lighter background */
    border: 1px solid var(--border-color);
    font-weight: 500;
  }
  .btn-group {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  .input-field {
    width: 100%;
    height: 44px;
    font-size: 16px;
    padding: 10px 12px;
  }
  .input-col {
    margin-bottom: 8px;
  }
  .input-row {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  .number-input-group {
    height: 44px;
  }
  .format-badge {
    height: 44px;
    padding: 0 var(--space-md);
  }
  .format-badge-name {
    font-size: 13px;
  }
  .format-badge-dims {
    font-size: 10px;
    margin-top: 1px;
  }
  .kpi-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .kpi-block {
    min-height: auto;
    padding: 12px;
    width: 100%;
    overflow: hidden;
  }
  /* Typography tweaks */
  .card-title {
    font-size: 15px; /* balanced section title */
  }
  .field-label, .kpi-label, .final-total-label {
    font-size: 12px; /* balanced labels */
  }
  .kpi-value {
    font-size: 22px;
    word-break: break-word;
  }
  .final-total-value {
    font-size: 28px;
  }
  /* Adjust breakdown layout */
  .breakdown-section > div:first-child {
    flex-direction: column;
  }
  .breakdown-badge {
    white-space: normal;
    word-break: break-word;
  }
  .admin-upload-btn {
    width: 100%;
    min-height: 44px;
    display: flex;
    justify-content: center;
  }
}

/* Manual Size List Row Component */
.manual-size-item {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f9fafb;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.manual-size-item .size-inputs-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-size-item .multiplier {
  color: var(--text-muted);
}

.manual-size-item .unit {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 4px;
}

.manual-size-item .spacer {
  flex: 1;
}

.manual-size-item .remove-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  border: 1px solid #fecaca;
  background: #fef2f2;
  border-radius: 8px;
  flex-shrink: 0;
}

.manual-size-item .remove-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

@media (max-width: 480px) {
  .manual-size-item {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    row-gap: 12px;
    column-gap: 8px;
    padding: 12px !important;
  }
  
  .manual-size-item .spacer {
    display: none !important;
  }
  
  .manual-size-item .size-inputs-group {
    grid-column: 1 / -1;
    width: 100%;
  }
  
  .manual-size-item .quantity-group {
    grid-column: 1;
    justify-self: start;
  }
  
  .manual-size-item .delete-group {
    grid-column: 2;
    justify-self: end;
  }
}

/* Cart Items */
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all var(--transition-fast);
}

.cart-item:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

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

.cart-item-title {
  font-weight: var(--fw-semibold);
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cart-item-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

