/* ══════════════════════════════════════════
   NoteSnap · styles.css
   Tema: Editorial mínimalista con acento cálido
   Fuentes: DM Serif Display + DM Sans
══════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg: #f7f5f0;
  --bg-card: #ffffff;
  --bg-card2: #fafaf8;
  --ink: #1a1814;
  --ink-soft: #6b6760;
  --ink-muted: #a8a49e;
  --accent: #c8522a;
  /* terracota cálido */
  --accent-light: #fff0eb;
  --accent-hover: #a8421d;
  --premium: #2a6648;
  /* verde profundo */
  --premium-bg: #eaf5ee;
  --border: #e8e4dd;
  --border-focus: #c8522a;
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 2px 20px rgba(26, 24, 20, 0.07);
  --shadow-lg: 0 8px 40px rgba(26, 24, 20, 0.12);
  --font-display: "DM Serif Display", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --transition: 0.2s ease;
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ── */
.screen {
  display: none;
}

.screen.active {
  display: flex;
}

/* ══════════════════════════════════════
   AUTH SCREEN
══════════════════════════════════════ */
#auth-screen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(
      ellipse 60% 50% at 20% 30%,
      rgba(200, 82, 42, 0.08) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 50% 60% at 80% 70%,
      rgba(200, 82, 42, 0.05) 0%,
      transparent 70%
    ),
    var(--bg);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 52px 48px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeUp 0.5s ease both;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.brand-icon {
  font-size: 22px;
  color: var(--accent);
  animation: spin 8s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.brand-name {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.brand-tagline {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 36px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-note {
  font-size: 12px;
  color: var(--ink-muted);
}

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-google {
  background: var(--bg-card);
  color: var(--ink);
  border: 1.5px solid var(--border);
  width: 100%;
}

.btn-google:hover {
  border-color: #4285f4;
  background: #f0f4ff;
}

.btn-secondary {
  background: var(--bg);
  color: var(--ink-soft);
  border: 1.5px solid var(--border);
  width: 100%;
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--ink);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 13px 28px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(200, 82, 42, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.loading .btn-text::after {
  content: "...";
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--border);
  font-size: 13px;
  padding: 9px 18px;
  margin-top: 8px;
}

.btn-ghost:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}

.btn-premium {
  background: var(--premium);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-premium:hover {
  background: #1e5038;
  transform: translateY(-1px);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.btn-icon:hover {
  color: var(--ink);
  background: var(--border);
}

/* ══════════════════════════════════════
   APP SCREEN
══════════════════════════════════════ */
#app-screen {
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 245, 240, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-sm .brand-name {
  font-size: 19px;
}

.brand-sm .brand-icon {
  font-size: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-name {
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
}

.usage-badge.premium {
  background: var(--premium-bg);
  color: var(--premium);
}

/* ── Main ── */
.app-main {
  flex: 1;
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Hero ── */
.hero {
  margin-bottom: 8px;
  animation: fadeUp 0.5s ease both;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--ink);
  margin-bottom: 12px;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 480px;
  line-height: 1.6;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fadeUp 0.4s ease both;
}

/* ── Input card ── */
.input-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.notes-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg-card2);
  resize: vertical;
  min-height: 200px;
  line-height: 1.6;
  transition: border-color var(--transition);
  outline: none;
}

.notes-textarea::placeholder {
  color: var(--ink-muted);
}

.notes-textarea:focus {
  border-color: var(--border-focus);
  background: #fff;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.char-count {
  font-size: 12px;
  color: var(--ink-muted);
}

/* ── Loading ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
}

.spinner {
  display: flex;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s ease-in-out infinite;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-12px);
    opacity: 1;
  }
}

.loading-text {
  font-size: 14px;
  color: var(--ink-soft);
}

/* ── Result grid ── */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.result-card {
  padding: 24px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.result-icon {
  font-size: 20px;
}

.result-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
}

.result-content {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ── Banners ── */
.limit-banner {
  background: var(--premium-bg);
  border: 1.5px solid #b8dec9;
  border-radius: var(--radius);
  padding: 20px 24px;
  animation: fadeUp 0.3s ease both;
}

.limit-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.limit-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.limit-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--premium);
  margin-bottom: 2px;
}

.limit-sub {
  font-size: 13px;
  color: #4a8a68;
}

.error-banner {
  background: #fff3f0;
  border: 1.5px solid #ffb8a8;
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #8b2a1a;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

/* ── Footer ── */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ── Utilities ── */
.hidden {
  display: none !important;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 600px) {
  .auth-card {
    padding: 36px 24px;
  }

  .app-main {
    padding: 32px 16px 60px;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .limit-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .btn-primary {
    width: 100%;
  }

  .user-name {
    max-width: 80px;
  }
}
