/**
 * View Order / Order Lookup Styles
 */

.seecommerce-view-order {
  max-width: 1000px;
  margin: 32px auto;
  padding: 0 20px;
}

@media (max-width: 640px) {
  .seecommerce-view-order {
    margin: 16px auto;
    padding: 0 16px;
  }
}

.view-order-wrapper {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 32px;
}

@media (max-width: 1024px) {
  .view-order-wrapper {
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .view-order-wrapper {
    padding: 20px;
  }
}

/* Lookup Header */
.lookup-header {
  text-align: center;
  padding: 32px 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 32px;
}

.lookup-header h1 {
  margin: 0 0 12px;
  font-size: 32px;
  font-weight: 700;
  color: #111827;
}

.lookup-header p {
  margin: 0;
  font-size: 16px;
  color: #6b7280;
  max-width: 600px;
  margin: 0 auto;
}

/* Lookup Form */
.lookup-form {
  max-width: 500px;
  margin: 0 auto;
}

.form-field {
  margin-bottom: 24px;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.form-field label .required {
  color: #dc2626;
}

.form-field input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  transition: all 0.2s;
  font-family: inherit;
}

.form-field input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-field input:disabled {
  background: #f3f4f6;
  cursor: not-allowed;
  opacity: 0.6;
}

.form-field small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
}

.form-divider {
  position: relative;
  text-align: center;
  margin: 32px 0;
}

.form-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e5e7eb;
}

.form-divider span {
  position: relative;
  display: inline-block;
  padding: 0 16px;
  background: #ffffff;
  color: #9ca3af;
  font-size: 14px;
  font-weight: 500;
}

.error-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  margin: 24px 0;
}

.error-message .error-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.error-message p {
  margin: 0;
  color: #991b1b;
  font-size: 14px;
  line-height: 1.5;
}

.seecommerce-btn-primary {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  background: #2563eb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.seecommerce-btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.seecommerce-btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.seecommerce-btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.seecommerce-btn-primary .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Lookup Help */
.lookup-help {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
}

.lookup-help h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.lookup-help p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
  max-width: 500px;
  margin: 0 auto;
}

/* View Order Header (when order is found) */
.view-order-header {
  text-align: center;
  padding: 48px 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 48px;
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: #059669;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: bold;
}

.view-order-header h1 {
  margin: 0 0 16px;
  font-size: 36px;
  font-weight: 700;
  color: #111827;
}

.order-found-message {
  margin: 0;
  font-size: 18px;
  color: #6b7280;
  max-width: 600px;
  margin: 0 auto;
}

/* Content Layout (same as confirmation) */
.view-order-content {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 32px;
  margin-bottom: 48px;
}

@media (max-width: 1024px) {
  .view-order-content {
    grid-template-columns: 1fr;
  }

  .order-summary {
    order: -1;
  }
}

/* Info Section */
.info-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.info-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
}

.info-card h2 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

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

.info-item .label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.info-item .value {
  font-size: 15px;
  color: #111827;
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.status-processing {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* Address */
.address p {
  margin: 0 0 4px;
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
}

.address p strong {
  color: #111827;
}

/* Order Summary */
.order-summary {
  position: sticky;
  top: 32px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  height: fit-content;
}

.order-summary h2 {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

/* Order Items */
.order-items {
  margin-bottom: 24px;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid #e5e7eb;
}

.order-item:last-child {
  border-bottom: none;
}

.item-info {
  flex: 1;
}

.item-info h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.item-meta {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.item-total {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

/* Order Totals */
.order-totals {
  padding-top: 16px;
  border-top: 2px solid #e5e7eb;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  color: #6b7280;
}

.total-row.grand-total {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

/* Actions */
.view-order-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding: 32px 0;
  border-top: 2px solid #e5e7eb;
}

@media (max-width: 640px) {
  .view-order-actions {
    flex-direction: column;
  }
}

.seecommerce-btn {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-family: inherit;
}

.seecommerce-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.seecommerce-btn-outline {
  background: #fff;
  color: #2563eb;
  border: 2px solid #2563eb;
}

.seecommerce-btn-outline:hover {
  background: #eff6ff;
}

.seecommerce-btn:not(.seecommerce-btn-outline) {
  background: #2563eb;
  color: #ffffff;
}

.seecommerce-btn:not(.seecommerce-btn-outline):hover {
  background: #1d4ed8;
}

/* Print Styles */
@media print {
  /* Hide all non-content elements */
  #wpadminbar,
  #adminmenumain,
  #wpfooter,
  .view-order-actions,
  .lookup-form,
  .lookup-header,
  .lookup-help,
  .seecommerce-btn,
  .seecommerce-btn-outline,
  nav,
  header.site-header,
  footer.site-footer {
    display: none !important;
  }

  /* Page setup */
  @page {
    margin: 1cm;
  }

  /* Complete reset */
  * {
    box-sizing: border-box !important;
  }

  html,
  body {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide all, show only view-order */
  body * {
    visibility: hidden;
  }

  .seecommerce-view-order,
  .seecommerce-view-order * {
    visibility: visible;
  }

  /* Main container */
  .seecommerce-view-order {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 20px !important;
  }

  /* Header */
  .view-order-header {
    text-align: center !important;
    padding: 0 0 10px 0 !important;
    margin: 0 0 20px 0 !important;
    border-bottom: 2px solid #000 !important;
  }

  .view-order-header h1 {
    font-size: 24px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    color: #000 !important;
  }

  .order-found-message,
  .success-icon {
    display: none !important;
  }

  /* Content wrapper - Use Grid */
  .view-order-content {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: auto auto !important;
    gap: 0 !important;
    width: 100% !important;
  }

  /* Info section - Use display: contents to make cards direct grid children */
  .info-section {
    display: contents !important;
  }

  /* Card 1: Order Details - Position: Row 1, Col 1 */
  .info-section .info-card:nth-child(1) {
    grid-row: 1 !important;
    grid-column: 1 !important;
    margin: 0 0.75rem 0 0 !important;
    padding: 12px !important;
    border: 1px solid #000 !important;
    border-radius: 0 !important;
    background: #fff !important;
  }

  /* Card 2: Shipping Address - Position: Row 1, Col 3 (Right) */
  .info-section .info-card:nth-child(2) {
    grid-row: 1 !important;
    grid-column: 3 !important;
    margin: 0 0 0 0.75rem !important;
    padding: 12px !important;
    border: 1px solid #000 !important;
    border-radius: 0 !important;
    background: #fff !important;
  }

  /* Card 3: Billing Address - Position: Row 1, Col 2 (Middle) */
  .info-section .info-card:nth-child(3) {
    grid-row: 1 !important;
    grid-column: 2 !important;
    margin: 0 !important;
    padding: 12px !important;
    border: 1px solid #000 !important;
    border-radius: 0 !important;
    background: #fff !important;
  }

  /* Order Summary - Position: Row 2, Span all 3 columns */
  .order-summary {
    grid-row: 2 !important;
    grid-column: 1 / 4 !important;
    margin: 15px 0 0 0 !important;
    padding: 15px !important;
    border: 1px solid #000 !important;
    border-radius: 0 !important;
    background: #fff !important;
    position: static !important;
  }

  /* Card titles */
  .info-card h2,
  .order-summary h2 {
    margin: 0 0 10px 0 !important;
    padding: 0 0 6px 0 !important;
    border-bottom: 2px solid #000 !important;
    color: #000 !important;
    font-weight: 600 !important;
  }

  .info-card h2 {
    font-size: 14px !important;
  }

  .order-summary h2 {
    font-size: 16px !important;
  }

  /* Info items */
  .info-grid {
    display: block !important;
  }

  .info-item {
    margin: 0 0 10px 0 !important;
    padding: 0 0 8px 0 !important;
    border-bottom: 1px solid #ddd !important;
  }

  .info-item:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  .info-item .label {
    display: block !important;
    font-size: 11px !important;
    color: #666 !important;
    margin: 0 0 3px 0 !important;
  }

  .info-item .value {
    display: block !important;
    font-size: 13px !important;
    color: #000 !important;
    font-weight: 600 !important;
  }

  /* Address */
  .address p {
    margin: 0 0 4px 0 !important;
    font-size: 12px !important;
    line-height: 1.6 !important;
    color: #000 !important;
  }

  /* Order items table */
  .order-items {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 15px !important;
  }

  .order-item {
    display: table-row !important;
  }

  .order-item .item-info,
  .order-item .item-total {
    display: table-cell !important;
    padding: 10px !important;
    border: 1px solid #ddd !important;
    vertical-align: top !important;
  }

  .order-item .item-info h3 {
    font-size: 13px !important;
    font-weight: 600 !important;
    margin: 0 0 4px 0 !important;
    color: #000 !important;
  }

  .order-item .item-meta {
    font-size: 12px !important;
    color: #666 !important;
    margin: 0 !important;
  }

  .order-item .item-total {
    text-align: right !important;
    font-weight: 600 !important;
    width: 120px !important;
    white-space: nowrap !important;
    color: #000 !important;
  }

  /* Order totals */
  .order-totals {
    border-top: 2px solid #000 !important;
    padding-top: 8px !important;
  }

  .total-row {
    display: flex !important;
    justify-content: space-between !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
    color: #000 !important;
  }

  .total-row span {
    color: #000 !important;
  }

  .total-row span:last-child {
    min-width: 120px !important;
    text-align: right !important;
  }

  .total-row.grand-total {
    border-top: 2px solid #000 !important;
    padding-top: 12px !important;
    margin-top: 8px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
  }

  /* Status badges */
  .status-badge {
    padding: 4px 8px !important;
    font-size: 11px !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Customer Notes */
.customer-note {
  background: #f9fafb;
  border-left: 4px solid #2563eb;
  padding: 16px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.6;
  color: #374151;
}

.customer-note p {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}
