/* Figma Design System - Dark Theme Firmware Library (110% Scale)
   ================================================
   All values increased by 10% (multiply by 1.1)
   Spacing: 4.4px base unit
   Line Height: 1.2 (title), 1.4 (body)
   Border Radius: 26.4px (cards), 11px (buttons), 8.8px (dropdown)
   Colors: #181818 (bg), rgba(71, 71, 74, 0.3) (card), #0088ff (accent)
*/

@font-face {
  font-family: 'NSourceSong';
  src: url('assets/NSourceSong_Headline.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: 'MiSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #181818;
  color: rgba(255, 255, 255, 0.9);
  height: auto;
  overflow-y: auto;
}

/* Frame Container - Main wrapper */
.frame-container {
  width: 100%;
  min-height: 100vh;
  background-color: #181818;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

/* Header Frame */
.header-frame {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 35.2px;
  flex-shrink: 0;
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 4.4px;
}

.update-date {
  font-size: 15.4px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
  letter-spacing: 0;
}

.main-title {
  font-family: 'NSourceSong', serif;
  font-size: 52.8px;
  line-height: 1.2;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0;
}

.subtitle {
  font-size: 15.4px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
  letter-spacing: 0;
}

/* Main Content Area */
.main-content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 11px;
  flex: 0 0 auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* Device Selector Card */
.selector-card {
  width: 100%;
  padding: 13.2px 15.4px;
  background-color: rgba(71, 71, 74, 0.3);
  border-radius: 26.4px;
  corner-shape: superellipse(1.4);
  flex-shrink: 0;
}

.selector-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 11px;
}

.selector-left {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
}

.selector-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.9;
}

.selector-text {
  display: flex;
  flex-direction: column;
  gap: 0px;
  flex: 1;
}

.selector-label {
  font-size: 16.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
}

.selector-sublabel {
  font-size: 13.2px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
}

.dropdown-wrapper {
  width: 229.9px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.device-select {
  width: 100%;
  height: 36px;
  padding: 8px 10px;
  background-color: rgba(71, 71, 74, 0.3);
  border-radius: 8.8px;
  corner-shape: superellipse(1.5);
  border: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15.4px;
  font-family: 'MiSans',system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.4;
  font-weight: 400;
  cursor: pointer;
  appearance: none;
  padding-right: 30.8px;
}

.device-select:hover {
  background-color: #424242;
  border-radius: 10px;
  corner-shape: superellipse(1.5);
    font-family: 'MiSans',system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.device-select:focus {
  outline: none;
  background-color: #222222;
    font-family: 'MiSans',system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.device-select option {
  background-color: #222222;
    font-family: 'MiSans',system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.dropdown-caret {
  width: 17.6px;
  height: 17.6px;
  position: absolute;
  right: 8.8px;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.6);
}

/* Firmware List Label */
.firmware-list-label {
  font-size: 14.3px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
  padding: 13.2px 13.2px;
  flex-shrink: 0;
}

/* Firmware List */
.firmware-list {
  display: flex;
  flex-direction: column;
  gap: 6.6px;
  flex: 0 0 auto;
  overflow: visible;
}

/* Firmware Card */
.firmware-card {
  width: 100%;
  padding: 15.4px;
  background-color: rgba(71, 71, 74, 0.3);
  border-radius: 26.4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  corner-shape: superellipse(1.4);
}

.firmware-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 17.6px;
  width: 100%;
}

.firmware-left {
  display: flex;
  flex-direction: column;
  gap: 11px;
  flex: 1;
}

.firmware-version {
  font-size: 16.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
}

.firmware-meta {
  display: flex;
  gap: 39.6px;
  align-items: center;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4.4px;
  font-size: 14.3px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

.meta-icon {
  width: 19.8px;
  height: 19.8px;
  flex-shrink: 0;
  opacity: 0.5;
}

.firmware-right {
  display: flex;
  gap: 8.8px;
  flex-shrink: 0;
  align-items: center;
  height: 100%;
}

/* Buttons */
.btn-changelog,
.btn-download {
  width: 168.3px;
  height: 48.4px;
  padding: 13.2px;
  border: none;
  border-radius: 11px;
  corner-shape: superellipse(1.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8.8px;
  cursor: pointer;
  font-size: 15.4px;
  line-height: 0.7;
  font-weight: 400;
  transition: all 0.2s ease;
  font-family: 'MiSans',system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  flex-shrink: 0;
}

.btn-changelog {
  background-color: rgba(71, 71, 75, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.btn-changelog:hover {
  background-color: rgba(71, 71, 75, 0.5);
}

.btn-download {
  background-color: rgba(0, 136, 255, 0.2);
  color: #0088ff;
}

.btn-download:hover {
  background-color: rgba(0, 136, 255, 0.3);
}

.btn-icon {
  width: 19.8px;
  height: 19.8px;
  flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-frame {
    padding: 17.6px;
  }

  .main-content {
    padding: 0 8.8px;
  }

  .main-title {
    font-size: 35.2px;
  }

  .firmware-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .firmware-right {
    width: 100%;
    flex-direction: column;
  }

  .btn-changelog,
  .btn-download {
    width: 100%;
  }

  .firmware-meta {
    gap: 17.6px;
  }
}

@media (max-width: 480px) {
  .header-frame {
    padding: 13.2px;
  }

  .main-content {
    padding: 0 6.6px;
  }

  .main-title {
    font-size: 26.4px;
  }

  .firmware-card {
    padding: 13.2px;
  }

  .btn-changelog,
  .btn-download {
    width: 100%;
    height: 44px;
    padding: 11px;
    font-size: 13.2px;
  }

  .firmware-meta {
    gap: 13.2px;
    flex-wrap: wrap;
  }
}


/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Modal Styles - Matching page design */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex !important;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background-color: #18191b;
  border-radius: 19.36px;
  corner-shape: superellipse(1.4);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  max-width: 356.4px;
  width: 85%;
  max-height: 75vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(221, 234, 248, 0.3);
  animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 19.36px;
  background: rgba(0, 136, 255, 0.2);
  gap: 12.1px;
  border-bottom: none;
}

.modal-header h2 {
  margin: 0;
  font-size: 17.6px;
  font-weight: 400;
  color: white;
  font-family: 'MiSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.4;
}



.modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  color: rgba(255, 255, 255, 0.8);
  transform: scale(1.1);
}

.modal-body {
  padding: 0px 19.36px;
  overflow-y: auto;
  min-height: 0;
  font-size: 14.52px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'MiSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  corner-shape: superellipse(1.5);
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  corner-shape: superellipse(1.5);
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.modal-footer {
  padding: 12.1px 19.36px 19.36px 19.36px;
  border-top: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 12.1px;
}

.btn-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9.68px;
  padding: 6.6px 8.8px;
  background-color: rgba(221, 234, 248, 0.1);
  color: #b0b4ba;
  border: none;
  border-radius: 5.5px;
  corner-shape: superellipse(1.5);
  font-size: 13.2px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'MiSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.4;
  height: auto;
}

.btn-modal-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9.68px;
  padding: 6.6px 8.8px;
  background-color: rgba(0, 136, 255, 0.25);
  color: #1491ff;
  border: none;
  border-radius: 5.5px;
  corner-shape: superellipse(1.5);
  font-size: 13.2px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'MiSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.4;
  height: auto;
}

.btn-modal-download:hover {
  background-color: rgba(0, 136, 255, 0.35);
  transform: translateY(-2px);
}

.btn-modal-close:hover {
  background-color: rgba(221, 234, 248, 0.2);
  transform: translateY(-2px);
}

.btn-modal-download:active {
  transform: translateY(0);
  background-color: #005ca3;
}

.modal-icon {
  width: 26.4px;
  height: 26.4px;
  filter: brightness(0) invert(1);
}

.btn-modal-download .btn-icon {
  width: 17.6px;
  height: 17.6px;
  opacity: 0.9;
  transition: transform 0.3s ease;
}

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

/* Firmware card animations */
.firmware-card {
  animation: slideUp 0.5s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
}

.firmware-card:nth-child(1) {
  animation-delay: 0.05s;
}

.firmware-card:nth-child(2) {
  animation-delay: 0.1s;
}

.firmware-card:nth-child(3) {
  animation-delay: 0.15s;
}

.firmware-card:nth-child(n+4) {
  animation-delay: 0.2s;
}

/* Button animations */
.btn-changelog,
.btn-download {
  transition: all 0.2s ease;
}

.btn-changelog:hover,
.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-changelog:active,
.btn-download:active {
  transform: translateY(0);
}

/* Selector card animation */
.selector-card {
  animation: slideUp 0.5s ease-out 0.1s both;
  opacity: 0;
  animation-fill-mode: forwards;
}

/* Firmware list label animation */
.firmware-list-label {
  animation: slideUp 0.5s ease-out 0.2s both;
  opacity: 0;
  animation-fill-mode: forwards;
}

/* Header animation */
.header-frame {
  animation: slideUp 0.5s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
}

/* Initial state - hide all content until loaded */
.firmware-list {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.firmware-list.loaded {
  opacity: 1;
}

/* Prevent FOUC (Flash of Unstyled Content) */
html {
  background-color: #181818;
}

body {
  background-color: #181818;
}
