/* ========================================
   MODEL VIEWER STYLES
   Tropical Tidbits-inspired design (Light Theme)
   ======================================== */

/* Model Viewer Container */
.model-viewer {
  min-height: calc(100vh - 200px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  max-width: 1260px;
  margin: 0 auto;
}

/* ========================================
   MODEL SELECTION BAR
   ======================================== */
.model-bar {
  background: var(--bg);
  padding: 8px 0 0;
  position: sticky;
  top: 88px;
  z-index: 100;
  margin-bottom: -1px; /* Connect to viewer below */
}

.model-bar__container {
  background: #fff;
  border: 1px solid var(--ring);
  border-radius: 16px 16px 0 0;
  border-bottom: none;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Model Dropdowns Container */
.model-dropdowns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Individual Dropdown */
.model-dropdown {
  position: relative;
}

/* Dropdown Toggle Button - Matches Navbar Style */
.model-dropdown__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(4, 120, 87, 0.3);
  border-radius: 10px;
  padding: 10px 16px;
  color: var(--brand);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(4, 120, 87, 0.1);
  font-family: inherit;
  min-width: 120px;
  justify-content: space-between;
}

.model-dropdown__toggle:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--ink);
  border-color: rgba(4, 120, 87, 0.5);
  box-shadow: 0 4px 8px rgba(4, 120, 87, 0.15);
}

.model-dropdown__toggle:active {
  box-shadow: 0 1px 2px rgba(4, 120, 87, 0.1);
}

.model-dropdown__toggle[aria-expanded="true"] {
  background: rgba(4, 120, 87, 0.08);
  border-color: var(--brand);
  color: var(--brand);
  border-radius: 10px 10px 0 0;
}

.model-dropdown__icon {
  font-size: 10px;
  transition: transform 0.2s ease;
  color: var(--brand);
}

.model-dropdown__toggle:hover .model-dropdown__icon {
  color: var(--ink);
}

.model-dropdown__toggle[aria-expanded="true"] .model-dropdown__icon {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.model-dropdown__menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid rgba(4, 120, 87, 0.3);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

.model-dropdown__menu--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Dropdown Items */
.model-dropdown__item {
  display: block;
  padding: 12px 16px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid rgba(4, 120, 87, 0.1);
  transition: all 0.15s ease;
}

.model-dropdown__item:last-child {
  border-bottom: none;
}

.model-dropdown__item:hover {
  background: rgba(4, 120, 87, 0.08);
  color: var(--brand);
}

.model-dropdown__item--active {
  background: var(--brand);
  color: #fff;
}

.model-dropdown__item-name {
  display: block;
}

/* Pro model items in dropdown */
.model-dropdown__item--pro .model-dropdown__item-name {
  color: rgb(205, 175, 115);
}
.model-dropdown__item--pro:hover .model-dropdown__item-name {
  color: rgb(185, 155, 95);
}
.model-dropdown__item--pro .pro-label {
  font-size: 0.7em;
  font-weight: 700;
  color: rgb(205, 175, 115);
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Right Side of Model Bar */
.model-bar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Region Dropdown */
.region-dropdown {
  min-width: 120px;
}

.region-dropdown .model-dropdown__toggle {
  min-width: 120px;
}

.region-dropdown .model-dropdown__menu {
  max-height: 400px;
  overflow-y: auto;
}

/* Variable Dropdown */
.variable-dropdown {
  min-width: 140px;
}

.variable-dropdown .model-dropdown__toggle {
  min-width: 140px;
}

.variable-dropdown .model-dropdown__menu {
  max-height: 400px;
  overflow-y: auto;
  min-width: 220px;
}

/* Grouped dropdown menu */
.model-dropdown__menu--grouped {
  min-width: 220px;
}

/* Group headers in dropdown */
.model-dropdown__group-header {
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: #f9fafb;
  border-bottom: 1px solid rgba(4, 120, 87, 0.1);
  position: sticky;
  top: 0;
}

.model-dropdown__group-header:not(:first-child) {
  border-top: 1px solid rgba(4, 120, 87, 0.15);
  margin-top: 4px;
}

/* Unit Toggle */
.unit-toggle {
  display: flex;
  border: 1px solid rgba(4, 120, 87, 0.3);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.unit-toggle__btn {
  background: #fff;
  border: none;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.unit-toggle__btn:first-child {
  border-right: 1px solid rgba(4, 120, 87, 0.2);
}

.unit-toggle__btn:hover {
  background: rgba(4, 120, 87, 0.05);
  color: var(--brand);
}

.unit-toggle__btn--active {
  background: var(--brand);
  color: #fff;
}

.unit-toggle__btn--active:hover {
  background: #047857;
  color: #fff;
}

/* Current Model Display */
.model-bar__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.model-bar__current {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--ring);
  border-radius: 6px;
  white-space: nowrap;
}

/* Active dropdown item */
.model-dropdown__item--active {
  background: rgba(4, 120, 87, 0.08);
  color: var(--brand);
  font-weight: 600;
}

.model-dropdown__item--active::before {
  content: '✓';
  margin-right: 8px;
  font-weight: bold;
}

/* ========================================
   MODEL DISPLAY AREA
   ======================================== */
.model-display {
  flex: 1;
  background: var(--bg);
  padding: 20px 0;
}

.model-display__container {
  max-width: 1260px;
  margin: 0 auto;
  min-height: 600px;
}

/* Placeholder Content */
.model-display__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 600px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--ring);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.model-display__placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(4, 120, 87, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(52, 152, 219, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

.placeholder-content {
  text-align: center;
  padding: 40px;
  position: relative;
  z-index: 1;
}

.placeholder-icon {
  font-size: 80px;
  color: var(--brand);
  margin-bottom: 24px;
  opacity: 0.7;
}

.placeholder-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 16px;
}

.placeholder-text {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 32px;
  max-width: 500px;
}

.placeholder-models {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
}

.placeholder-category {
  background: var(--bg);
  border: 1px solid var(--ring);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--ink);
  font-size: 14px;
}

.placeholder-category strong {
  color: var(--brand);
}

.placeholder-category--ai {
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.1) 0%, rgba(8, 145, 178, 0.1) 100%);
  border-color: #00d4aa;
}

.placeholder-category--ai strong {
  color: #00a884;
}

/* Featured Model Quick Link */
.featured-model-link {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #00d4aa 0%, #0891b2 100%);
  color: #fff;
  text-decoration: none;
  padding: 16px 24px;
  border-radius: 12px;
  margin: 0 auto 24px;
  max-width: 320px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.3);
}

.featured-model-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 212, 170, 0.4);
  background: linear-gradient(135deg, #00ffcc 0%, #22d3ee 100%);
}

.featured-model-icon {
  font-size: 2rem;
}

.featured-model-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  flex: 1;
}

.featured-model-text strong {
  font-size: 1.1rem;
  font-weight: 700;
}

.featured-model-text small {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-top: 2px;
}

.featured-model-link i {
  font-size: 1rem;
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.featured-model-link:hover i {
  transform: translateX(4px);
  opacity: 1;
}

/* Model Image Display */
.model-display__image {
  min-height: 600px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--ring);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.model-display__image img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   MODEL INFO BAR
   ======================================== */
.model-info-bar {
  background: var(--bg);
  padding: 0 0 20px;
}

.model-info-bar__container {
  background: #fff;
  border: 1px solid var(--ring);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 12px 16px;
  display: flex;
  justify-content: center;
}

.model-info-bar__item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.model-info-bar__item i {
  color: var(--brand);
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */
@media (max-width: 768px) {
  .model-bar {
    top: 72px;
  }
  
  .model-bar__container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .model-dropdowns {
    justify-content: center;
  }
  
  .model-dropdown__toggle {
    padding: 12px 20px;
    font-size: 15px;
    min-width: 110px;
  }
  
  .model-bar__right {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .model-bar__info {
    justify-content: center;
  }
  
  .model-display {
    padding: 12px;
  }
  
  .model-display__container {
    min-height: 400px;
  }
  
  .model-display__placeholder {
    min-height: 400px;
  }
  
  .placeholder-icon {
    font-size: 60px;
  }
  
  .placeholder-title {
    font-size: 1.5rem;
  }
  
  .placeholder-text {
    font-size: 1rem;
  }
  
  .placeholder-models {
    gap: 8px;
  }
  
  .placeholder-category {
    padding: 10px 12px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .model-bar {
    top: 68px;
  }
  
  .model-dropdowns {
    width: 100%;
    flex-direction: column;
  }
  
  .model-dropdown {
    width: 100%;
  }
  
  .model-dropdown__toggle {
    width: 100%;
    justify-content: space-between;
  }
  
  .model-dropdown__menu {
    width: 100%;
    min-width: unset;
  }
  
  .placeholder-content {
    padding: 24px 16px;
  }
  
  .placeholder-icon {
    font-size: 48px;
  }
  
  .placeholder-title {
    font-size: 1.25rem;
  }
}


/* ========================================
   ANIMATION ENHANCEMENTS
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.model-display__placeholder {
  animation: fadeIn 0.5s ease-out;
}

.placeholder-icon {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ========================================
   WRAP UTILITY (matches site max-width)
   ======================================== */
.model-display .wrap,
.model-bar .wrap,
.model-info-bar .wrap {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ========================================
   FRAME VIEWER STYLES (Light Theme)
   ======================================== */

/* Outer Section */
.frame-viewer-viewer-section {
  background: var(--bg);
  padding: 0 0 20px 0;
}

/* Unified Container with Rounded Edges */
.frame-viewer-viewer-container {
  max-width: 1260px;
  width: 100%;
  margin: 0 auto;
  background: #fff;
  border-radius: 0 0 16px 16px;
  border: 1px solid var(--ring);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.frame-viewer-frame-wrapper {
  position: relative;
  background: #f9fafb;
  overflow: hidden;
  aspect-ratio: 1487 / 811;
}

.frame-viewer-frame-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.2s ease;
}

.frame-viewer-frame-image.loading {
  opacity: 0.6;
}

/* Initial state - completely hidden until first image loads */
.frame-viewer-frame-image.initial-load {
  opacity: 0;
}

.frame-viewer-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--brand);
  font-size: 1.1rem;
  font-weight: 500;
}

.frame-viewer-loading.visible {
  display: flex;
}

.frame-viewer-loading i {
  font-size: 2rem;
}

/* Controls Bar (inside container) */
.frame-viewer-controls {
  background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
  padding: 16px 20px;
  border-top: 1px solid var(--ring);
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Playback Buttons */
.frame-viewer-playback {
  display: flex;
  align-items: center;
  gap: 8px;
}

.frame-viewer-btn {
  background: #fff;
  border: 2px solid var(--ring);
  border-radius: 8px;
  color: var(--ink);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.frame-viewer-btn:hover {
  background: #f9fafb;
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.frame-viewer-btn--play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--brand) 0%, #047857 100%);
  border-color: var(--brand);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 2px 8px rgba(4, 120, 87, 0.3);
}

.frame-viewer-btn--play:hover {
  background: linear-gradient(180deg, #059669 0%, var(--brand) 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(4, 120, 87, 0.4);
}

.frame-viewer-btn--play.playing {
  background: linear-gradient(180deg, #6ee7b7 0%, #34d399 100%);
  border-color: #34d399;
}

.frame-viewer-btn--play.playing:hover {
  background: linear-gradient(180deg, #a7f3d0 0%, #6ee7b7 100%);
  box-shadow: 0 4px 16px rgba(52, 211, 153, 0.4);
}

/* Slider */
.frame-viewer-slider-wrapper {
  flex: 1;
  min-width: 280px;
  max-width: 500px;
  align-self: center;
  margin-top: 6px;
}

.frame-viewer-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  background: linear-gradient(90deg, #e5e7eb 0%, #d1d5db 100%);
  border-radius: 5px;
  outline: none;
  cursor: pointer;
  border: 1px solid var(--ring);
}

.frame-viewer-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: linear-gradient(180deg, var(--brand) 0%, #047857 100%);
  border-radius: 50%;
  cursor: grab;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.4);
  transition: all 0.2s ease;
}

.frame-viewer-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.5);
}

.frame-viewer-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.frame-viewer-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: linear-gradient(180deg, var(--brand) 0%, #047857 100%);
  border-radius: 50%;
  cursor: grab;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.4);
}

.frame-viewer-slider-ticks {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px 0;
}

.tick-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Frame Counter & Speed */
.frame-viewer-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.frame-viewer-speed {
  display: flex;
  align-items: center;
  gap: 8px;
}

.frame-viewer-speed-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.frame-viewer-speed-select {
  background: #fff;
  border: 1px solid var(--ring);
  border-radius: 6px;
  color: var(--ink);
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}

.frame-viewer-speed-select:hover {
  border-color: var(--brand);
}

.frame-viewer-speed-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

/* Single frame mode - hide playback controls */
.frame-viewer-controls.single-frame .frame-viewer-playback,
.frame-viewer-controls.single-frame .frame-viewer-slider-wrapper,
.frame-viewer-controls.single-frame .frame-viewer-speed {
  display: none;
}

.frame-viewer-controls.single-frame {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .frame-viewer-viewer-section {
    padding: 12px;
  }
  
  .frame-viewer-controls {
    flex-direction: column;
    gap: 16px;
  }
  
  .frame-viewer-slider-wrapper {
    width: 100%;
    min-width: unset;
    max-width: 100%;
    order: -1;
  }
  
  .frame-viewer-playback {
    order: 0;
  }
  
  .frame-viewer-meta {
    order: 1;
    justify-content: center;
  }
  
  .frame-viewer-btn {
    width: 40px;
    height: 40px;
  }
  
  .frame-viewer-btn--play {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 480px) {
  .frame-viewer-viewer-section {
    padding: 8px;
  }
  
  .frame-viewer-controls {
    padding: 12px;
  }
  
  .frame-viewer-meta {
    flex-direction: column;
    gap: 10px;
  }
}
