/* ===========================
   m.AI.life — Global Styles
   =========================== */

:root {
  --primary: #7C3AED;
  --primary-light: #A78BFA;
  --primary-dark: #5B21B6;
  --accent: #06B6D4;
  --bg: #0F0F1A;
  --surface: #1A1A2E;
  --surface2: #252538;
  --surface3: #2E2E45;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --text-faint: #475569;
  --border: #2D2D44;
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===========================
   UTILITY
   =========================== */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.gradient-text {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: white; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary-light); text-decoration: none; }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1.5px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-google {
  background: white;
  color: #3C4043;
  border: 1.5px solid #DADCE0;
  width: 100%;
  justify-content: center;
  font-size: 16px;
  padding: 14px 24px;
}
.btn-google:hover { background: #F8F9FA; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

.btn-lg { padding: 16px 32px; font-size: 17px; border-radius: var(--radius-lg); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }

/* ===========================
   INPUTS
   =========================== */
.input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font);
  transition: border-color 0.2s;
  outline: none;
}
.input:focus { border-color: var(--primary); }
.input::placeholder { color: var(--text-faint); }

.textarea {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font);
  resize: vertical;
  outline: none;
  line-height: 1.6;
  transition: border-color 0.2s;
}
.textarea:focus { border-color: var(--primary); }
.textarea::placeholder { color: var(--text-faint); }

.input-note {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
}
.input-note.warning { color: var(--warning); }

.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-top: 12px;
}

/* ===========================
   BRAND
   =========================== */
.brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}
.brand-name.lg { font-size: 36px; }
.brand-name.sm { font-size: 18px; }
.brand-accent { color: var(--primary-light); }
.brand-icon { font-size: 20px; }

/* ===========================
   LANGUAGE SWITCHER
   =========================== */
.lang-switcher {
  display: flex;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.lang-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  background: var(--primary);
  color: white;
}
.lang-switcher.sm .lang-btn {
  font-size: 11px;
  padding: 3px 7px;
}

/* ===========================
   LANDING PAGE
   =========================== */
body.landing { background: var(--bg); }

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(15,15,26,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 80px 24px 60px;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-content { flex: 1; max-width: 560px; }

.hero-badge {
  display: inline-block;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  color: var(--primary-light);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(42px, 7vw, 64px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 36px;
}

.hero-actions { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.hero-note { font-size: 13px; color: var(--text-faint); }

/* Phone mockup */
.hero-visual { flex-shrink: 0; }

.phone-mockup {
  width: 260px;
  background: var(--surface);
  border-radius: 36px;
  border: 2px solid var(--border);
  padding: 20px 16px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(124,58,237,0.15);
}

.phone-screen { display: flex; flex-direction: column; gap: 16px; }

.mock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mock-date { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.mock-dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.mock-rec-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
  position: relative;
}
.mock-mic-ring {
  position: absolute;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(124,58,237,0.15);
  border: 2px solid rgba(124,58,237,0.3);
  animation: ringPulse 2s infinite;
}
.mock-mic {
  font-size: 28px;
  position: relative;
  z-index: 1;
}
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}

.mock-memo {
  background: var(--surface2);
  border-radius: 10px;
  padding: 12px;
}
.mock-memo-date { font-size: 11px; color: var(--text-faint); margin-bottom: 4px; }
.mock-memo-text { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Features */
.features { padding: 80px 24px; }
.container { max-width: 1100px; margin: 0 auto; }
.section-title {
  text-align: center;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.feature-icon { font-size: 32px; margin-bottom: 14px; }
.feature-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* How it works */
.how { padding: 80px 24px; background: var(--surface); }
.steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.step {
  flex: 1;
  min-width: 200px;
  max-width: 280px;
  text-align: center;
}
.step-num {
  width: 48px; height: 48px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  margin: 0 auto 16px;
}
.step h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.step-arrow {
  font-size: 24px;
  color: var(--text-faint);
  padding-top: 20px;
  flex-shrink: 0;
}

/* Install as App section */
.install-section { padding: 80px 24px; background: var(--surface); }
.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 17px;
  margin-top: -28px;
  margin-bottom: 48px;
}
.install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}
.install-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.install-os {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text);
}
.install-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}
.install-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}
.install-step-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.install-steps strong { color: var(--text); }
.install-note {
  font-size: 13px;
  color: var(--warning);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  padding: 8px 12px;
  border-radius: 8px;
}
.install-note.success {
  color: var(--success);
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.2);
}

/* CTA section */
.cta-section {
  padding: 80px 24px;
  text-align: center;
}
.cta-section h2 { font-size: 40px; font-weight: 900; letter-spacing: -1px; }
.cta-section p { color: var(--text-muted); margin: 12px 0 32px; font-size: 18px; }

/* Footer */
.footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer .container { display: flex; align-items: center; justify-content: center; gap: 12px; }
.footer-sep { color: var(--text-faint); }
.footer-note { font-size: 13px; color: var(--text-faint); }

/* ===========================
   APP SCREENS
   =========================== */
body.app-body {
  background: var(--bg);
  height: 100dvh;
  overflow: hidden;
}

.screen { width: 100%; height: 100dvh; }
.screen-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Login */
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.app-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 8px; }
.logo-icon { font-size: 40px; }
.login-subtitle { color: var(--text-muted); font-size: 15px; margin-bottom: 32px; }
.login-note { font-size: 12px; color: var(--text-faint); margin-top: 16px; line-height: 1.5; }

/* Setup */
.setup-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 480px;
}
.setup-box h2 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.setup-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.setup-step { margin-bottom: 24px; }
.setup-step-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.setup-step-num {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}
.setup-step-header h3 { font-size: 16px; font-weight: 700; }
.setup-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }

/* Unlock */
.unlock-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.app-logo.small .logo-icon { font-size: 28px; }
.unlock-greeting { color: var(--text-muted); font-size: 15px; }

/* APP HEADER */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* DROPDOWN MENU */
.dropdown {
  position: absolute;
  top: 56px;
  right: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 220px;
  overflow: hidden;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.dropdown-item:hover { background: var(--surface3); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* SEARCH BAR */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 57px;
  z-index: 40;
}
.search-icon { color: var(--text-faint); flex-shrink: 0; }
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
}
.search-input::placeholder { color: var(--text-faint); }
.clear-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  line-height: 1;
}

/* MEMO LIST */
.memo-list-container {
  overflow-y: auto;
  height: calc(100dvh - 57px - 56px - 80px);
  padding: 16px;
}
.memo-list { display: flex; flex-direction: column; gap: 10px; }

.memo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  animation: fadeIn 0.2s ease;
}
.memo-card:hover { border-color: var(--primary); transform: translateX(2px); }
.memo-card:active { transform: scale(0.99); }

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

.memo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.memo-card-date { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.memo-card-tag {
  font-size: 11px;
  background: rgba(124,58,237,0.15);
  color: var(--primary-light);
  padding: 2px 8px;
  border-radius: 100px;
}
.memo-card-preview {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.memo-card-preview mark {
  background: rgba(124,58,237,0.3);
  color: var(--primary-light);
  border-radius: 3px;
  padding: 0 2px;
}

.memo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--text-faint);
}
.empty-icon { font-size: 48px; opacity: 0.5; }

.memo-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 0;
  color: var(--text-faint);
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* FAB */
.fab-container {
  position: fixed;
  bottom: 28px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
}

.fab {
  width: 64px; height: 64px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(124,58,237,0.5);
  transition: all 0.2s ease;
}
.fab:hover { background: var(--primary-dark); transform: scale(1.05); }
.fab:active { transform: scale(0.95); }
.fab.recording {
  background: var(--danger);
  box-shadow: 0 4px 20px rgba(239,68,68,0.5);
  animation: fabPulse 1.5s ease infinite;
}
@keyframes fabPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(239,68,68,0.5); }
  50% { box-shadow: 0 4px 40px rgba(239,68,68,0.8), 0 0 0 12px rgba(239,68,68,0.1); }
}

.rec-timer {
  background: rgba(239,68,68,0.9);
  color: white;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 100px;
}

/* MODALS */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px;
  width: 100%;
  max-height: 85dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-date { font-size: 16px; font-weight: 700; }
.modal-duration { font-size: 13px; color: var(--text-faint); margin-top: 2px; }
.modal-text {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
}
.modal-actions { display: flex; gap: 10px; padding-top: 8px; }

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 500;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 14px;
  white-space: nowrap;
  animation: toastIn 0.2s ease;
  box-shadow: var(--shadow);
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    padding: 48px 20px 40px;
    text-align: center;
  }
  .hero-actions { align-items: center; }
  .hero-visual { display: none; }
  .steps { flex-direction: column; align-items: center; }
  .step-arrow { transform: rotate(90deg); padding: 0; }
  .setup-box { padding: 28px 20px; }
}

@media (min-width: 768px) {
  .modal { align-items: center; justify-content: center; }
  .modal-content {
    border-radius: var(--radius-xl);
    max-width: 520px;
    animation: fadeInScale 0.2s ease;
  }
  @keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
  }
}
