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

html,
body {
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Helvetica Neue", sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  line-height: 1.6;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Upload Section */
#upload-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(
    circle at 60% 60%,
    rgba(31, 24, 40, 1) 20%,
    rgba(0, 0, 0, 1) 100%
  );
}

.container {
  max-width: 900px;
  width: 100%;
  background: #2a2a2a;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

h1 {
  margin: 0 0 10px 0;
  font-size: 2.5rem;
  text-align: center;
  background: #c92c61;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  text-align: center;
  color: #999;
  margin: 0 0 40px 0;
}

/* File Drop Zones */
.file-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.file-drop-zone {
  background: #1a1a1a;
  border: 2px dashed #444;
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.file-drop-zone:hover {
  border-color: #c92c61;
  background: #222;
}

.file-drop-zone.drag-over {
  border-color: #c92c61;
  background: rgba(201, 44, 97, 0.12);
  transform: scale(1.02);
}

.file-drop-zone.has-file {
  border-color: #4caf50;
  background: #1a2a1a;
}

.file-drop-zone.optional {
  opacity: 0.7;
}

.drop-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.drop-label {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 10px;
}

.file-hint {
  font-size: 0.85rem;
  color: #888;
}

.file-status {
  font-size: 0.9rem;
  color: #4caf50;
  margin-top: 10px;
  min-height: 20px;
  word-break: break-all;
}

.browse-btn {
  background: #444;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.browse-btn:hover {
  background: #555;
}

/* Config Section */
.config-section {
  background: #1a1a1a;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.config-section h3 {
  margin-top: 0;
  color: #999;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.config-item label {
  display: block;
  margin-bottom: 8px;
  color: #aaa;
  font-size: 0.9rem;
}

.config-item input[type="number"],
.config-item select {
  width: 100%;
  padding: 8px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 1rem;
}

.config-item input[type="checkbox"] {
  margin-right: 8px;
}

/* Buttons */
.run-btn {
  width: 100%;
  padding: 15px;
  background: #c92c61;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.2s,
    opacity 0.2s;
}

.run-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(201, 44, 97, 0.4);
}

.run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-btn {
  padding: 10px 20px;
  background: #444;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
  margin-left: 10px;
}

.secondary-btn:hover {
  background: #555;
}

/* Progress */
#progress-section {
  margin-top: 20px;
}

.progress-bar {
  width: 100%;
  height: 30px;
  background: #1a1a1a;
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: #c92c61;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
}

/* Results Section (similar to template) */
#results-section {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.results-header {
  background: #2a2a2a;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #444;
}

.results-header h2 {
  margin: 0;
  flex: 1;
  font-size: 1.5rem;
}

#frame {
  background-color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  flex-shrink: 0;
}

#frame img {
  width: 320px;
  height: 288px;
  background-color: #fff;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#timeline-scroll {
  width: 100%;
  overflow-x: scroll;
  background-color: #222;
  border-top: 1px solid #000;
  flex-shrink: 0;
}

#timeline {
  display: flex;
  padding: 10px;
}

#timeline > button {
  flex-shrink: 0;
  border: 0;
  padding: 0;
  border: 5px solid black;
  box-sizing: border-box;
  margin-right: 5px;
  cursor: pointer;
}

#timeline > button:focus,
#timeline > button.focus {
  outline: 4px solid #c92c61;
  z-index: 1;
}

#frame-info {
  flex-grow: 1;
  background: #000;
  display: flex;
  flex-direction: column;
}

#frame-header {
  display: flex;
  padding: 10px;
  margin: 0;
  font-size: 14px;
  font-weight: bold;
  background-color: #444;
  border-top: 1px solid #555;
  border-bottom: 1px solid #222;
  color: #eee;
  align-items: center;
}

#flame-graph-scroll {
  width: 100%;
  overflow-x: scroll;
  flex-grow: 1;
}

#flame-graph {
  position: relative;
  width: 100%;
}

#flame-graph > div {
  position: absolute;
  border: 1px solid #000;
  color: #000;
  border-top: 0;
  height: 30px;
  box-sizing: border-box;
  font-size: 10px;
  padding: 2px;
  line-height: 13px;
}

#flame-graph > div:hover {
  margin-top: -1px;
  border: 1px solid #c92c61;
  outline: 1px solid #c92c61;
  cursor: pointer;
}

#flame-graph > div[data-title]:hover::after {
  z-index: 1000;
  display: inline-block;
  content: attr(data-title);
  position: sticky;
  top: -100%;
  left: 10px;
  background-color: #fff;
  color: #000;
  outline: 2px solid #000;
  font-family: monospace;
  white-space: pre;
  pointer-events: none;
  padding: 5px;
}

#flame-graph > div > div {
  display: inline-block;
  position: sticky;
  left: 0px;
}

.flex-grow {
  flex-grow: 1;
}

label {
  user-select: none;
}

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

  h1 {
    font-size: 2rem;
  }

  .file-inputs {
    grid-template-columns: 1fr;
  }

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

  #frame img {
    width: 240px;
    height: 216px;
  }
}
