/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Upload Section */
.upload-section {
  margin-bottom: 30px;
}

.upload-area {
  border: 3px dashed #fff;
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.upload-area:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #4caf50;
}

.upload-area.dragover {
  background: rgba(76, 175, 80, 0.2);
  border-color: #4caf50;
}

.upload-content {
  color: white;
}

.upload-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  opacity: 0.8;
}

.upload-content h3 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.upload-content p {
  opacity: 0.8;
}

/* Progress Bar */
.progress-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 30px;
  margin-top: 20px;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.progress-info h3 {
  color: #333;
  margin-bottom: 8px;
  font-size: 1.3rem;
}

.progress-info p {
  color: #666;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 6px;
  width: 0%;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-percentage {
  color: #333;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Info Section */
.info-section {
  background: white;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.schematic-info h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.info-item {
  display: flex;
  align-items: center;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.info-item label {
  font-weight: 600;
  margin-right: 10px;
  color: #555;
  min-width: 100px;
}

.info-item span {
  color: #333;
  font-family: "Courier New", monospace;
}

/* Results Section */
.results-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  margin-top: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.results-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.results-header h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-actions {
  display: flex;
  gap: 12px;
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.results-content {
  padding: 40px;
}

.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.info-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s ease;
  border: 1px solid rgba(102, 126, 234, 0.1);
  position: relative;
  overflow: hidden;
}

.info-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.15);
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.info-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.info-icon svg {
  width: 28px;
  height: 28px;
  stroke: white;
  stroke-width: 2;
}

.info-content {
  flex: 1;
}

.info-label {
  font-size: 0.9rem;
  color: #6c757d;
  font-weight: 500;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #343a40;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Enhanced animation for info cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.info-card {
  animation: fadeInUp 0.6s ease-out;
}

.info-card:nth-child(1) {
  animation-delay: 0.1s;
}
.info-card:nth-child(2) {
  animation-delay: 0.2s;
}
.info-card:nth-child(3) {
  animation-delay: 0.3s;
}

/* Tabs */
.tabs {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.tab-button {
  flex: 1;
  padding: 15px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: #666;
  transition: all 0.3s ease;
}

.tab-button:hover {
  background: #e9ecef;
  color: #333;
}

.tab-button.active {
  background: white;
  color: #667eea;
  border-bottom: 3px solid #667eea;
}

/* Tab Content */
.tab-content {
  padding: 30px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Search Bar */
.search-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  align-items: center;
}

#blockSearch {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

#blockSearch:focus {
  outline: none;
  border-color: #667eea;
}

#exportBlocks {
  padding: 12px 24px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.3s ease;
}

#exportBlocks:hover {
  background: #218838;
}

/* Blocks Grid */
.blocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.block-item {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  border-left: 4px solid #667eea;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.block-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.block-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.block-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.9rem;
  color: #666;
}

.block-detail {
  display: flex;
  justify-content: space-between;
}

/* Palette Container */
.palette-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.palette-item {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  border-left: 4px solid #28a745;
}

.palette-id {
  font-weight: 600;
  color: #333;
  margin-bottom: 5px;
}

.palette-block {
  color: #666;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

/* Statistics */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 1rem;
  opacity: 0.9;
}

.block-type-stats {
  grid-column: 1 / -1;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 25px;
}

.block-type-stats h3 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.block-type-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.block-type-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  background: white;
  border-radius: 6px;
  border-left: 3px solid #667eea;
}

/* Raw Data */
.raw-data-container {
  height: 500px;
}

#rawData {
  width: 100%;
  height: 100%;
  padding: 20px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  resize: vertical;
  background: #f8f9fa;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  color: white;
  opacity: 0.8;
}

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  header h1 {
    font-size: 2rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .blocks-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tab-button {
    flex: 1 1 50%;
  }

  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-container {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  /* Enhanced mobile results section */
  .results-header {
    padding: 24px 20px;
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .results-header h2 {
    font-size: 1.5rem;
  }

  .results-content {
    padding: 24px 20px;
  }

  .info-cards {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .info-card {
    padding: 24px 20px;
    gap: 16px;
  }

  .info-icon {
    width: 48px;
    height: 48px;
  }

  .info-icon svg {
    width: 24px;
    height: 24px;
  }

  .info-value {
    font-size: 1.2rem;
  }

  .btn-secondary {
    padding: 10px 16px;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .results-header {
    padding: 20px 16px;
  }

  .results-content {
    padding: 20px 16px;
  }

  .info-card {
    padding: 20px 16px;
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .info-content {
    text-align: center;
  }
}

/* Mod List Section */
#modsList {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.detected-mods h3 {
  margin: 10px 0;
  color: #333;
  margin-bottom: 12px;
  font-size: 1.5rem;
}
