/* AWP PrintWise - Checkout Modal Styles */
/* App-like Compact UI - Native Mobile App Density */

/**
 * Checkout Modal Overlay
 */
.awp-checkout-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000100 !important; /* Header kuşaklarının üstünde, en üst katman */
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.awp-checkout-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/**
 * Checkout Modal - Compact
 */
.awp-checkout-screen-modal {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  width: 90%;
  max-width: 720px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  background: #ffffff;
  z-index: 10000101 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease,
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

/* Mobil: alttan yukarı slide-up */
@media (max-width: 768px) {
  .awp-checkout-screen-modal {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
    transform: translateY(100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top) 12px 12px env(safe-area-inset-right);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    transition:
      opacity 0.3s ease,
      visibility 0.3s ease,
      transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .awp-checkout-screen-modal .awp-checkout-modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
  }

  .awp-checkout-screen-modal.active {
    transform: translateY(0);
  }

  .awp-checkout-screen-modal.closing {
    transform: translateY(100%);
  }
}

.awp-checkout-screen-modal.active {
  opacity: 1;
  visibility: visible;
}

@media (min-width: 641px) {
  .awp-checkout-screen-modal.active {
    transform: translateX(-50%) translateY(0);
  }
}

/**
 * Checkout Modal Content
 */
.awp-checkout-modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

/**
 * Checkout Modal Header - Compact
 */
.awp-checkout-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.awp-checkout-modal-title {
  font-size: 16px;
  font-weight: 500;
  color: #111827;
  margin: 0;
}

.awp-checkout-modal-close {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #6b7280;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.awp-checkout-modal-close svg {
  width: 20px;
  height: 20px;
}

.awp-checkout-modal-close:hover {
  color: #111827;
}

.awp-checkout-modal-close:active {
  transform: scale(0.95);
}

/**
 * Checkout Modal Body - Compact
 */
.awp-checkout-modal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  min-height: 0;
}

/**
 * Checkout Form - Compact
 */
.awp-checkout-form {
  width: 100%;
}

.awp-checkout-form .form-group {
  margin-bottom: 12px;
}

.awp-checkout-form label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.awp-checkout-form input,
.awp-checkout-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s;
  min-height: 36px;
}

.awp-checkout-form input:focus,
.awp-checkout-form textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.awp-checkout-form textarea {
  resize: vertical;
  min-height: 72px;
}

/**
 * Checkout Modal Footer - Compact
 */
.awp-checkout-modal-footer {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.awp-checkout-modal-footer button {
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  z-index: 10;
  pointer-events: auto;
  min-height: 40px;
}

.awp-checkout-modal-footer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.awp-checkout-modal-close {
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

/**
 * Mini Checkout (Instagram-style popup) - Compact
 */
.awp-checkout-screen-modal.awp-mini-checkout {
  max-width: 500px;
  max-height: 75vh;
  width: 90%;
}

@media (max-width: 640px) {
  .awp-checkout-screen-modal.awp-mini-checkout {
    width: 95%;
    max-height: 80vh;
  }
}

/**
 * Checkout Footer Buttons Grid - Compact
 */
.awp-checkout-modal-footer-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.awp-checkout-modal-footer-buttons.has-secondary-button {
  grid-template-columns: 2fr 1fr;
}

@media (max-width: 768px) {
  .awp-checkout-modal-footer-buttons.has-secondary-button {
    grid-template-columns: 2fr 1fr;
    gap: 8px;
  }

  .awp-checkout-modal-footer {
    padding-bottom: calc(16px + 72px + env(safe-area-inset-bottom));
  }

  .awp-checkout-modal-close {
    width: 44px;
    height: 44px;
  }

  .awp-checkout-modal-footer button {
    min-height: 44px;
  }
}

.awp-checkout-modal-footer button.awp-checkout-secondary-btn {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.awp-checkout-modal-footer button.awp-checkout-secondary-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #111827;
}

.awp-checkout-modal-footer button.awp-checkout-secondary-btn:active {
  transform: scale(0.98);
}

/**
 * Checkout Order Summary
 */
.awp-checkout-order-summary {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 20px;
  overflow: hidden;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100%;
  box-sizing: border-box;
}

.awp-checkout-order-empty {
  padding: 20px 16px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.awp-checkout-order-summary-header {
  padding: 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.awp-checkout-order-summary-title {
  font-size: 18px;
  font-weight: 900;
  color: #111827;
  margin: 0;
}

/* Products List */
.awp-checkout-order-products {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.awp-checkout-order-products-header {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.awp-checkout-order-products-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.awp-checkout-order-product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
}

.awp-checkout-order-product-name {
  color: #374151;
  font-weight: 500;
}

.awp-checkout-order-product-price {
  color: #111827;
  font-weight: 500;
}

/* Order Rows */
.awp-checkout-order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid #e5e7eb;
}

.awp-checkout-order-row span:first-child {
  color: #374151;
  font-weight: 500;
}

.awp-checkout-order-row span:last-child {
  color: #111827;
  font-weight: 500;
}

.awp-checkout-order-total {
  font-size: 16px;
  font-weight: 900;
  color: #111827;
  border-top: 2px solid #e5e7eb;
  border-bottom: none;
}

/* Shipping Section */
.awp-checkout-order-shipping {
  border-bottom: 1px solid #e5e7eb;
}

.awp-checkout-order-shipping-label {
  font-weight: 500;
  padding-bottom: 12px;
}

.awp-checkout-order-shipping-methods {
  padding: 0 16px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.awp-checkout-order-shipping-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 0;
  font-size: 14px;
}

.awp-checkout-order-shipping-option input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #3b82f6;
  margin: 0;
  flex-shrink: 0;
}

.awp-checkout-order-shipping-option-label {
  flex: 1;
  color: #374151;
}

.awp-checkout-order-shipping-option.selected
  .awp-checkout-order-shipping-option-label {
  font-weight: 500;
  color: #111827;
}

/* Payment Section */
.awp-checkout-order-payment {
  border-bottom: 1px solid #e5e7eb;
}

.awp-checkout-order-payment-label {
  font-weight: 500;
  padding-bottom: 12px;
}

.awp-checkout-order-payment-methods {
  padding: 0 16px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.awp-checkout-order-payment-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 10px 0;
  font-size: 14px;
}

.awp-checkout-order-payment-option input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #3b82f6;
  margin: 0;
  flex-shrink: 0;
  margin-top: 2px;
}

.awp-checkout-order-payment-option-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.awp-checkout-order-payment-option-label strong {
  color: #111827;
  font-weight: 500;
}

.awp-checkout-order-payment-option.selected
  .awp-checkout-order-payment-option-label
  strong {
  color: #3b82f6;
}

.awp-checkout-order-payment-option-desc {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
}

.awp-checkout-order-payment-option.selected
  .awp-checkout-order-payment-option-desc {
  color: #374151;
}

/**
 * Sipariş oluşturma sırasında gösterilen tam ekran yükleme katmanı (calculator.js).
 * .awp-checkout-overlay (10000100), .awp-checkout-screen-modal (10000101),
 * module-rulo enterprise (10000201) üstünde olmalı.
 */
#order-loading-modal-root {
  z-index: 10006000 !important;
}
