@font-face {
  font-family: Axiforma;
  src: url('fonts/AXIFORMA/Axiforma-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Axiforma;
  src: url('fonts/AXIFORMA/Axiforma-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-page: #f4f7f6;
  --bg-surface: #ffffff;
  --bg-container: #525659;
  --text-primary: #1a1a1a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --accent-color: #00ab85;
  --accent-hover: #00896a;
  --accent-shadow: rgba(0, 171, 133, 0.2);
  --accent-bg-hover: rgba(0, 171, 133, 0.08);
  --badge-bg: #f1f5f9;
  --header-shadow: rgba(0, 0, 0, 0.05);
  --landing-viewport-bg:
    linear-gradient(105deg, rgba(5, 11, 11, 0.98) 0%, rgba(11, 26, 24, 0.88) 48%, rgba(0, 137, 106, 0.45) 100%),
    #101818;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #0a1011;
    --bg-surface: #111a1c;
    --bg-container: #1e2b2f;
    /* Darker PDF container for contrast */
    --text-primary: #f6fbf7;
    --text-secondary: #b4beb7;
    --text-muted: #64748b;
    --border-color: #2d3b3f;
    --accent-color: #277940;
    --accent-hover: #2ea04f;
    --accent-shadow: rgba(46, 160, 79, 0.2);
    --accent-bg-hover: rgba(46, 160, 79, 0.08);
    --badge-bg: #1e2b2f;
    --header-shadow: rgba(0, 0, 0, 0.3);
  }
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: 'Axiforma', sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 1 !important;
  transition: background 0.3s ease, color 0.3s ease;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

.hq-header.viewer-header {
  background: var(--bg-surface);
  box-shadow: 0 4px 20px var(--header-shadow);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
}

.hq-header.viewer-header {
  z-index: 100;
}

.viewer-container {
  flex: 1;
  position: relative;
  background: var(--bg-container);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#pdf-viewer,
#canvas-viewer {
  width: 100%;
  height: 100%;
  border: none;
}

#canvas-viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  gap: 20px;
}

.pdf-canvas-page {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  background: white;
  /* PDF content is always white */
  line-height: 0;
}

.pdf-canvas-page canvas {
  display: block;
  max-width: 100%;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.error-message {
  text-align: center;
  padding: 40px;
  color: #d32f2f;
}

.error-message i {
  font-size: 48px;
  margin-bottom: 16px;
}

@media (max-width: 400px) {
  .error-message {
    padding: 24px 16px;
  }
  .error-message i {
    font-size: 40px;
  }
}

.action-buttons {
  display: flex;
  gap: 12px;
}

.btn-action {
  background: var(--accent-color);
  color: white;
  border: 1px solid var(--accent-color);
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
  text-decoration: none;
  box-shadow: 0 2px 4px var(--accent-shadow);
  white-space: nowrap;
}

.btn-action.loading {
  opacity: 0.5;
  cursor: wait;
  pointer-events: none;
}

.btn-action:hover:not(.loading) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-3px);
  box-shadow: 0 10px 20px var(--accent-shadow);
  filter: brightness(0.9);
}

.btn-action:active {
  transform: translateY(0);
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--accent-color);
  border: 2px solid var(--accent-color);
}

.btn-outline:hover:not(.loading) {
  background: var(--accent-bg-hover);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

@media (max-width: 600px) {
  .btn-action {
    padding: 8px 12px;
    font-size: 0.85rem;
    gap: 6px;
  }

  .btn-action span {
    display: none;
  }

  .btn-action i {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .btn-action {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    min-width: 38px;
  }
  
  .hq-header.viewer-header .hq-header__actions {
    gap: 8px;
  }
  
  #landing-page {
    padding: 40px 0;
  }

  .landing-card {
    margin: 0 24px;
    gap: 20px;
  }

  .landing-logo {
    height: 42px;
  }

  .landing-content h2 {
    font-size: 1.5rem;
  }

  .landing-content p {
    font-size: 0.95rem;
  }

  .quote-badge {
    padding: 12px 20px; /* Keep consistent padding */
    box-sizing: border-box;
  }

  .quote-badge-value {
    font-size: 1.1rem;
  }

  .btn-view-quote {
    padding: 16px 24px;
    font-size: 1rem;
    box-sizing: border-box;
  }

  .btn-terms {
    padding: 14px 20px;
    font-size: 0.9rem;
    box-sizing: border-box;
  }
}

@media (max-width: 380px) {
  #landing-page {
    padding: 32px 0;
  }

  .landing-card {
    margin: 0 20px;
    gap: 16px;
  }

  .landing-logo {
    height: 36px;
  }

  .landing-content h2 {
    font-size: 1.3rem;
  }
  
  .quote-badge-value {
    font-size: 1rem;
  }
}

/* Landing Page Styles */
#landing-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px 0;
  text-align: center;
  overflow: hidden; /* Prevent page scroll */
  color: #ffffff;
  background: var(--landing-viewport-bg);
  background-attachment: fixed;
}
 
.hq-header.quote-landing-header {
  z-index: 20;
}

.landing-art {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -18svh;
  z-index: 1;
  width: 100vw;
  height: auto;
  opacity: 0.28;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent, black 60%);
  mask-image: linear-gradient(to right, transparent, black 60%);
}

@media (max-width: 480px) {
  .landing-art {
    left: auto;
    right: -50vw;
    bottom: -5svh;
    width: 160vw;
    opacity: 0.2;
  }
}

.landing-card {
  z-index: 10;
  max-width: 440px;
  width: 100%;
  margin: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  animation: fadeIn 0.8s ease-out;
  padding: 40px 24px;
  max-height: calc(100svh - 160px); /* Fit within window with margins */
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
}

@media (min-width: 1024px) {
  .landing-card {
    max-width: 580px;
    padding: 64px 48px;
    max-height: calc(100svh - 200px);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.3);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.landing-logo {
  height: 64px;
  margin-bottom: 8px;
}

.landing-content h2 {
font-family: "eurostile-extended";
  font-size: 1.8rem;
  margin: 0 0 12px 0;
  color: #ffffff;
}

.landing-content p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  line-height: 1.5;
}

.quote-badge {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quote-badge:active {
  transform: scale(0.98);
}

.quote-badge::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-20deg);
  animation: shimmer 5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  15% { left: 150%; }
  100% { left: 150%; }
}

.quote-badge-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 700;
}

.quote-badge-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  letter-spacing: 0.05em;
}

.recent-quotes {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.recent-quotes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  overflow-y: auto;
  padding-right: 4px;
  /* Custom scrollbar for premium look */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.recent-quotes-list::-webkit-scrollbar {
  width: 5px;
}

.recent-quotes-list::-webkit-scrollbar-track {
  background: transparent;
}

.recent-quotes-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.recent-quote-link {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  color: #ffffff;
  text-align: left;
  text-decoration: none;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}

.recent-quote-link:hover {
  border-color: rgba(0, 171, 133, 0.6);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.recent-quote-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: var(--accent-color);
}

.recent-quote-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-quote-content strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-quote-content strong {
  font-size: 1rem;
}

.recent-quote-content small {
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.4;
}

.recent-quotes-empty {
  margin: 0;
  padding: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  line-height: 1.5;
}

.quote-help {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.4;
}

.quote-help a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s ease;
}

.quote-help a:hover {
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.btn-view-quote {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 18px 40px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
  box-shadow: 0 10px 25px var(--accent-shadow);
  width: 100%;
  justify-content: center;
}

.landing-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.btn-view-quote.preparing {
  background: var(--text-muted);
  cursor: wait;
  box-shadow: none;
}

.btn-view-quote:hover:not(.preparing) {
  background: var(--accent-hover);
  transform: translateY(-5px);
  box-shadow: 0 20px 40px var(--accent-shadow);
  filter: brightness(0.9);
}

.btn-view-quote:active {
  transform: translateY(-1px);
}

.btn-view-quote i {
  font-size: 1.2rem;
}

.btn-terms {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 24px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
  width: 100%;
  background: var(--bg-surface);
  box-sizing: border-box;
}

.btn-terms:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: var(--badge-bg);
  transform: translateY(-3px);
  box-shadow: 0 12px 24px var(--header-shadow);
  filter: brightness(0.98);
}

.btn-terms i {
  font-size: 1.1rem;
}

.landing-footer {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 16px;
  line-height: 1.4;
}

.landing-footer span {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
}

.landing-page-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
  transform: scale(1.05);
}

.hidden {
  display: none !important;
}
