:root {
  --bg-main: #07090e;
  --bg-card: rgba(18, 24, 38, 0.65);
  --bg-card-hover: rgba(28, 37, 58, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --font-main: 'Outfit', sans-serif;
  --font-code: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Background Glowing Orbs */
.background-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
}

.glow-1 {
  top: -10%;
  left: -5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-purple), transparent);
}

.glow-2 {
  bottom: 5%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-cyan), transparent);
}

.glow-3 {
  top: 40%;
  left: 50%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #047857, transparent);
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 2.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.75rem;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tag {
  font-size: 0.75rem;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: white;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.4);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent-emerald);
}

.pulse {
  width: 10px;
  height: 10px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulsing 2s infinite;
}

@keyframes pulsing {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Telemetry Bar */
.telemetry-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.telemetry-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.telemetry-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
}

.telemetry-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.telemetry-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-code);
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.telemetry-value small {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
  border-radius: 4px;
  transition: width 0.5s ease, background 0.5s ease;
}

.progress-bar-fill.warning {
  background: linear-gradient(90deg, var(--accent-yellow), var(--accent-red));
}

.telemetry-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

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

.panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
  font-size: 1.35rem;
  font-weight: 600;
}

.badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-code);
}

.badge.hidden { display: none; }

/* Controls & Slider */
.control-group {
  margin-bottom: 1.5rem;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.highlight-val {
  color: var(--accent-cyan);
  font-weight: 700;
  font-family: var(--font-code);
}

input[type="range"] {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  accent-color: var(--accent-cyan);
}

.help-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 3rem 2rem;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 1.5rem;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
  transform: scale(0.995);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.drop-content h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.drop-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.hidden-input { display: none; }

/* Buttons */
.btn {
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: white;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
  padding: 1rem;
  font-size: 1rem;
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.5);
}

/* Results Display */
.results-container {
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.empty-state {
  margin: auto;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  max-width: 320px;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Result Card */
.result-card {
  display: flex;
  gap: 1.5rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  animation: fadeIn 0.4s ease forwards;
}

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

@media (max-width: 640px) {
  .result-card { flex-direction: column; }
}

.result-img-box {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  background: #000;
}

.result-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.result-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.filename-txt {
  font-weight: 600;
  font-size: 1.05rem;
  word-break: break-all;
}

.status-badge {
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.status-badge.nsfw {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
}

.status-badge.safe {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
}

/* Prediction Bars */
.pred-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pred-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pred-name {
  width: 75px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pred-bar-wrap {
  flex-grow: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.pred-bar-val {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.pred-bar-val.safe-bar { background: linear-gradient(90deg, #10b981, #059669); }
.pred-bar-val.warn-bar { background: linear-gradient(90deg, #f59e0b, #d97706); }
.pred-bar-val.danger-bar { background: linear-gradient(90deg, #ef4444, #dc2626); }

.pred-percent {
  width: 50px;
  text-align: right;
  font-size: 0.85rem;
  font-family: var(--font-code);
  font-weight: 600;
}

/* API Panel */
.api-panel {
  margin-top: 1rem;
}

.tab-buttons {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 500;
  transition: all 0.2s ease;
}

.tab-btn:hover { color: white; }
.tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.code-block {
  display: none;
  background: #040609;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 0.9rem;
  color: #a5b4fc;
  line-height: 1.6;
}

.code-block.active { display: block; }
