/* ============================================
   YOOSTUDIO V2 — PANEL LAYOUT
   sims.html / Theory/index.html panel system
   ============================================ */

/* ---- Reset for panel pages ---- */
html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100%;
  background: var(--color-obsidian);
}

/* ============================================
   PANEL CONTAINER
   ============================================ */

#panel {
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: var(--panel-width);
  height: 100%;
  overflow: hidden;
  background: var(--color-surface-1);
  border-right: 1px solid var(--color-glass-border);
  display: flex;
  flex-direction: column;
}

/* ============================================
   PANEL HEADER
   ============================================ */

#panel #header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-base);
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-glass-border);
  flex-shrink: 0;
  gap: var(--space-sm);
}

#panel #header h1 {
  flex: 1;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

#panel #header h1 a {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-white);
  text-decoration: none;
  text-shadow: none;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 2px;
}

#panel #header h1 a sup {
  font-size: 9px;
  font-weight: 500;
  color: var(--color-cyan);
  vertical-align: super;
}

/* Section tabs: Theory / Sims */
#panel #sections {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

#panel #sections a,
#panel #sections span.selected {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-tooltip);
  text-decoration: none;
  transition: all var(--duration-fast);
  white-space: nowrap;
}

#panel #sections a {
  color: var(--color-zinc);
}

#panel #sections a:hover {
  color: var(--color-off-white);
  background: rgba(255, 255, 255, 0.05);
}

#panel #sections span.selected {
  color: var(--color-cyan);
  background: var(--color-cyan-muted);
}

/* Expand (hamburger) button */
#panel #expandButton {
  width: 32px;
  height: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-tooltip);
  flex-shrink: 0;
  transition: border-color var(--duration-fast);
}

#panel #expandButton:hover {
  border-color: var(--color-glass-border-hover);
}

#panel #expandButton::before,
#panel #expandButton::after,
#panel #expandButton span {
  content: '';
  display: block;
  width: 14px;
  height: 1.5px;
  background: var(--color-silver);
  border-radius: 2px;
}

/* Panel scrim (mobile overlay) */
#panelScrim {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

#panel.open ~ #panelScrim {
  display: block;
}

/* ============================================
   CONTENT WRAPPER (search + list)
   ============================================ */

#contentWrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* Search input wrapper */
#inputWrapper {
  padding: var(--space-md) var(--space-base);
  border-bottom: 1px solid var(--color-glass-border);
  position: relative;
  flex-shrink: 0;
}

#filterInput {
  width: 100%;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--color-off-white);
  background: var(--color-glass);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-btn-sm);
  padding: var(--space-sm) var(--space-2xl) var(--space-sm) var(--space-md);
  outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  -webkit-appearance: none;
}

#filterInput::placeholder {
  color: var(--color-zinc);
}

#filterInput:focus {
  border-color: rgba(0, 229, 204, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 229, 204, 0.1);
}

/* Exit search button (X) */
#exitSearchButton {
  position: absolute;
  right: calc(var(--space-base) + 8px);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-zinc);
  font-size: 16px;
  transition: color var(--duration-fast);
}

#exitSearchButton::before {
  content: '✕';
  font-size: 13px;
}

#exitSearchButton:hover {
  color: var(--color-off-white);
}

.searchFocused #exitSearchButton {
  display: flex;
}

/* ============================================
   CONTENT LIST (cards)
   ============================================ */

#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-sm) var(--space-sm);
}

/* Custom scrollbar */
#content::-webkit-scrollbar {
  width: 4px;
}

#content::-webkit-scrollbar-track {
  background: transparent;
}

#content::-webkit-scrollbar-thumb {
  background: var(--color-ghost);
  border-radius: 2px;
}

#content::-webkit-scrollbar-thumb:hover {
  background: var(--color-zinc);
}

/* Category section headers */
#content h2 {
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-cyan);
  padding: var(--space-base) var(--space-sm) var(--space-xs);
  margin: 0;
  border-bottom: 1px solid rgba(0, 229, 204, 0.1);
  margin-bottom: var(--space-xs);
}

#content h2:first-child {
  padding-top: var(--space-sm);
}

/* Cards */
#content .card {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-tooltip);
  overflow: hidden;
  margin-bottom: 2px;
  transition: all var(--duration-fast) var(--ease-spring);
}

#content .card:hover {
  background: var(--color-glass);
  border-color: var(--color-glass-border);
}

#content .card.selected {
  background: var(--color-cyan-muted);
  border-color: var(--color-glass-border-active);
}

#content .card a {
  display: block;
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
}

#content .card .title {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-silver);
  background: transparent;
  text-transform: none;
  text-shadow: none;
  padding: 0;
  margin: 0;
  line-height: 1.4;
  transition: color var(--duration-fast);
  display: block;
}

#content .card:hover .title {
  color: var(--color-white);
}

#content .card.selected .title {
  color: var(--color-cyan);
}

/* Preview image in cards (sims panel) */
#content .card img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  display: block;
  filter: brightness(0.75);
  transition: filter var(--duration-normal);
  border-radius: calc(var(--radius-tooltip) - 1px) calc(var(--radius-tooltip) - 1px) 0 0;
}

#content .card:hover img {
  filter: brightness(0.95);
}

/* Previews toggler (thumbnail toggle button) */
#previewsToggler {
  display: none;
}

/* ============================================
   IFRAME VIEWER
   ============================================ */

#viewer,
iframe#viewer {
  position: fixed;
  left: var(--panel-width);
  top: 0;
  width: calc(100% - var(--panel-width));
  height: 100%;
  border: none;
  background: var(--color-obsidian);
  display: block;
}

/* ============================================
   VIEW SOURCE BUTTON
   ============================================ */

#button {
  position: fixed;
  z-index: 200;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 17, 24, 0.9);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-btn-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-decoration: none;
  transition: all var(--duration-fast);
}

#button:hover {
  border-color: rgba(0, 229, 204, 0.3);
  background: rgba(0, 229, 204, 0.05);
}

#button img {
  width: 20px;
  height: 20px;
  filter: invert(1) opacity(0.6);
}

#button:hover img {
  filter: invert(1) opacity(1);
}

/* ============================================
   MINIMAL MODE (Theory — text-only cards)
   ============================================ */

#content.minimal .card {
  border-left: 2px solid transparent;
  border-radius: 0;
  margin-bottom: 0;
  border-top: none;
  border-right: none;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

#content.minimal .card:hover {
  border-left-color: rgba(0, 229, 204, 0.4);
  background: var(--color-glass);
  border-radius: var(--radius-tooltip);
}

#content.minimal .card.selected {
  border-left-color: var(--color-cyan);
}

/* ============================================
   RESPONSIVE — MOBILE PANEL
   ============================================ */

@media (max-width: 640px) {
  #panel {
    width: 100%;
    height: var(--header-height);
    overflow: hidden;
    transition: height 0.2s var(--ease-smooth);
    z-index: 200;
  }

  #panel.open {
    height: 100%;
    overflow: auto;
    transition: height 0s;
  }

  #panel #header {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  #viewer,
  iframe#viewer {
    left: 0;
    top: var(--header-height);
    width: 100%;
    height: calc(100% - var(--header-height));
  }

  #panelScrim {
    display: none !important;
  }

  #panel.open ~ #panelScrim {
    display: none !important;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  :root {
    --panel-width: 260px;
  }
}
