/* 
========================================================================
   TCL PICTURE QUALITY EMULATOR - CSS STYLING
   Brand Guidelines: Light background, gray text, TCL Red (#E31E24), 
                     dark gray, light gray. Premium modern aesthetics.
========================================================================
*/

:root {
  /* Color System */
  --tcl-red: #E31E24;
  --tcl-red-hover: #C51318;
  --tcl-red-light: rgba(227, 30, 36, 0.08);
  --tcl-dark-gray: #1D1D1F;
  --tcl-dark-gray-hover: #2D2D30;
  --tcl-medium-gray: #86868B;
  --tcl-light-gray: #F5F5F7;
  --tcl-border: #E2E2E8;
  
  --bg-primary: #FAFAFC;
  --bg-card: #FFFFFF;
  --text-primary: #1D1D1F;
  --text-secondary: #515154;
  
  /* Typography */
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Shadows & Radius */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 40px rgba(29, 29, 31, 0.08);
  --shadow-tv: 0 25px 60px rgba(0, 0, 0, 0.18);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  /* Layout */
  --header-height: 70px;
}

/* Base Styles & Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* App Header styling */
.app-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--tcl-border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
}

.header-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tcl-logo-img {
  height: 24px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  /* Recolor black PNG logo to TCL Red (#E31E24) using CSS filters */
  filter: invert(18%) sepia(75%) saturate(6443%) hue-rotate(353deg) brightness(92%) contrast(94%);
}

.modal-logo-img {
  height: 20px;
}

.logo-divider {
  width: 1px;
  height: 20px;
  background-color: var(--tcl-border);
}

.app-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--tcl-dark-gray);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--tcl-medium-gray);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #34c759;
  position: relative;
}

.status-indicator.active::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 2px solid #34c759;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* App Container Layout */
.app-container {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 32px;
  max-width: 1450px;
  margin: 0 auto;
  padding: 32px 24px;
  min-height: calc(100vh - var(--header-height) - 60px);
}

@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* Sidebar / Control Panel styling */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel-section {
  background: var(--bg-card);
  border: 1px solid var(--tcl-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.panel-section:hover {
  box-shadow: var(--shadow-md);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--tcl-dark-gray);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Scene Buttons Grid */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.scene-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 6px;
  background-color: var(--tcl-light-gray);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tcl-text-secondary);
  transition: all 0.25s ease;
}

.scene-icon {
  font-size: 1.4rem;
  transition: transform 0.3s ease;
}

.scene-btn:hover {
  background-color: #eaeaea;
}

.scene-btn:hover .scene-icon {
  transform: translateY(-2px);
}

.scene-btn.active {
  background-color: var(--tcl-red-light);
  border-color: var(--tcl-red);
  color: var(--tcl-red);
}

/* Custom Upload Styling */
.upload-container {
  width: 100%;
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border: 2px dashed var(--tcl-border);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-label:hover, .upload-label.dragover {
  border-color: var(--tcl-red);
  background-color: var(--tcl-red-light);
}

.upload-icon {
  font-size: 1.3rem;
  color: var(--tcl-medium-gray);
}

.upload-label:hover .upload-icon {
  color: var(--tcl-red);
}

.upload-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--tcl-medium-gray);
  text-align: center;
}

.hidden-input {
  display: none;
}

/* Technology Tabs (LED, QLED, Mini-LED) */
.tech-tabs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tech-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 20px;
  background-color: var(--tcl-light-gray);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-family);
  text-align: left;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.tech-tab::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--tcl-red);
  transform: scaleY(0);
  transition: transform 0.25s ease;
}

.tech-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--tcl-medium-gray);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.tech-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--tcl-dark-gray);
}

.tech-tab:hover {
  background-color: #eaeaea;
}

.tech-tab.active {
  background-color: var(--bg-card);
  border-color: var(--tcl-border);
  box-shadow: var(--shadow-md);
}

.tech-tab.active::before {
  transform: scaleY(1);
}

.tech-tab[data-tech="miniled"].active .tech-name {
  color: var(--tcl-red);
}

/* Dynamic Controls Panel styling */
.dynamic-controls {
  animation: fadeIn 0.4s ease;
}

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

.hidden {
  display: none !important;
}

.subsection-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--tcl-border);
  color: var(--tcl-dark-gray);
}

/* Form Styles */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tcl-text-secondary);
  margin-bottom: 6px;
}

.custom-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--tcl-border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tcl-dark-gray);
  outline: none;
  cursor: pointer;
  transition: border-color 0.25s ease;
}

.custom-select:focus {
  border-color: var(--tcl-red);
}

/* Specs Badges for Mini-LED */
.spec-cards {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  margin: 18px 0;
}

.spec-card {
  background-color: var(--tcl-light-gray);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.spec-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--tcl-medium-gray);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.spec-val {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--tcl-dark-gray);
}

.spec-val.text-red {
  color: var(--tcl-red);
  font-size: 0.8rem;
}

/* View Mode Toggles for Mini-LED */
.view-toggle-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.toggle-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tcl-text-secondary);
}

.toggle-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--tcl-light-gray);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.toggle-btn {
  border: none;
  background: none;
  padding: 8px;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tcl-text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background-color: var(--bg-card);
  color: var(--tcl-dark-gray);
  box-shadow: var(--shadow-sm);
}

/* General Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  outline: none;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background-color: var(--tcl-red);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--tcl-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(227, 30, 36, 0.25);
}

.btn-secondary {
  background-color: var(--tcl-dark-gray);
  color: #FFFFFF;
}

.btn-secondary:hover {
  background-color: var(--tcl-dark-gray-hover);
}

.btn-secondary.active {
  background-color: var(--tcl-red);
  color: #FFFFFF;
}

.comparison-option {
  margin-top: 6px;
}

.comparison-hint {
  font-size: 0.75rem;
  color: var(--tcl-medium-gray);
  margin-top: 8px;
  text-align: center;
  line-height: 1.3;
}

.cta-container {
  margin-top: auto;
}

/* Display Area styling */
.display-area {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0; /* Prevents overflow in flexbox */
}

.screen-view {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
}

/* TV Frame Wrappers */
.tv-wrapper {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.tv-bezel {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #2b2b2e, #141416);
  border-radius: 10px;
  padding: 6px 6px 14px 6px; /* Thinner bezel on sides, thicker at bottom */
  box-shadow: var(--shadow-tv);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sub-pixel/light detail at bottom of TV */
.tv-bezel::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.bezel-xray {
  background: linear-gradient(135deg, #1b202e, #0e111d);
  border: 1px dashed rgba(0, 150, 255, 0.4);
}

.bezel-xray::after {
  background-color: rgba(0, 150, 255, 0.8);
  box-shadow: 0 0 10px rgba(0, 150, 255, 0.9);
}

.tv-screen-container {
  width: 100%;
  height: 100%;
  background-color: #000;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.screen-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* TV Stand styling */
.tv-stand {
  width: 180px;
  height: 16px;
  background: linear-gradient(to right, #1d1d1f, #3a3a3d, #1d1d1f);
  clip-path: polygon(15% 0%, 85% 0%, 100% 100%, 0% 100%);
  position: relative;
  z-index: 10;
  margin-top: -1px;
}

.tv-stand::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 6px;
  background-color: #2b2b2e;
}

/* Split-screen Slider */
.split-slider-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background-color: #FFFFFF;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 30;
  cursor: ew-resize;
}

.split-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background-color: var(--tcl-red);
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #FFFFFF;
  font-size: 0.65rem;
  user-select: none;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.split-slider-line:hover .split-handle {
  transform: translate(-50%, -50%) scale(1.1);
}

.arrow-left, .arrow-right {
  line-height: 1;
}

/* Loading Overlay inside TV */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #FFFFFF;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 40;
  animation: fadeIn 0.2s ease;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--tcl-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Dual Screens Explainer Layout */
.dual-screens-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  align-items: center;
}

.dual-screen-item {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dual-screen-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--tcl-dark-gray);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.badge-red {
  background-color: var(--tcl-red-light);
  color: var(--tcl-red);
}

.badge-gray {
  background-color: #e9e9e9;
  color: var(--tcl-text-secondary);
}

.tv-wrapper-small {
  max-width: 100%;
}

/* Information Card under TV */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--tcl-border);
  border-radius: var(--radius-lg);
  padding: 24px 30px;
  box-shadow: var(--shadow-sm);
  margin-top: 10px;
  animation: fadeIn 0.4s ease;
}

.info-card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--tcl-dark-gray);
}

.info-card-text {
  font-size: 0.9rem;
  color: var(--tcl-text-secondary);
  line-height: 1.6;
}

/* Premium Modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(29, 29, 31, 0.4);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s ease;
}

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

.modal-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-overlay:not(.hidden) .modal-card {
  transform: translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  border: none;
  background: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--tcl-medium-gray);
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close-btn:hover {
  color: var(--tcl-dark-gray);
}

.modal-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.modal-logo {
  align-self: flex-start;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--tcl-dark-gray);
  letter-spacing: -0.01em;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-intro {
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.modal-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-features li {
  position: relative;
  padding-left: 24px;
  font-size: 0.9rem;
  color: var(--tcl-text-secondary);
  line-height: 1.45;
}

.modal-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--tcl-red);
  font-weight: 900;
  font-size: 1.1rem;
}

.feature-highlight {
  color: var(--tcl-dark-gray);
  font-weight: 700;
}

.modal-cta-box {
  background-color: var(--tcl-light-gray);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.modal-cta-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tcl-text-secondary);
}

.modal-action-btn {
  text-decoration: none;
  font-size: 0.85rem;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
}

/* App Footer styling */
.app-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.75rem;
  color: var(--tcl-medium-gray);
  border-top: 1px solid var(--tcl-border);
  background-color: var(--bg-card);
  margin-top: 40px;
}

/* Responsive adjustements */
@media (max-width: 768px) {
  .app-header {
    height: auto;
    padding: 12px 0;
  }
  
  .header-container {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  
  .header-status {
    align-self: flex-start;
  }

  .app-container {
    padding: 16px 12px;
  }

  .panel-section {
    padding: 16px;
  }

  .modal-card {
    padding: 24px;
  }

  .modal-title {
    font-size: 1.35rem;
  }

  .tv-bezel {
    border-radius: 6px;
    padding: 4px 4px 10px 4px;
  }

  .tv-stand {
    width: 120px;
  }
}
