/* ============================================================
   QR Information Hub — Style
   Dark Mode · Glassmorphism · Mobile First · Responsive
   ============================================================ */

/* ----- CSS Custom Properties ----- */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;
  --accent: #6c63ff;
  --accent-hover: #857dff;
  --accent-glow: rgba(108, 99, 255, 0.25);
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.4);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ----- Reset & Base ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(108, 99, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(52, 211, 153, 0.05) 0%, transparent 50%);
}

/* ----- App Container ----- */
.app-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ----- Card ----- */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  animation: cardIn 0.5s ease both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hidden {
  display: none !important;
}

/* ----- Card Icon ----- */
.card-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.75rem;
  color: var(--accent);
}

.card-icon svg {
  width: 32px;
  height: 32px;
}

/* ----- Card Title ----- */
.card-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ----- Card Body ----- */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ----- Card Meta (type badge) ----- */
.card-meta {
  margin-top: 1.25rem;
  text-align: center;
}

.type-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  background: var(--accent-glow);
  color: var(--accent);
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  width: 100%;
  color: #fff;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-success {
  background: var(--success);
  color: #0f0f1a;
}

.btn-success:hover,
.btn-success:focus-visible {
  filter: brightness(1.1);
}

.btn-warning {
  background: var(--warning);
  color: #0f0f1a;
}

.btn-warning:hover,
.btn-warning:focus-visible {
  filter: brightness(1.1);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  background: rgba(255, 255, 255, 0.05);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-row .btn {
  flex: 1 1 auto;
  min-width: 0;
}

.btn-row.two-col .btn {
  flex: 1 1 calc(50% - 0.25rem);
}

/* ----- Info Row ----- */
.info-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.info-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.info-row-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.info-row-icon svg {
  width: 20px;
  height: 20px;
}

.info-row-content {
  flex: 1;
  min-width: 0;
}

.info-row-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.info-row-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

/* ----- Text Content ----- */
.text-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
  text-align: center;
  padding: 0.5rem 0;
}

/* ----- Image / Media ----- */
.media-image {
  width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
}

.media-image:hover {
  transform: scale(1.02);
}

.media-image.error {
  display: none;
}

.media-fallback {
  display: none;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.media-fallback.visible {
  display: block;
}

/* ----- Embed Container ----- */
.embed-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.embed-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ----- Audio Player ----- */
.audio-player {
  width: 100%;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.audio-player::-webkit-media-controls-panel {
  background: rgba(255, 255, 255, 0.05);
}

.audio-fallback {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}

/* ----- Video Player ----- */
.video-player {
  width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  background: #000;
}

/* ----- PDF Preview ----- */
.pdf-preview {
  width: 100%;
  height: 400px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.02);
}

/* ----- Event Card ----- */
.event-detail {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

.event-detail-icon {
  flex-shrink: 0;
  color: var(--accent);
}

.event-detail-icon svg {
  width: 20px;
  height: 20px;
}

.event-detail-text {
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* ----- Product ----- */
.product-image-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 75%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 0.5rem;
}

.product-image-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin: 0.5rem 0;
}

.product-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
}

/* ----- Password Toggle ----- */
.password-field {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-family: monospace;
}

.password-field .info-row-content {
  padding: 0.75rem 1rem;
}

.password-toggle {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.password-toggle:hover {
  color: var(--text-primary);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

/* ----- Fields (Generic Info) ----- */
.fields-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

.field-key {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.field-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

/* ----- Loader / Spinner ----- */
#loading-state {
  text-align: center;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

.loading-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ----- Skeleton ----- */
.skeleton-card {
  animation: none;
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.07) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  margin: 0 auto 1rem;
}

.skeleton-title {
  width: 60%;
  height: 24px;
  margin: 0 auto 1.25rem;
}

.skeleton-line {
  width: 100%;
  height: 16px;
  margin-bottom: 0.75rem;
}

.skeleton-line.short {
  width: 70%;
}

.skeleton-btn {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
}

/* ----- Error State ----- */
.error-card {
  text-align: center;
}

.error-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  color: var(--error);
}

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

.error-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.error-message {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ----- Toast ----- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  padding: 0.75rem 1.25rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* ----- Zoom Overlay ----- */
.zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 2rem;
  cursor: zoom-out;
}

.zoom-overlay img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  cursor: default;
}

.zoom-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.zoom-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ----- Footer ----- */
.footer-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.footer-actions .btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.footer-actions .btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.footer-actions .btn-icon svg {
  width: 18px;
  height: 18px;
}

/* ----- Responsive ----- */
@media (min-width: 600px) {
  body {
    padding: 2rem;
  }

  .card {
    padding: 2.5rem 2rem;
  }

  .btn-row.two-col .btn {
    min-width: 140px;
  }
}

@media (min-width: 900px) {
  .app-container {
    max-width: 520px;
  }
}

/* ----- Focus ----- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ----- Selection ----- */
::selection {
  background: var(--accent-glow);
  color: #fff;
}
