/* App Global Styles, Mobile Optimizations & Toast System */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --correct-color: #10b981;
  --wrong-color: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  background-color: #f8fafc;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Touch Friendly Option Buttons */
.option-btn {
  transition: all 0.15s ease-in-out;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.option-btn:hover {
  border-color: #93c5fd;
}

.option-btn:active {
  transform: scale(0.99);
}

.option-btn.selected {
  border-color: #2563eb !important;
  background-color: #eff6ff !important;
  box-shadow: 0 0 0 1px #2563eb;
}

.option-btn.correct {
  border-color: #10b981 !important;
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
}

.option-btn.wrong {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  color: #991b1b !important;
}

/* Question Grid Matrix Badge */
.q-matrix-dot {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  color: #64748b;
}

.q-matrix-dot:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.q-matrix-dot.current {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.q-matrix-dot.dot-answered {
  background-color: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

.q-matrix-dot.dot-correct {
  background-color: #10b981;
  border-color: #059669;
  color: #ffffff;
}

.q-matrix-dot.dot-wrong {
  background-color: #ef4444;
  border-color: #dc2626;
  color: #ffffff;
}

/* Mobile Bottom Navigation & Action Bar */
@media (max-width: 768px) {
  .mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid #e2e8f0;
    z-index: 40;
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }

  .main-content-padding {
    padding-bottom: 90px;
  }
}

/* Animation utilities */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.2s ease-out forwards;
}

/* Toast Container & Notification Item */
#toast-container {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  min-width: 280px;
  max-width: 90vw;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  animation: toastSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.2s ease;
}

@keyframes toastSlideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-item.toast-out {
  opacity: 0;
  transform: translateY(-8px);
}

.toast-info {
  background-color: #1e293b;
  color: #ffffff;
}

.toast-success {
  background-color: #065f46;
  color: #ffffff;
}

.toast-error {
  background-color: #991b1b;
  color: #ffffff;
}

.toast-warning {
  background-color: #854d0e;
  color: #ffffff;
}

/* Modal overlay */
.modal-overlay {
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

/* Print Area - Strictly Hidden on Screen to avoid showing on screen bottom */
#print-area {
  display: none !important;
}

@media print {
  #print-area {
    display: block !important;
    visibility: visible !important;
  }
}

