/**
 * Modal Components Styles
 * Consistent modal design patterns across the application
 */

/* ============================================
   CREDITS MODAL
   ============================================ */

.credits-modal {
  opacity: 0;
  transform: scale(0.95) translateY(-20px);
}

.custom-modal-overlay.active .credits-modal {
  animation: customSlideIn 0.3s ease forwards;
}

.custom-modal-overlay.closing .credits-modal {
  animation: customSlideOut 0.3s ease forwards;
}

/* ============================================
   CUSTOM MODALS (Alert/Confirm/Prompt)
   ============================================ */

.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.custom-modal-overlay.active {
  opacity: 1;
}

.custom-modal-content {
  background: var(--color-bg, #181e29);
  border-radius: 12px;
  padding: 0;
  max-width: 450px;
  max-height: 80vh;
  width: 90%;
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: scale(0.95) translateY(-20px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.custom-modal-overlay.active .custom-modal-content {
  animation: customSlideIn 0.3s ease forwards;
}

.custom-modal-overlay.closing .custom-modal-content {
  animation: customSlideOut 0.3s ease forwards;
}

.custom-modal-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-modal-header h3 {
  margin: 0;
  color: var(--color-text, #fff);
  font-size: 1.05rem;
  font-weight: 600;
}

/* Custom Modal Icons with SVG support */
.custom-modal-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-modal-icon.info {
  color: var(--color-accent, #2196f3);
}

.custom-modal-icon.confirm {
  color: #ff9800;
}

.custom-modal-icon.success {
  color: #4caf50;
}

.custom-modal-icon.error {
  color: #f44336;
}

.custom-modal-icon.warning {
  color: #ff9800;
}

.custom-modal-icon svg {
  width: 100%;
  height: 100%;
}

.custom-modal-message {
  color: var(--color-text-secondary, #bfcfff);
  line-height: 1.5;
  font-size: 0.9rem;
  margin: 0;
}

.custom-modal-body {
  padding: 16px 18px;
  color: var(--color-text, #fff);
  line-height: 1.5;
  overflow-y: auto;
  flex: 1;
  max-height: calc(80vh - 140px);
}

/* Custom scrollbar for popup body */
.custom-modal-body::-webkit-scrollbar {
  width: 6px;
}

.custom-modal-body::-webkit-scrollbar-track {
  background: rgba(var(--color-border-base), 0.05);
  border-radius: 3px;
}

.custom-modal-body::-webkit-scrollbar-thumb {
  background: rgba(var(--color-border-base), 0.2);
  border-radius: 3px;
}

.custom-modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--color-border-base), 0.3);
}

.custom-modal-body p {
  margin: 0 0 16px 0;
}

.custom-modal-body p:last-child {
  margin-bottom: 0;
}

.custom-modal-body label {
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.custom-modal-footer {
  padding: 14px 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid rgba(var(--color-border-base), 0.1);
}

.custom-modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.custom-modal-btn-primary {
  background: var(--color-accent, #2196f3);
  color: white;
}

.custom-modal-btn-primary:hover {
  background: var(--color-accent-hover, #1976d2);
  transform: translateY(-1px);
}

.custom-modal-btn-secondary {
  background: rgba(var(--color-border-base), 0.1);
  color: var(--color-text, #fff);
}

.custom-modal-btn-secondary:hover {
  background: rgba(var(--color-border-base), 0.15);
}

.custom-modal-btn-success {
  background: #4caf50;
  color: white;
}

.custom-modal-btn-success:hover {
  background: #45a049;
  transform: translateY(-1px);
}

.custom-modal-btn-danger {
  background: #f44336;
  color: white;
}

.custom-modal-btn-danger:hover {
  background: #d32f2f;
  transform: translateY(-1px);
}

/* Custom Modal Select Styling */
.custom-modal-body select:hover {
  border-color: var(--color-accent, #2196f3);
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.custom-modal-body select:focus {
  outline: none;
  border-color: var(--color-accent, #2196f3);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

/* Custom Modal Input/Textarea Styling (for customPrompt and customConfirm with fields) */
.custom-modal-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(var(--color-border-base), 0.05);
  border: 1px solid rgba(var(--color-border-base), 0.15);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s;
  box-sizing: border-box;
}

.custom-modal-input:focus {
  outline: none;
  border-color: var(--color-accent, #2196f3);
  box-shadow: 0 0 10px rgba(33, 150, 243, 0.3);
}

.custom-modal-input::placeholder {
  color: rgba(var(--color-border-base), 0.4);
}

select.custom-modal-input {
  cursor: pointer;
}

textarea.custom-modal-input {
  resize: vertical;
  min-height: 80px;
}

/* ============================================
   MODALS
   ============================================ */

/* delivery modal */

/* tracking modal */

#order-tracking-modal.modal-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: customFadeIn 0.2s ease-out;
  backdrop-filter: blur(4px);
}

.order-tracking-modal {
  background: var(--color-bg, #181e29);
  border-radius: 12px;
  padding: 0;
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  border: 1px solid var(--color-border, #686868);
  animation: customSlideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.order-tracking-modal .modal-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border, #686868);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface, #232a3a);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.order-tracking-modal .modal-header h3 {
  margin: 0;
  color: var(--color-text, #fff);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.order-tracking-modal .modal-header h3 i {
  color: var(--color-accent, #2196f3);
  font-size: 1.2rem;
}

.order-tracking-modal .modal-close {
  background: rgba(var(--color-border-base), 0.1);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--color-text, #fff);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.order-tracking-modal .modal-close:hover {
  background: rgba(var(--color-border-base), 0.15);
  transform: scale(1.05);
}

.order-tracking-modal .modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.order-tracking-modal .modal-body::-webkit-scrollbar {
  width: 6px;
}

.order-tracking-modal .modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.order-tracking-modal .modal-body::-webkit-scrollbar-thumb {
  background: var(--color-accent, #2196f3);
  border-radius: 3px;
}

.order-tracking-modal .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent-hover, #1976d2);
}

/* TRACKING ORDER INFO SECTION */
.tracking-order-info {
  text-align: center;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--color-surface, #232a3a);
  border-radius: 8px;
  border: 1px solid rgba(var(--color-border-base), 0.08);
}

.tracking-order-info h4 {
  margin: 0 0 4px 0;
  color: var(--color-text, #fff);
  font-size: 1rem;
  font-weight: 700;
}

.tracking-order-info p {
  margin: 0;
  color: var(--color-text-secondary, #bfcfff);
  font-size: 0.8rem;
  opacity: 0.9;
}

/* TRACKING HISTORY - COMPACT LIST */
/* there's no more timeline in the order tracking */
.tracking-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  background: rgba(var(--color-border-base), 0.05);
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--color-accent, #2196f3);
  transition: all 0.2s ease;
}

.timeline-item:hover {
  background: rgba(var(--color-border-base), 0.07);
  transform: translateX(2px);
}

.timeline-item.completed {
  border-left-color: #4caf50;
  opacity: 1;
}

.timeline-item.current {
  background: rgba(33, 150, 243, 0.15);
  border-left-color: var(--color-accent, #2196f3);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.timeline-item.pending {
  opacity: 0.5;
  border-left-color: rgba(var(--color-border-base), 0.2);
}

.timeline-status {
  font-weight: 600;
  color: var(--color-text, #fff);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.timeline-date {
  color: var(--color-text-secondary, #bfcfff);
  font-size: 0.7rem;
  font-style: italic;
  font-weight: 400;
  opacity: 0.8;
}

.timeline-description {
  color: var(--color-text-secondary, #bfcfff);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-top: 4px;
  opacity: 0.9;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .order-tracking-modal {
    max-width: 95%;
    max-height: 90vh;
  }

  .order-tracking-modal .modal-header {
    padding: 14px;
  }

  .order-tracking-modal .modal-header h3 {
    font-size: 1rem;
  }

  .order-tracking-modal .modal-body {
    padding: 16px;
  }

  .tracking-timeline {
    gap: 8px;
  }

  .timeline-item {
    padding: 10px 12px;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

/* Animations are now centralized in animations.css */
/* Import animations.css in your HTML to use:
   - customFadeIn (overlay fade)
   - customSlideIn (modal entrance)
*/

/* ============================================
   MAGIC CODE MODAL
   ============================================ */

.magic-code-modal .custom-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.magic-code-input-group {
  position: relative;
}

.magic-code-input-group input {
  width: 100%;
  padding: 14px 48px 14px 16px;
  background: rgba(var(--color-border-base), 0.05);
  border: 1px solid rgba(var(--color-border-base), 0.15);
  border-radius: 10px;
  color: var(--color-text, #e6edf3);
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  text-align: center;
}

.magic-code-input-group input:focus {
  border-color: var(--color-accent, #4dabf7);
  box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.15);
}

.magic-code-input-group input::placeholder {
  color: rgba(var(--color-border-base), 0.35);
  letter-spacing: normal;
}

.magic-code-input-group .mc-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(var(--color-border-base), 0.4);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.magic-code-input-group .mc-toggle:hover {
  color: var(--color-text, #fff);
}

.mc-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #f87171;
  font-size: 0.85rem;
  padding: 10px 12px;
  line-height: 1.4;
}

.mc-attempts {
  font-size: 0.8rem;
  color: #ff9800;
  text-align: center;
  margin: 0;
  padding: 0;
}

.mc-attempts i {
  margin-right: 4px;
  opacity: 0.7;
}
