/**
 * ⚡ TVH GlassUI & CSS Studio Pro - Master Stylesheet
 * LeStart Design System Architecture (Pure Vanilla CSS + Modern Nesting)
 */

@import './tokens.css';

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

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--tvh-bg-main);
  color: var(--tvh-text-primary);
  font-family: var(--tvh-font-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(6, 9, 19, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--tvh-radius-full);
  transition: background var(--tvh-transition-fast);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--tvh-primary);
}

/* App Header HUD */
.app-header {
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(12, 16, 34, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--tvh-border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;

  & .header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;

    & .brand-logo {
      width: 40px;
      height: 40px;
      border-radius: var(--tvh-radius-md);
      background: linear-gradient(135deg, var(--tvh-primary), var(--tvh-secondary));
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.25rem;
      color: #ffffff;
      box-shadow: 0 0 20px var(--tvh-primary-glow);
    }

    & .brand-meta {
      display: flex;
      flex-direction: column;

      & .brand-title {
        font-family: var(--tvh-font-heading);
        font-size: 1.15rem;
        font-weight: 800;
        letter-spacing: -0.02em;
        background: linear-gradient(135deg, #ffffff 40%, var(--tvh-text-secondary));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }

      & .brand-tagline {
        font-size: 0.72rem;
        color: var(--tvh-text-muted);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
      }
    }
  }

  & .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;

    & .nav-pill-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      border-radius: var(--tvh-radius-full);
      border: 1px solid var(--tvh-border-subtle);
      background: rgba(255, 255, 255, 0.03);
      color: var(--tvh-text-secondary);
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      text-decoration: none;
      transition: all var(--tvh-transition-fast);

      &:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--tvh-text-primary);
        border-color: var(--tvh-border-bright);
        transform: translateY(-1px);
      }

      &.active {
        background: linear-gradient(135deg, var(--tvh-primary-glow), rgba(6, 182, 212, 0.15));
        color: #ffffff;
        border-color: var(--tvh-primary);
      }

      &.primary {
        background: linear-gradient(135deg, var(--tvh-primary), var(--tvh-secondary));
        color: #ffffff;
        border: none;
        box-shadow: 0 4px 15px var(--tvh-primary-glow);

        &:hover {
          box-shadow: 0 6px 22px var(--tvh-primary-glow);
          transform: translateY(-2px);
        }
      }
    }
  }
}

/* Master Studio Workspace Layout */
.studio-layout {
  display: grid;
  grid-template-columns: 360px 1fr 440px;
  height: calc(100vh - 68px);
  overflow: hidden;

  @media (max-width: 1440px) {
    grid-template-columns: 330px 1fr 400px;
  }

  @media (max-width: 1100px) {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
}

/* Left Sidebar: Controls & Adjustments */
.sidebar-controls {
  background: var(--tvh-bg-panel);
  border-right: 1px solid var(--tvh-border-subtle);
  overflow-y: auto;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;

  & .control-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--tvh-border-subtle);
    border-radius: var(--tvh-radius-md);
    padding: 16px;

    & .section-header {
      display: flex;
      align-items: center;
      justify-content: space-between;

      & .section-title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-family: var(--tvh-font-heading);
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--tvh-text-primary);
        letter-spacing: -0.01em;

        & i {
          color: var(--tvh-primary-light);
          font-size: 0.95rem;
        }
      }

      & .section-badge {
        font-size: 0.68rem;
        padding: 2px 8px;
        border-radius: var(--tvh-radius-full);
        background: rgba(99, 102, 241, 0.15);
        color: var(--tvh-primary-light);
        font-weight: 700;
        text-transform: uppercase;
      }
    }
  }

  /* Mode Switcher Segmented Control */
  & .mode-segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: rgba(3, 7, 18, 0.8);
    border: 1px solid var(--tvh-border-subtle);
    border-radius: var(--tvh-radius-sm);
    padding: 4px;
    gap: 4px;

    & .mode-btn {
      padding: 8px 6px;
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--tvh-text-muted);
      border: none;
      background: transparent;
      border-radius: var(--tvh-radius-xs);
      cursor: pointer;
      transition: all var(--tvh-transition-fast);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;

      &:hover {
        color: var(--tvh-text-primary);
      }

      &.active {
        background: var(--tvh-primary);
        color: #ffffff;
        box-shadow: 0 2px 8px var(--tvh-primary-glow);
      }
    }
  }

  /* Form Control Groups */
  & .control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;

    & .control-label-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--tvh-text-secondary);

      & .control-val-badge {
        font-family: var(--tvh-font-mono);
        font-size: 0.75rem;
        color: var(--tvh-secondary-light);
        background: rgba(6, 182, 212, 0.1);
        padding: 2px 6px;
        border-radius: var(--tvh-radius-xs);
        border: 1px solid rgba(6, 182, 212, 0.2);
      }
    }

    /* Range Sliders */
    & input[type="range"] {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 6px;
      background: rgba(255, 255, 255, 0.08);
      border-radius: var(--tvh-radius-full);
      outline: none;
      cursor: pointer;
      transition: background var(--tvh-transition-fast);

      &:hover {
        background: rgba(255, 255, 255, 0.15);
      }

      &::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #ffffff;
        box-shadow: 0 0 10px var(--tvh-primary);
        border: 2px solid var(--tvh-primary);
        cursor: pointer;
        transition: transform var(--tvh-transition-fast);

        &:hover {
          transform: scale(1.2);
        }
      }
    }

    /* Color Swatches Grid */
    & .color-swatches {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 8px;

      & .swatch-btn {
        height: 28px;
        border-radius: var(--tvh-radius-xs);
        border: 2px solid transparent;
        cursor: pointer;
        transition: transform var(--tvh-transition-fast), border-color var(--tvh-transition-fast);

        &:hover {
          transform: scale(1.1);
        }

        &.active {
          border-color: #ffffff;
          box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
        }
      }
    }

    /* Color Pickers Input Row */
    & .color-input-row {
      display: flex;
      align-items: center;
      gap: 10px;

      & input[type="color"] {
        -webkit-appearance: none;
        appearance: none;
        border: 1px solid var(--tvh-border-bright);
        width: 36px;
        height: 36px;
        border-radius: var(--tvh-radius-xs);
        cursor: pointer;
        background: transparent;
        padding: 2px;

        &::-webkit-color-swatch-wrapper {
          padding: 0;
        }
        &::-webkit-color-swatch {
          border: none;
          border-radius: calc(var(--tvh-radius-xs) - 2px);
        }
      }

      & .color-hex-input {
        flex: 1;
        background: var(--tvh-bg-input);
        border: 1px solid var(--tvh-border-subtle);
        border-radius: var(--tvh-radius-xs);
        padding: 8px 12px;
        color: var(--tvh-text-primary);
        font-family: var(--tvh-font-mono);
        font-size: 0.85rem;
        outline: none;

        &:focus {
          border-color: var(--tvh-primary);
        }
      }
    }
  }

  /* Toggle Row */
  & .toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    & .toggle-label {
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--tvh-text-secondary);
    }

    & .switch {
      position: relative;
      display: inline-block;
      width: 40px;
      height: 22px;

      & input {
        opacity: 0;
        width: 0;
        height: 0;

        &:checked + .slider {
          background: var(--tvh-primary);
          &::before {
            transform: translateX(18px);
          }
        }
      }

      & .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.15);
        transition: var(--tvh-transition-fast);
        border-radius: var(--tvh-radius-full);

        &::before {
          position: absolute;
          content: "";
          height: 16px;
          width: 16px;
          left: 3px;
          bottom: 3px;
          background: #ffffff;
          transition: var(--tvh-transition-fast);
          border-radius: 50%;
        }
      }
    }
  }
}

/* Center Stage: Interactive Sandbox & Live Canvas */
.center-sandbox {
  display: flex;
  flex-direction: column;
  position: relative;
  background: #02040a;
  overflow: hidden;

  /* Floating Component Switcher Toolbar (Fixed Layout) */
  & .sandbox-top-toolbar {
    min-height: 56px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(12, 16, 34, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--tvh-border-subtle);
    z-index: 30;

    & .component-selector-wrapper {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      display: flex;
      align-items: center;
    }

    & .component-selector {
      display: flex;
      align-items: center;
      gap: 6px;
      overflow-x: auto;
      white-space: nowrap;
      scrollbar-width: none;
      -ms-overflow-style: none;
      padding: 4px 0;

      &::-webkit-scrollbar {
        display: none;
      }

      & .comp-btn {
        padding: 6px 14px;
        border-radius: var(--tvh-radius-full);
        border: 1px solid transparent;
        background: rgba(255, 255, 255, 0.03);
        color: var(--tvh-text-secondary);
        font-size: 0.78rem;
        font-weight: 600;
        cursor: pointer;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        transition: all var(--tvh-transition-fast);
        flex-shrink: 0;

        &:hover {
          background: rgba(255, 255, 255, 0.08);
          color: var(--tvh-text-primary);
        }

        &.active {
          background: rgba(99, 102, 241, 0.25);
          border-color: var(--tvh-primary);
          color: #ffffff;
          box-shadow: 0 0 12px var(--tvh-primary-glow);
        }
      }
    }

    & .bg-mode-dropdown {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      gap: 8px;
      background: rgba(3, 7, 18, 0.7);
      padding: 4px 10px;
      border-radius: var(--tvh-radius-sm);
      border: 1px solid var(--tvh-border-subtle);

      & label {
        font-size: 0.74rem;
        color: var(--tvh-text-muted);
        font-weight: 600;
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 5px;
      }

      & select {
        background: transparent;
        border: none;
        color: var(--tvh-text-primary);
        padding: 4px 6px;
        font-size: 0.78rem;
        outline: none;
        cursor: pointer;
        font-weight: 600;

        & option {
          background: #0c1022;
          color: #ffffff;
        }
      }
    }
  }

  /* Live Stage Display Area */
  & .sandbox-stage {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 30px;
    perspective: 1200px;

    /* Background Canvas */
    & .bg-canvas-wrapper {
      position: absolute;
      inset: 0;
      z-index: 1;
      overflow: hidden;

      & canvas {
        width: 100%;
        height: 100%;
        display: block;
      }

      & .bg-image-layer {
        position: absolute;
        inset: 0;
        background-size: cover;
        background-position: center;
        opacity: 0;
        transition: opacity var(--tvh-transition-normal);

        &.active {
          opacity: 1;
        }
      }
    }

    /* Glass Target Component Container (Interactive 3D Perspective) */
    & .glass-target-container {
      position: relative;
      z-index: 10;
      max-width: 600px;
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      user-select: none;
      transform-style: preserve-3d;
      transition: transform 0.15s ease-out;
    }
  }

  /* Bottom Floating Status Bar */
  & .sandbox-footer-bar {
    height: 42px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(12, 16, 34, 0.7);
    border-top: 1px solid var(--tvh-border-subtle);
    font-size: 0.75rem;
    color: var(--tvh-text-muted);
    z-index: 20;

    & .status-item {
      display: flex;
      align-items: center;
      gap: 6px;

      & .dot-live {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--tvh-success);
        box-shadow: 0 0 8px var(--tvh-success);
      }
    }
  }
}

/* Right Sidebar: Code Exporter, Token Generator & Preset Vault */
.sidebar-output {
  background: var(--tvh-bg-panel);
  border-left: 1px solid var(--tvh-border-subtle);
  overflow-y: auto;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;

  & .output-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--tvh-border-subtle);
    border-radius: var(--tvh-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;

    & .card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;

      & .card-title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-family: var(--tvh-font-heading);
        font-size: 0.92rem;
        font-weight: 700;
        color: var(--tvh-text-primary);

        & i {
          color: var(--tvh-secondary-light);
        }
      }

      & .code-badge {
        font-size: 0.68rem;
        padding: 2px 8px;
        border-radius: var(--tvh-radius-full);
        background: rgba(6, 182, 212, 0.15);
        color: var(--tvh-secondary-light);
        font-weight: 700;
        text-transform: uppercase;
        font-family: var(--tvh-font-mono);
      }
    }
  }

  /* Code Tabs (Multi-Format) */
  & .code-format-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: rgba(3, 7, 18, 0.8);
    border: 1px solid var(--tvh-border-subtle);
    border-radius: var(--tvh-radius-xs);
    padding: 3px;
    gap: 3px;

    & .tab-btn {
      padding: 6px 4px;
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--tvh-text-muted);
      border: none;
      background: transparent;
      border-radius: calc(var(--tvh-radius-xs) - 2px);
      cursor: pointer;
      white-space: nowrap;
      text-align: center;
      transition: all var(--tvh-transition-fast);

      &:hover {
        color: var(--tvh-text-primary);
      }

      &.active {
        background: rgba(6, 182, 212, 0.2);
        color: var(--tvh-secondary-light);
        border: 1px solid rgba(6, 182, 212, 0.3);
      }
    }
  }

  /* Code Viewer Block */
  & .code-viewer-container {
    position: relative;
    background: #020612;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--tvh-radius-sm);
    padding: 14px;
    min-height: 240px;
    max-height: 380px;
    overflow-y: auto;

    & pre {
      margin: 0;
      font-family: var(--tvh-font-mono);
      font-size: 0.76rem;
      line-height: 1.6;
      color: #38bdf8;
      overflow-x: auto;
      white-space: pre-wrap;
      word-break: break-all;
    }

    & .copy-btn {
      position: sticky;
      top: 0;
      float: right;
      z-index: 5;
      padding: 6px 12px;
      font-size: 0.75rem;
      font-weight: 700;
      color: #ffffff;
      background: rgba(99, 102, 241, 0.85);
      border: 1px solid var(--tvh-primary);
      border-radius: var(--tvh-radius-xs);
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all var(--tvh-transition-fast);
      box-shadow: 0 2px 8px var(--tvh-primary-glow);

      &:hover {
        background: var(--tvh-primary);
        transform: scale(1.04);
      }

      &.copied {
        background: var(--tvh-success);
        border-color: var(--tvh-success);
      }
    }
  }

  /* Presets Gallery Grid */
  & .presets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;

    & .preset-card {
      padding: 10px 12px;
      border-radius: var(--tvh-radius-sm);
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--tvh-border-subtle);
      cursor: pointer;
      display: flex;
      flex-direction: column;
      gap: 4px;
      transition: all var(--tvh-transition-fast);
      position: relative;

      &:hover {
        background: rgba(255, 255, 255, 0.07);
        border-color: var(--tvh-primary);
        transform: translateY(-2px);
      }

      &.active {
        border-color: var(--tvh-secondary);
        background: rgba(6, 182, 212, 0.1);
      }

      & .preset-name {
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--tvh-text-primary);
      }

      & .preset-desc {
        font-size: 0.68rem;
        color: var(--tvh-text-muted);
      }

      & .preset-delete {
        position: absolute;
        top: 6px;
        right: 6px;
        color: var(--tvh-text-muted);
        background: none;
        border: none;
        cursor: pointer;
        padding: 2px 4px;
        border-radius: 4px;
        font-size: 0.7rem;

        &:hover {
          color: var(--tvh-danger);
          background: rgba(239, 68, 68, 0.1);
        }
      }
    }
  }
}

/* ==========================================================================
   DYNAMIC PREVIEW COMPONENTS WITH AUTO-CONTRAST SUPPORT
   ========================================================================== */

.glass-preview-element {
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.15s ease, background 0.15s ease;

  /* Specular Glare Overlay tracking mouse */
  &::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--sheen-x, 50%) var(--sheen-y, 50%), rgba(255, 255, 255, 0.22) 0%, transparent 60%);
    opacity: 0.8;
    border-radius: inherit;
    z-index: 5;
  }
}

/* 1. VIP Glass Card */
.comp-vip-card {
  width: 440px;
  height: 270px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--card-text-primary, #ffffff);

  & .card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;

    & .chip-symbol {
      width: 46px;
      height: 34px;
      border-radius: 6px;
      background: linear-gradient(135deg, #fbbf24, #d97706);
      box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.7rem;
      color: #78350f;
    }

    & .card-brand-logo {
      font-family: var(--tvh-font-heading);
      font-weight: 800;
      font-size: 1.1rem;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: var(--card-text-primary, #ffffff);
    }
  }

  & .card-number {
    font-family: var(--tvh-font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--card-text-primary, #ffffff);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  }

  & .card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;

    & .holder-meta {
      & .holder-label {
        font-size: 0.65rem;
        text-transform: uppercase;
        color: var(--card-text-muted, rgba(255, 255, 255, 0.6));
        font-weight: 600;
      }
      & .holder-name {
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--card-text-primary, #ffffff);
      }
    }

    & .expiry-meta {
      text-align: right;
      & .expiry-label {
        font-size: 0.65rem;
        text-transform: uppercase;
        color: var(--card-text-muted, rgba(255, 255, 255, 0.6));
      }
      & .expiry-val {
        font-family: var(--tvh-font-mono);
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--card-text-primary, #ffffff);
      }
    }
  }
}

/* 2. Glass Analytics HUD */
.comp-analytics-hud {
  width: 480px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: var(--card-text-primary, #ffffff);

  & .hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    & .hud-title {
      font-size: 1.05rem;
      font-weight: 700;
      font-family: var(--tvh-font-heading);
      color: var(--card-text-primary, #ffffff);
      display: flex;
      align-items: center;
      gap: 8px;

      & i {
        color: #f59e0b;
      }
    }

    & .hud-tag {
      font-size: 0.72rem;
      padding: 3px 8px;
      border-radius: var(--tvh-radius-full);
      background: rgba(16, 185, 129, 0.2);
      color: #10b981;
      font-weight: 700;
    }
  }

  & .hud-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;

    & .hud-stat-box {
      background: var(--card-subtle-bg, rgba(255, 255, 255, 0.06));
      border: 1px solid var(--card-subtle-border, rgba(255, 255, 255, 0.12));
      border-radius: var(--tvh-radius-sm);
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;

      & .stat-lbl {
        font-size: 0.7rem;
        color: var(--card-text-muted, rgba(255, 255, 255, 0.6));
        text-transform: uppercase;
        font-weight: 600;
      }
      & .stat-num {
        font-size: 1.25rem;
        font-weight: 800;
        font-family: var(--tvh-font-heading);
        color: var(--card-text-primary, #ffffff);
      }
    }
  }

  & .hud-chart-mock {
    height: 70px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding-top: 10px;

    & .chart-bar {
      flex: 1;
      background: linear-gradient(to top, var(--tvh-primary), var(--tvh-secondary));
      border-radius: 4px;
      transition: height 0.3s ease;
    }
  }
}

/* 3. Glass Media Player Island */
.comp-media-island {
  width: 440px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--card-text-primary, #ffffff);

  & .media-top {
    display: flex;
    gap: 16px;
    align-items: center;

    & .album-art {
      width: 64px;
      height: 64px;
      border-radius: var(--tvh-radius-sm);
      background: linear-gradient(135deg, #f43f5e, #8b5cf6);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
      color: #ffffff;
      box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
    }

    & .track-info {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 2px;

      & .track-name {
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--card-text-primary, #ffffff);
      }
      & .artist-name {
        font-size: 0.8rem;
        color: var(--card-text-muted, rgba(255, 255, 255, 0.7));
      }
    }
  }

  & .progress-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;

    & .track-slider {
      width: 100%;
      height: 5px;
      background: var(--card-subtle-bg, rgba(255, 255, 255, 0.2));
      border-radius: var(--tvh-radius-full);
      position: relative;

      & .fill {
        width: 62%;
        height: 100%;
        background: linear-gradient(90deg, var(--tvh-primary), var(--tvh-secondary));
        border-radius: var(--tvh-radius-full);
      }
    }

    & .time-meta {
      display: flex;
      justify-content: space-between;
      font-size: 0.7rem;
      color: var(--card-text-muted, rgba(255, 255, 255, 0.6));
      font-family: var(--tvh-font-mono);
    }
  }

  & .media-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;

    & .media-btn {
      background: none;
      border: none;
      color: var(--card-text-primary, #ffffff);
      font-size: 1.1rem;
      cursor: pointer;
      opacity: 0.85;
      transition: all var(--tvh-transition-fast);

      &:hover {
        opacity: 1;
        transform: scale(1.15);
      }

      &.play-btn {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: #ffffff;
        color: #0f172a;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
      }
    }
  }
}

/* 4. Glass Login / Sign-up Form */
.comp-login-form {
  width: 420px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  color: var(--card-text-primary, #ffffff);

  & .form-head {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;

    & .form-title {
      font-size: 1.3rem;
      font-weight: 800;
      font-family: var(--tvh-font-heading);
      color: var(--card-text-primary, #ffffff);
      letter-spacing: -0.01em;
    }
    & .form-desc {
      font-size: 0.82rem;
      color: var(--card-text-secondary, rgba(255, 255, 255, 0.65));
    }
  }

  & .form-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;

    & .mock-input {
      width: 100%;
      padding: 12px 16px;
      border-radius: var(--tvh-radius-sm);
      background: var(--card-input-bg, rgba(255, 255, 255, 0.08));
      border: 1px solid var(--card-input-border, rgba(255, 255, 255, 0.18));
      color: var(--card-input-text, #ffffff);
      font-size: 0.88rem;
      outline: none;
      transition: border-color var(--tvh-transition-fast);

      &::placeholder {
        color: var(--card-input-placeholder, rgba(255, 255, 255, 0.4));
      }

      &:focus {
        border-color: var(--tvh-primary);
      }
    }

    & .mock-submit-btn {
      width: 100%;
      padding: 13px;
      border-radius: var(--tvh-radius-sm);
      background: linear-gradient(135deg, var(--tvh-primary), var(--tvh-secondary));
      border: none;
      color: #ffffff;
      font-weight: 700;
      font-size: 0.92rem;
      cursor: pointer;
      margin-top: 4px;
      box-shadow: 0 4px 15px var(--tvh-primary-glow);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: transform var(--tvh-transition-fast);

      &:hover {
        transform: translateY(-1px);
      }
    }
  }
}

/* 5. Glass Chat Modal */
.comp-chat-modal {
  width: 460px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--card-text-primary, #ffffff);

  & .chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-subtle-border, rgba(255, 255, 255, 0.1));

    & .avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--tvh-accent), var(--tvh-primary));
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      color: #ffffff;
      font-size: 1.05rem;
    }

    & .chat-title-box {
      flex: 1;
      & .name {
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--card-text-primary, #ffffff);
      }
      & .status {
        font-size: 0.72rem;
        color: var(--tvh-success);
        font-weight: 600;
      }
    }
  }

  & .chat-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;

    & .msg-bubble {
      padding: 10px 14px;
      border-radius: var(--tvh-radius-sm);
      font-size: 0.84rem;
      max-width: 80%;

      &.received {
        background: var(--card-subtle-bg, rgba(255, 255, 255, 0.08));
        border: 1px solid var(--card-subtle-border, rgba(255, 255, 255, 0.12));
        color: var(--card-text-primary, #ffffff);
        align-self: flex-start;
      }

      &.sent {
        background: linear-gradient(135deg, var(--tvh-primary), var(--tvh-secondary));
        color: #ffffff;
        align-self: flex-end;
        box-shadow: 0 2px 8px var(--tvh-primary-glow);
      }
    }
  }
}

/* 6. Crypto Glass Wallet */
.comp-crypto-wallet {
  width: 450px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: var(--card-text-primary, #ffffff);

  & .wallet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;

    & .wallet-tag {
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--tvh-primary-light);
      background: rgba(99, 102, 241, 0.18);
      padding: 4px 10px;
      border-radius: var(--tvh-radius-full);
      display: flex;
      align-items: center;
      gap: 6px;
    }

    & .wallet-network {
      font-size: 0.72rem;
      color: var(--card-text-muted, rgba(255, 255, 255, 0.6));
      font-weight: 600;
    }
  }

  & .wallet-balance-box {
    display: flex;
    flex-direction: column;
    gap: 4px;

    & .balance-sub {
      font-size: 0.75rem;
      color: var(--card-text-muted, rgba(255, 255, 255, 0.6));
      text-transform: uppercase;
      font-weight: 600;
    }
    & .balance-val {
      font-size: 1.85rem;
      font-weight: 800;
      font-family: var(--tvh-font-heading);
      color: var(--card-text-primary, #ffffff);
      letter-spacing: -0.02em;
    }
    & .balance-change {
      font-size: 0.78rem;
      color: var(--tvh-success);
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 4px;
    }
  }

  & .wallet-action-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;

    & .wallet-btn {
      padding: 10px;
      border-radius: var(--tvh-radius-sm);
      font-size: 0.8rem;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      background: var(--card-subtle-bg, rgba(255, 255, 255, 0.08));
      border: 1px solid var(--card-subtle-border, rgba(255, 255, 255, 0.15));
      color: var(--card-text-primary, #ffffff);
      transition: all var(--tvh-transition-fast);

      &:hover {
        transform: translateY(-2px);
      }

      &.primary {
        background: linear-gradient(135deg, var(--tvh-primary), var(--tvh-secondary));
        border: none;
        color: #ffffff;
        box-shadow: 0 4px 14px var(--tvh-primary-glow);
      }
    }
  }
}

/* 7. Dynamic Island Dock */
.comp-dynamic-island {
  width: 360px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;

  & .island-dock {
    display: flex;
    align-items: center;
    gap: 14px;

    & .dock-app {
      width: 48px;
      height: 48px;
      border-radius: 14px;
      background: var(--card-subtle-bg, rgba(255, 255, 255, 0.08));
      border: 1px solid var(--card-subtle-border, rgba(255, 255, 255, 0.15));
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.15rem;
      color: var(--card-text-primary, #ffffff);
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);

      &:hover {
        transform: translateY(-8px) scale(1.15);
        background: rgba(99, 102, 241, 0.3);
        border-color: var(--tvh-primary);
        box-shadow: 0 8px 20px var(--tvh-primary-glow);
      }

      &.active {
        background: linear-gradient(135deg, var(--tvh-primary), var(--tvh-secondary));
        color: #ffffff;
        box-shadow: 0 4px 14px var(--tvh-primary-glow);
      }
    }
  }
}

/* 8. UI Kit Atoms */
.comp-ui-atoms {
  width: 460px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  color: var(--card-text-primary, #ffffff);

  & .atom-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;

    & .atom-btn {
      padding: 8px 16px;
      border-radius: var(--tvh-radius-full);
      font-size: 0.8rem;
      font-weight: 600;
      border: 1px solid var(--card-subtle-border, rgba(255, 255, 255, 0.2));
      background: var(--card-subtle-bg, rgba(255, 255, 255, 0.08));
      color: var(--card-text-primary, #ffffff);
      cursor: pointer;
    }

    & .atom-badge {
      padding: 4px 10px;
      border-radius: var(--tvh-radius-full);
      font-size: 0.72rem;
      font-weight: 700;
      background: rgba(99, 102, 241, 0.25);
      border: 1px solid var(--tvh-primary);
      color: #ffffff;
    }

    & .atom-tag {
      padding: 3px 8px;
      border-radius: 4px;
      font-size: 0.7rem;
      background: var(--card-subtle-bg, rgba(255, 255, 255, 0.06));
      border: 1px solid var(--card-subtle-border, rgba(255, 255, 255, 0.12));
      color: var(--card-text-muted, rgba(255, 255, 255, 0.8));
    }
  }
}

/* Modal Popup for Save Preset */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tvh-transition-normal);

  &.active {
    opacity: 1;
    pointer-events: auto;
  }

  & .modal-dialog {
    background: var(--tvh-bg-surface);
    border: 1px solid var(--tvh-border-bright);
    border-radius: var(--tvh-radius-lg);
    padding: 28px;
    width: 420px;
    max-width: 90vw;
    box-shadow: var(--tvh-shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 18px;

    & .modal-title {
      font-family: var(--tvh-font-heading);
      font-size: 1.2rem;
      font-weight: 800;
    }

    & .modal-input {
      width: 100%;
      padding: 10px 14px;
      border-radius: var(--tvh-radius-sm);
      background: var(--tvh-bg-input);
      border: 1px solid var(--tvh-border-subtle);
      color: var(--tvh-text-primary);
      outline: none;
      font-size: 0.9rem;

      &:focus {
        border-color: var(--tvh-primary);
      }
    }

    & .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
    }
  }
}
