/*
 * Photo Lens Studio - Stylesheet (style.css)
 * ---------------------------------------------------
 * Ultra-sleek dark glassmorphism theme, vibrant gradients,
 * micro-animations, and responsive layout.
 */

:root {
  --bg-dark: #0b0f17;
  --bg-panel: #131b2e;
  --bg-card: #1c273e;
  --bg-input: #0f172a;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(99, 102, 241, 0.3);

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header Bar */
.app-header {
  height: 64px;
  background-color: rgba(19, 27, 46, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 26px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-pro {
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* GPS Status Badge */
.gps-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Auth Pill */
.auth-bar {
  display: flex;
  align-items: center;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 24px;
}

.user-avatar-guest {
  font-size: 16px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-email {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Container Layout */
.app-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 960px) {
  .app-container {
    grid-template-columns: 1fr;
    padding: 16px;
  }
}

/* Panel Cards */
.panel-card, .results-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
}

/* Mode Tabs */
.mode-tabs {
  display: flex;
  gap: 8px;
  background-color: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background-color: var(--accent-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* Camera Viewport */
.camera-viewport {
  width: 100%;
  height: 380px;
  background-color: #000;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

#webcam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Camera Overlay Guide Corners */
.camera-overlay-grid {
  position: absolute;
  inset: 20px;
  pointer-events: none;
}

.guide-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.4);
}

.guide-corner.top-left { top: 0; left: 0; border-right: none; border-bottom: none; }
.guide-corner.top-right { top: 0; right: 0; border-left: none; border-bottom: none; }
.guide-corner.bottom-left { bottom: 0; left: 0; border-right: none; border-top: none; }
.guide-corner.bottom-right { bottom: 0; right: 0; border-left: none; border-top: none; }

.camera-placeholder {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(30, 41, 59, 0.9) 0%, rgba(11, 15, 23, 0.95) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 12px;
}

.ph-icon {
  font-size: 48px;
  opacity: 0.8;
}

.camera-status-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-rose);
  display: flex;
  align-items: center;
  gap: 6px;
}

.rec-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-rose);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

/* Camera Controls */
.camera-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.btn-capture {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid var(--accent-primary);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.btn-capture:hover:not(:disabled) {
  transform: scale(1.06);
}

.btn-capture:active:not(:disabled) {
  transform: scale(0.95);
}

.capture-inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
}

.btn-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capture-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 14px;
}

/* Dropzone Upload */
.upload-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  background-color: rgba(15, 23, 42, 0.4);
  transition: all 0.2s ease;
  cursor: pointer;
}

.upload-dropzone.dragover {
  border-color: var(--accent-primary);
  background-color: rgba(99, 102, 241, 0.1);
}

.cloud-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.supported-types {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
}

.paste-badge {
  display: inline-block;
  margin-top: 16px;
  font-size: 11px;
  background-color: var(--bg-card);
  padding: 4px 10px;
  border-radius: 12px;
  color: var(--text-sub);
}

kbd {
  background: #334155;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
}

/* Upload Preview */
.upload-preview-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

#upload-preview-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  object-fit: contain;
}

.preview-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.preview-actions button {
  flex: 1;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.92;
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #2a3754;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Results Section */
.results-card {
  min-height: 520px;
}

.state-container {
  display: flex;
  flex-direction: column;
  flex: 1;
}

#state-empty {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  gap: 12px;
}

.empty-icon {
  font-size: 54px;
  opacity: 0.7;
}

.feature-bullets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.f-item {
  font-size: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 16px;
  color: var(--text-sub);
}

/* Loading State */
#state-loading {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 16px;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.progress-bar-wrap {
  width: 80%;
  height: 8px;
  background-color: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
  transition: width 0.3s ease;
}

.progress-percent {
  font-size: 12px;
  color: var(--text-muted);
}

/* Results Content Display */
.result-header-row {
  display: flex;
  gap: 16px;
  align-items: center;
  background-color: var(--bg-card);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.captured-thumb-box img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.category-info-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cat-icon-large {
  font-size: 32px;
}

.cat-badge {
  display: inline-block;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.cat-details h3 {
  font-size: 16px;
  font-weight: 700;
}

.confidence-tag {
  font-size: 11px;
  color: var(--text-muted);
}

/* Result Blocks */
.result-block {
  background-color: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

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

.block-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-tag, .source-tag {
  font-size: 10px;
  background-color: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-cyan);
  font-weight: 600;
}

.btn-icon-text {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.text-content-viewport {
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  max-height: 220px;
  overflow-y: auto;
  color: var(--text-sub);
}

.summary-bullet-list {
  list-style: none;
}

.summary-bullet-list li {
  margin-bottom: 8px;
  position: relative;
  padding-left: 18px;
}

.summary-bullet-list li::before {
  content: "•";
  color: var(--accent-primary);
  font-weight: bold;
  position: absolute;
  left: 0;
}

/* GPS Block */
.gps-details-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 600px) {
  .gps-details-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.gps-item {
  background-color: var(--bg-card);
  padding: 10px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gps-label {
  font-size: 11px;
  color: var(--text-muted);
}

.gps-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-emerald);
}

.map-link-btn {
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.map-link-btn:hover {
  text-decoration: underline;
}

/* Email Status Banner */
.email-status-banner {
  background-color: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.email-banner-icon {
  font-size: 24px;
}

.email-banner-info {
  flex: 1;
}

.email-banner-info h4 {
  font-size: 13px;
  font-weight: 700;
}

.email-banner-info p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-main);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.auth-tab-btn {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.auth-tab-btn.active {
  color: var(--accent-primary);
  border-bottom: 2px solid var(--accent-primary);
}

.modal-body {
  padding: 20px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-sub);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-error {
  font-size: 12px;
  color: var(--accent-rose);
  margin-bottom: 12px;
  text-align: center;
}

.form-success {
  font-size: 12px;
  color: var(--accent-emerald);
  margin-bottom: 12px;
  text-align: center;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-main);
  box-shadow: var(--shadow-main);
  animation: slideIn 0.2s ease forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.hidden {
  display: none !important;
}
