/* ==========================================================================
   RSS OPTICAL SPAIN / 株式会社ＲＳＳ　ＳＯＬＵＴＩＯＮＳ
   Component Stylesheet
   Cart Drawer, Vision Quiz, Technical Spec Tables, FAQ Accordion, Toasts
   ========================================================================== */

/* ==========================================================================
   GLOBAL SHOPPING CART DRAWER (Persistent across all pages)
   ========================================================================== */
.cart-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 43, 72, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-drawer-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  background: var(--color-bg-card);
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 2px solid var(--color-border);
}

.cart-drawer.is-active {
  transform: translateX(0);
}

.cart-drawer__header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-bg-alt);
}

.cart-drawer__title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-drawer__close {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-main);
  transition: all var(--transition-speed);
}

.cart-drawer__close:hover,
.cart-drawer__close:focus-visible {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
}

.cart-drawer__body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.cart-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}

.cart-empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  color: var(--color-border);
}

.cart-item {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-border-light);
  position: relative;
}

.cart-item__thumb {
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 70px;
  overflow: hidden;
  position: relative;
}

.cart-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item__details {
  display: flex;
  flex-direction: column;
}

.cart-item__name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.cart-item__meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.cart-item__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.cart-qty-ctrl {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.cart-qty-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-primary);
}

.cart-qty-btn:hover {
  background: var(--color-bg-alt);
}

.cart-qty-val {
  min-width: 28px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 700;
}

.cart-item__remove {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: underline;
  padding: 0.25rem;
}

.cart-item__remove:hover {
  color: #991b1b;
}

.cart-drawer__footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg-alt);
}

.cart-drawer__subtotal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-primary);
}

.cart-drawer__shipping-note {
  font-size: 0.8rem;
  color: var(--color-success);
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   INTERACTIVE VISION QUIZ (test-visual.html)
   ========================================================================== */
.quiz-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

.quiz-card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.quiz-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-light);
}

.quiz-progress__bar {
  flex-grow: 1;
  height: 8px;
  background: var(--color-bg-alt);
  border-radius: 9999px;
  margin: 0 1.25rem;
  overflow: hidden;
}

.quiz-progress__fill {
  height: 100%;
  background: var(--color-accent);
  width: 33.33%;
  transition: width 0.3s ease;
}

.quiz-header-audio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.quiz-question-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.3;
}

.btn-tts {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #eff6ff;
  color: var(--color-accent-hover);
  border: 1.5px solid var(--color-accent);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
  min-height: 44px;
  transition: all var(--transition-speed);
}

.btn-tts:hover,
.btn-tts:focus-visible {
  background-color: var(--color-accent);
  color: #ffffff;
}

.btn-tts.is-speaking {
  background-color: #fef08a;
  color: #854d0e;
  border-color: #ca8a04;
  animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(202, 138, 4, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(202, 138, 4, 0); }
  100% { box-shadow: 0 0 0 0 rgba(202, 138, 4, 0); }
}

/* Low-Vision Accessible Switches (Minimum 70px Height, 4px Outline) */
.quiz-options-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.quiz-option-tile {
  min-height: 72px;
  background-color: #ffffff;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-main);
  transition: all var(--transition-speed);
  text-align: left;
  width: 100%;
}

.quiz-option-tile:hover {
  background-color: #f0f9ff;
  border-color: var(--color-accent);
}

.quiz-option-tile:focus-visible {
  outline: 4px solid var(--focus-ring-color);
  outline-offset: 2px;
}

.quiz-option-tile.is-selected {
  border: 3px solid var(--color-accent);
  background-color: #e0f2fe;
  color: var(--color-primary-dark);
  font-weight: 800;
}

.quiz-option-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.quiz-option-tile.is-selected .quiz-option-icon {
  background: var(--color-accent);
  color: #ffffff;
}

.quiz-nav-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Dynamic Quiz Results Engine */
.quiz-results-container {
  display: none;
  animation: fadeIn 0.4s ease;
}

.quiz-results-container.is-active {
  display: block;
}

.quiz-results-badge {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  font-weight: 800;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   TECHNICAL SPECIFICATION TABLES (tienda.html / ZoomVision HD)
   ========================================================================== */
.spec-table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9375rem;
}

.spec-table th,
.spec-table td {
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--color-border-light);
}

.spec-table th {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  font-weight: 700;
  width: 40%;
}

.spec-table td {
  color: var(--color-text-main);
}

.spec-table tr:last-child th,
.spec-table tr:last-child td {
  border-bottom: none;
}

.spec-table tr:nth-child(even) td {
  background: #fafbfc;
}

/* ==========================================================================
   INCLUSIVE FAQ ACCORDION (revision.html, cita.html)
   ========================================================================== */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #ffffff;
  overflow: hidden;
  transition: border-color var(--transition-speed);
}

.faq-item:focus-within {
  border-color: var(--color-accent);
}

.faq-trigger {
  width: 100%;
  padding: 1.25rem 1.5rem;
  text-align: left;
  background: none;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background-color var(--transition-speed);
}

.faq-trigger:hover {
  background-color: var(--color-bg-alt);
}

.faq-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  color: var(--color-accent);
}

.faq-trigger[aria-expanded="true"] .faq-icon {
  transform: rotate(180deg);
}

.faq-panel {
  display: none;
  padding: 0 1.5rem 1.25rem;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.faq-panel.is-open {
  display: block;
}

/* ==========================================================================
   ACCESSIBLE TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #0f2b48;
  color: #ffffff;
  border-left: 5px solid #22c55e;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-size: 0.9375rem;
  font-weight: 600;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   MOBILE COMPONENT OVERRIDES
   ========================================================================== */
@media (max-width: 768px) {
  .quiz-card {
    padding: 1.5rem 1rem;
  }

  .toast-container {
    bottom: 5rem;
    left: 1rem;
    right: 1rem;
  }

  .toast {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
}
