/* App Portal Frontend Styles */
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.app-portal-container {
  width: 100%;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
}

/* Custom Search Bar - Completely Custom Design */
.app-portal-search {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  padding: 6px;
  border-radius: 50px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.6);
  width: auto;
  max-width: 90%;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  backdrop-filter: blur(20px);
}

.app-portal-search::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(145deg, #ff6b35, #e55a2b, #ff6b35);
  border-radius: 50px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.app-portal-search:hover::before,
.app-portal-search:focus-within::before {
  opacity: 0.1;
}

.app-portal-search:hover {
  transform: translateX(-50%) translateY(-3px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), 0 12px 24px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.app-portal-search:focus-within {
  transform: translateX(-50%) translateY(-3px);
  box-shadow: 0 25px 50px rgba(255, 107, 53, 0.2), 0 12px 24px rgba(255, 107, 53, 0.1), inset 0 1px 0
    rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(255, 107, 53, 0.1);
}

.search-icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(145deg, #ff6b35, #e55a2b);
  border-radius: 50%;
  margin-right: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 8px 16px rgba(255, 107, 53, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0
    rgba(0, 0, 0, 0.1);
  border: none;
  outline: none;
}

.search-icon-container:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 24px rgba(255, 107, 53, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0
    rgba(0, 0, 0, 0.1);
}

.search-icon-container:active {
  transform: scale(0.95);
}

.search-icon {
  width: 18px;
  height: 18px;
  fill: white;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.search-input-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  color: #333;
  outline: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: all 0.3s ease;
  min-width: 300px;
}

.search-input::placeholder {
  color: #888;
  font-weight: 400;
  transition: all 0.3s ease;
}

.search-input:focus::placeholder {
  color: #bbb;
  transform: translateX(5px);
}

.search-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  margin-right: 12px;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
  color: #666;
  font-size: 14px;
  font-weight: bold;
}

.search-clear-btn:hover {
  background: rgba(0, 0, 0, 0.2);
  color: #333;
  transform: scale(1.1);
}

.app-portal-search.has-content .search-clear-btn {
  display: flex;
}

.search-loading {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 12px;
}

.search-loading.show {
  display: flex;
}

.search-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top: 2px solid #ff6b35;
  border-radius: 50%;
  animation: searchSpin 1s linear infinite;
}

@keyframes searchSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Search Results */
.search-results-info {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.9));
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  animation: slideInDown 0.3s ease forwards;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Responsive Search */
@media (max-width: 768px) {
  .app-portal-search {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    margin: 20px auto;
    width: calc(100% - 40px);
    max-width: 400px;
  }

  .app-portal-search:hover,
  .app-portal-search:focus-within {
    transform: translateY(-2px);
  }

  .search-input {
    min-width: 200px;
    font-size: 14px;
    padding: 12px 16px;
  }

  .search-icon-container {
    width: 40px;
    height: 40px;
  }

  .search-icon {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  .search-input {
    min-width: 150px;
    padding: 10px 12px;
  }

  .search-icon-container {
    width: 36px;
    height: 36px;
  }

  .search-icon {
    width: 14px;
    height: 14px;
  }
}

/* App Sections */
.app-sections {
  width: 100%;
  margin: 0;
  padding: 0;
}

.app-section {
  width: 100%;
  min-height: 100vh;
  padding: 80px 40px 40px;
  margin: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.app-section-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  z-index: 1;
}

.app-section-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* App Logo */
.app-logo {
  margin-bottom: 60px;
  text-align: center;
}

.app-logo img {
  max-width: 300px;
  height: auto;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

/* Dynamic Download Grid */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  width: 100%;
  max-width: 1200px;
}

.download-card {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 30px 20px;
  text-align: center;
  backdrop-filter: blur(15px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.4s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.download-card:hover,
.download-card:focus {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.25);
}

.download-card.focused {
  outline: 3px solid #ff6b35;
  outline-offset: 2px;
}

/* Device Images */
.device-image {
  margin-bottom: 20px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  transition: transform 0.3s ease;
}

.download-card:hover .device-image img {
  transform: scale(1.05);
}

.device-placeholder {
  font-size: 4rem;
  opacity: 0.8;
}

/* Device Labels */
.device-label {
  color: white;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 20px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Download Buttons */
.download-btn {
  display: inline-block;
  background: #ff6b35;
  color: white !important;
  padding: 15px 30px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
  border: none;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.download-btn:hover,
.download-btn:focus {
  background: #e55a2b;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.6);
  text-decoration: none;
  color: white !important;
}

/* TV Navigation */
.app-portal-navigation {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: rgba(0, 0, 0, 0.8);
  padding: 20px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  z-index: 1000;
}

.nav-btn {
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 10px;
  background: #333;
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  background: #ff6b35;
  transform: scale(1.1);
}

.nav-btn[data-direction="up"] {
  grid-column: 2;
  grid-row: 1;
}
.nav-btn[data-direction="left"] {
  grid-column: 1;
  grid-row: 2;
}
.nav-btn[data-direction="right"] {
  grid-column: 3;
  grid-row: 2;
}
.nav-btn[data-direction="down"] {
  grid-column: 2;
  grid-row: 3;
}
.select-btn {
  grid-column: 2;
  grid-row: 2;
  background: #ff6b35;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .download-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
  }

  .app-section {
    padding: 60px 30px 30px;
  }

  .app-logo img {
    max-width: 250px;
  }

  .device-image {
    height: 120px;
  }
}

@media (max-width: 768px) {
  .download-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
  }

  .download-card {
    padding: 20px 15px;
  }

  .device-image {
    height: 100px;
  }

  .app-section {
    padding: 50px 20px 20px;
  }

  .app-portal-navigation {
    display: none;
  }
}

@media (max-width: 480px) {
  .download-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .app-logo img {
    max-width: 200px;
  }
}

/* TV-Optimized Styles */
@media (min-width: 1920px) {
  .app-section {
    padding: 100px 60px 60px;
  }

  .download-grid {
    gap: 40px;
    max-width: 1400px;
  }

  .download-card {
    padding: 40px 30px;
  }

  .device-image {
    height: 180px;
  }

  .app-logo img {
    max-width: 400px;
  }

  .download-btn {
    padding: 20px 40px;
    font-size: 16px;
  }
}

/* Focus and Accessibility */
.download-card:focus-visible {
  outline: 3px solid #ff6b35;
  outline-offset: 3px;
}

.download-btn:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* Loading States */
.app-sections.loading {
  opacity: 0.5;
  pointer-events: none;
}

.loading-spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top: 5px solid #ff6b35;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.app-portal-container[data-navigation="true"] .app-portal-navigation {
  display: grid;
}

/* Search results styling */
.search-highlight {
  background-color: rgba(255, 107, 53, 0.3);
  padding: 0 2px;
  border-radius: 3px;
}

.no-results {
  text-align: center;
  padding: 40px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: 10px;
  margin: 100px auto;
  max-width: 500px;
}
