/* ==========================================================================
   RoastLab | Apple-Inspired Clean Aesthetic & Sprint 6 Atmosphere
   ========================================================================== */

:root {
  --bg-color: #f5f5f7;
  --card-bg: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --accent-blue: #0071e3;
  --accent-blue-hover: #0077ed;
  --accent-warm: #e05242;
  --accent-warm-hover: #d04333;
  --border-light: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.47059;
  font-weight: 400;
  letter-spacing: -0.022em;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.4s ease;
}

/* Subtle Atmosphere Overlays */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 600px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  transition: opacity 0.5s ease, background 0.5s ease;
}

body.mode-self::before {
  background: radial-gradient(circle at 50% -20%, rgba(0, 113, 227, 0.12) 0%, rgba(245, 245, 247, 0) 70%);
}

body.mode-friend::before {
  background: radial-gradient(circle at 50% -20%, rgba(224, 82, 66, 0.12) 0%, rgba(245, 245, 247, 0) 70%);
}

.container {
  width: 100%;
  max-width: 580px;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Header & Mode Switcher
   ========================================================================== */

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

.hero-top-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.badge-pill {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.mode-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.mode-switch-link {
  color: var(--accent-blue);
  font-size: 11px;
  font-weight: 600;
  margin-left: 2px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ==========================================================================
   Main Cards & Form
   ========================================================================== */

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.input-group {
  display: flex;
  gap: 10px;
}

input[type="text"] {
  flex: 1;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: #fbfbfd;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

input[type="text"]:focus {
  border-color: var(--accent-blue);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

button#scanBtn {
  padding: 14px 22px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--accent-blue);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

body.mode-friend button#scanBtn {
  background: var(--accent-warm);
}

button#scanBtn:hover {
  background: var(--accent-blue-hover);
  transform: translateY(-1px);
}

body.mode-friend button#scanBtn:hover {
  background: var(--accent-warm-hover);
}

/* ==========================================================================
   Scanning Interface
   ========================================================================== */

.scan-container {
  display: none;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.scan-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-blue);
  border-radius: var(--radius-pill);
  transition: width 0.1s linear;
}

body.mode-friend .progress-fill {
  background: var(--accent-warm);
}

.scan-single-line {
  min-height: 20px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.scan-step-text {
  display: inline-block;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.scan-step-text.fade-out {
  opacity: 0;
  transform: translateY(-4px);
}

.scan-step-text.fade-in {
  opacity: 0;
  transform: translateY(4px);
}

/* ==========================================================================
   Report Section
   ========================================================================== */

.report-section {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.report-section.show {
  opacity: 1;
  transform: translateY(0);
}

.report-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  margin-bottom: 20px;
}

.report-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge {
  color: #34c759;
}

.divider {
  border: none;
  height: 1px;
  background: var(--border-light);
  margin: 18px 0;
}

.report-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.block-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.primary-roast-text {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.evidence-text, .diagnosis-text, .recovery-text {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.45;
}

.actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: #f0f0f2;
}

.action-btn-primary {
  background: var(--accent-blue);
  color: #ffffff;
  border: none;
}

body.mode-friend .action-btn-primary {
  background: var(--accent-warm);
}

.action-btn-primary:hover {
  background: var(--accent-blue-hover);
}

body.mode-friend .action-btn-primary:hover {
  background: var(--accent-warm-hover);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.main-footer {
  text-align: center;
  margin-top: 32px;
  color: var(--text-secondary);
  font-size: 13px;
}

.footer-primary {
  font-weight: 500;
  margin-bottom: 4px;
}

.footer-secondary {
  font-size: 12px;
  opacity: 0.8;
}

/* ==========================================================================
   Modal Component (Sprint 6)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.8);
  text-align: center;
  transform: scale(0.94) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  margin-bottom: 24px;
}

.modal-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-top: 12px;
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.modal-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.mode-option-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.mode-icon {
  font-size: 28px;
  line-height: 1;
}

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

.mode-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.mode-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  body {
    padding: 20px 14px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .input-group {
    flex-direction: column;
  }

  button#scanBtn {
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }

  .modal-card {
    padding: 24px 20px;
  }
}