/* PotatoGuard - Component Styles */

/* ========================================
   BUTTONS
======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  min-height: 56px;
  cursor: pointer;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: var(--text-inverse);
  box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    var(--primary-light) 0%,
    var(--primary) 100%
  );
  opacity: 0;
  z-index: -1;
  transition: opacity var(--transition-base);
}

.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(5, 150, 105, 0.4);
  transform: translateY(-2px);
}

.btn-primary:hover::before {
  opacity: 1;
}

/* Secondary Button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(4px);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Outline Button */
.btn-outline {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-inverse);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(4px);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--text-inverse);
  transform: translateY(-2px);
}

/* Large Button */
.btn-lg {
  padding: 1.25rem 2.5rem;
  font-size: var(--font-size-lg);
  min-height: 64px;
}

/* Full Width */
.btn-block {
  width: 100%;
}

/* Scan Button (Floating Action) */
.btn-scan {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-dark) 100%
  );
  color: var(--text-inverse);
  font-size: var(--font-size-sm);
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 25px rgba(132, 204, 22, 0.4);
  border: 4px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-bounce);
  text-transform: uppercase;
}

.btn-scan:hover {
  transform: scale(1.1) translateY(-4px);
  box-shadow: 0 12px 35px rgba(132, 204, 22, 0.6);
  border-color: rgba(255, 255, 255, 0.6);
}

.btn-scan:active {
  transform: scale(0.95);
}

/* Icon Button */
.btn-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.btn-icon:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: scale(1.05);
}

/* ========================================
   CAMERA
======================================== */
.camera-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #111;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-canvas {
  display: none;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.3) 100%);
}

/* Frame Guide */
.camera-frame {
  width: 280px;
  height: 280px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  position: relative;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5); /* Focus effect */
}

/* Corner accents */
.camera-frame-corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 4px solid var(--accent);
  filter: drop-shadow(0 0 8px rgba(132, 204, 22, 0.5));
}

.camera-frame-corner.top-left {
  top: -2px;
  left: -2px;
  border-right: none;
  border-bottom: none;
  border-radius: var(--radius-lg) 0 0 0;
}
.camera-frame-corner.top-right {
  top: -2px;
  right: -2px;
  border-left: none;
  border-bottom: none;
  border-radius: 0 var(--radius-lg) 0 0;
}
.camera-frame-corner.bottom-left {
  bottom: -2px;
  left: -2px;
  border-right: none;
  border-top: none;
  border-radius: 0 0 0 var(--radius-lg);
}
.camera-frame-corner.bottom-right {
  bottom: -2px;
  right: -2px;
  border-left: none;
  border-top: none;
  border-radius: 0 0 var(--radius-lg) 0;
}

.camera-hint {
  position: absolute;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-inverse);
  font-size: var(--font-size-sm);
  font-weight: 500;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

/* Camera Controls */
.camera-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xl);
  padding: var(--space-xl) var(--space-md);
  margin-top: -40px; /* Overlap with monitor */
  position: relative;
  z-index: 10;
}

/* ========================================
   RESULT CARD
======================================== */
.result-card {
  /* Inherits glass-panel properties via class in HTML */
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
}

.result-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.result-image {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow-md);
  border: 4px solid #fff;
}

.result-status {
  flex: 1;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
  letter-spacing: 0.05em;
}

.result-badge.healthy {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.result-badge.disease {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.result-badge.unknown {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-light);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.result-title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

/* Confidence Bar */
.confidence-bar {
  margin-bottom: var(--space-lg);
  background: rgba(255, 255, 255, 0.5);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.confidence-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.confidence-track {
  height: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-full);
  transition: width var(--transition-bounce);
  position: relative;
}

.confidence-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: shine 2s infinite;
}

@keyframes shine {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* Solution Section */
.result-solution {
  padding-top: var(--space-lg);
  border-top: 1px dashed rgba(6, 78, 59, 0.1);
}

.result-solution-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--primary-dark);
}

.result-solution-text {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ========================================
   LOADING
======================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 64px;
  height: 64px;
  border: 4px solid rgba(5, 150, 105, 0.1);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

/* ========================================
   UPLOAD
======================================== */
.upload-area {
  border: 2px dashed rgba(6, 78, 59, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-base);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.8);
  transform: scale(1.02);
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-md);
  color: var(--primary);
}
