@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap");

:root {
  --bg-color: #050a15;
  --glass-bg: rgba(15, 23, 42, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --accent-cyan: #00f2fe;
  --accent-purple: #4facfe;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --glow-cyan: rgba(0, 242, 254, 0.18);
  --glow-green: rgba(16, 185, 129, 0.18);
  --glow-yellow: rgba(245, 158, 11, 0.18);
  --glow-red: rgba(239, 68, 68, 0.18);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --transition: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Outfit", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(
      ellipse at 15% 50%,
      rgba(26, 11, 46, 0.85),
      transparent 55%
    ),
    radial-gradient(
      ellipse at 85% 30%,
      rgba(10, 17, 40, 0.85),
      transparent 55%
    ),
    radial-gradient(ellipse at 50% 100%, rgba(0, 30, 60, 0.4), transparent 60%),
    linear-gradient(135deg, #02040a 0%, #050a15 50%, #0a0518 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── NAVBAR ── */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  height: 70px;
  background: rgba(5, 10, 21, 0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-content {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
}

.logo {
  font-family: "Outfit", monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 40px;
}

.nav-links span {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 500;
  transition:
    color 0.25s,
    text-shadow 0.25s;
  position: relative;
  padding-bottom: 4px;
}

.nav-links span::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  transition: width 0.3s ease;
}

.nav-links span:hover,
.nav-links span.active {
  color: var(--text-primary);
  text-shadow: 0 0 12px rgba(0, 242, 254, 0.45);
}

.nav-links span:hover::after,
.nav-links span.active::after {
  width: 100%;
}

/* ── CENTER LAYOUT (index.html) ── */
.center-layout {
  justify-content: center;
  align-items: center;
}

.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 650px;
  padding: 20px;
  margin: auto;
  z-index: 1;
  animation: slideUpFade 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-section {
  text-align: center;
  margin-bottom: 40px;
}

.hero-title {
  font-size: 46px;
  font-weight: 800;
  margin: 0 0 15px 0;
  background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* ── UPLOAD CONTAINER ── */
.upload-container {
  width: 100%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 30px 60px -15px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
  position: relative;
  overflow: hidden;
}

.upload-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 242, 254, 0.25),
    rgba(79, 172, 254, 0.25),
    transparent
  );
}

.upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  border: 2px dashed rgba(79, 172, 254, 0.4);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  background: rgba(0, 0, 0, 0.25);
}

.upload-box:hover,
.upload-box.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.06);
  transform: scale(1.02);
  box-shadow:
    0 0 50px rgba(0, 242, 254, 0.12),
    inset 0 0 30px rgba(0, 242, 254, 0.03);
}

.upload-icon {
  font-size: 56px;
  margin-bottom: 15px;
  transition: transform 0.35s ease;
  filter: drop-shadow(0 0 12px var(--glow-cyan));
}

.upload-box:hover .upload-icon {
  transform: translateY(-6px);
  filter: drop-shadow(0 0 20px rgba(0, 242, 254, 0.4));
}

.upload-box h2 {
  font-size: 22px;
  margin: 0 0 8px 0;
  font-weight: 700;
}

.upload-box p {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0;
}

.upload-box input {
  display: none;
}

/* ── PREVIEW ── */
.hidden {
  display: none !important;
}

#preview-container {
  margin-top: 25px;
  text-align: center;
}

#preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

.preview-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  animation: scaleIn 0.3s ease;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.preview-image:hover {
  transform: scale(1.08);
  box-shadow: 0 0 20px var(--glow-cyan);
}

/* ── BUTTONS ── */
.action-container {
  margin-top: 35px;
  display: flex;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #ffffff;
  border: none;
  padding: 18px 45px;
  font-family: "Outfit", sans-serif;
  font-size: 16px;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  max-width: 400px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  box-shadow:
    0 10px 30px rgba(0, 242, 254, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.03);
  box-shadow:
    0 20px 45px rgba(0, 242, 254, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 5px 15px rgba(0, 242, 254, 0.2);
}

.btn-primary:disabled {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
  cursor: not-allowed;
  border: 1px solid var(--glass-border);
}

.btn-small {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: "Outfit", sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition:
    background 0.25s,
    box-shadow 0.25s;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #c0392b);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.btn-danger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ── DIVIDER ── */
.divider {
  margin: 30px 0;
  text-align: center;
  opacity: 0.5;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

/* ── CAMERA ── */
.camera-container {
  margin-top: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.camera-container .btn-primary {
  width: 100%;
  max-width: 400px;
}

.camera-view {
  margin-top: 20px;
  width: 100%;
  max-width: 400px;
}

.camera-view video {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.camera-actions {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ── DASHBOARD (result.html) ── */
.dashboard-container {
  width: 100%;
  max-width: 1200px;
  padding: 40px;
  margin: 70px auto 0;
}

.dashboard-header {
  margin-bottom: 40px;
  text-align: center;
}

.dashboard-header h1 {
  font-size: 36px;
  font-weight: 800;
  margin: 0 0 10px 0;
  letter-spacing: -0.5px;
}

.dashboard-header .subtitle {
  color: var(--text-secondary);
  margin: 0;
  font-size: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* ── PANELS ── */
.panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: slideUpFade 0.6s ease forwards;
  opacity: 0;
  transform: translateY(30px);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  position: relative;
  overflow: hidden;
  transition:
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
}

.panel:hover {
  box-shadow:
    0 30px 60px -12px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  transform: translateY(-2px);
}

.panel:nth-child(1) {
  animation-delay: 0.1s;
}
.panel:nth-child(2) {
  animation-delay: 0.2s;
}
.panel:nth-child(3) {
  animation-delay: 0.3s;
}
.panel:nth-child(4) {
  animation-delay: 0.4s;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.panel h2 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
}

/* ── PANEL SPANS ── */
.image-panel {
  grid-column: span 1;
  grid-row: span 2;
  display: flex;
  flex-direction: column;
}

.top-prediction-panel {
  grid-column: span 1;
}
.stats-panel {
  grid-column: span 1;
}
.chart-panel {
  grid-column: span 2;
}

/* ── IMAGE WRAPPER ── */
.image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--glass-border);
  flex-grow: 1;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9);
}

.full-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transition: opacity 0.5s ease;
}

.overlay-img {
  opacity: 0;
  mix-blend-mode: screen;
}

.overlay-img.active {
  opacity: 0.85;
}

/* ── TOP PREDICTION ── */
.primary-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px 0;
}

.top-breed {
  font-size: 30px;
  margin: 0 0 20px 0;
  text-align: center;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.confidence-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Mono", monospace;
  font-size: 26px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.4);
  border: 3px solid var(--glass-border);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}

/* Confidence glow states */
.high-glow {
  border-top: 2px solid var(--accent-green);
  box-shadow: 0 -10px 40px var(--glow-green);
}
.high-glow .confidence-circle {
  border-color: var(--accent-green);
  color: var(--accent-green);
  text-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
  box-shadow:
    0 0 30px var(--glow-green),
    inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.medium-glow {
  border-top: 2px solid var(--accent-yellow);
  box-shadow: 0 -10px 40px var(--glow-yellow);
}
.medium-glow .confidence-circle {
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
  text-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
  box-shadow:
    0 0 30px var(--glow-yellow),
    inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.low-glow {
  border-top: 2px solid var(--accent-red);
  box-shadow: 0 -10px 40px var(--glow-red);
}
.low-glow .confidence-circle {
  border-color: var(--accent-red);
  color: var(--accent-red);
  text-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
  box-shadow:
    0 0 30px var(--glow-red),
    inset 0 0 20px rgba(0, 0, 0, 0.6);
}

/* ── INSIGHTS ── */
.insights-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.insights-box h3 {
  font-size: 11px;
  margin: 0 0 8px 0;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}

.insights-box p {
  font-size: 15px;
  margin: 0;
  line-height: 1.6;
  font-weight: 500;
}

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.stat-card {
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition:
    background 0.25s,
    border-color 0.25s;
}

.stat-card:hover {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.1);
}

.stat-icon {
  font-size: 22px;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-family: "Space Mono", monospace;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

/* ── CHART ── */
.chart-container {
  height: 280px;
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
}

/* ── DASHBOARD FOOTER ── */
.dashboard-footer {
  margin-top: 40px;
  padding-bottom: 40px;
  text-align: center;
}

.dashboard-footer .btn-primary {
  width: auto;
}

/* ── LOADING OVERLAY ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 21, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loader-box {
  text-align: center;
  animation: scaleIn 0.35s ease;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top: 3px solid var(--accent-cyan);
  border-right: 3px solid var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 25px;
  box-shadow: 0 0 25px var(--glow-cyan);
}

.loader-box h2 {
  margin: 0 0 10px 0;
  color: #fff;
  font-size: 28px;
  font-weight: 800;
}

.loader-box p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 16px;
}

/* ── ANIMATIONS ── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .image-panel,
  .top-prediction-panel,
  .stats-panel,
  .chart-panel {
    grid-column: span 1;
    grid-row: span 1;
  }
  .main-content {
    padding: 15px;
  }
  .upload-box {
    padding: 30px 15px;
  }
  .hero-title {
    font-size: 32px;
  }
  .nav-content {
    padding: 0 20px;
  }
}
