/* ===== PETRARCANOTES — Global Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --crimson:     #c0392b;
  --crimson-deep:#8b1a1a;
  --crimson-glow:#e74c3c;
  --crimson-soft:#ff6b6b;
  --bg-void:     #0a0a0a;
  --bg-dark:     #111111;
  --bg-card:     #1a1a1a;
  --bg-surface:  #222222;
  --bg-hover:    #2a2a2a;
  --text-primary:#f0e6e6;
  --text-muted:  #8a7070;
  --text-faint:  #4a3a3a;
  --border:      #2e1f1f;
  --border-glow: rgba(192, 57, 43, 0.4);
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --shadow-glow: 0 0 20px rgba(192,57,43,0.25);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.5);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', sans-serif;
  --transition:   0.2s ease;
}

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

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

body {
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(139,26,26,0.12) 0%, transparent 70%);
}

/* ===== Noise texture overlay ===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== Input base ===== */
input, textarea {
  font-family: var(--font-body);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  width: 100%;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, textarea:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.15);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

/* ===== Button base ===== */
.btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-primary {
  background: var(--crimson);
  color: #fff;
}
.btn-primary:hover { background: var(--crimson-glow); transform: translateY(-1px); box-shadow: var(--shadow-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--crimson); color: var(--crimson-soft); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--crimson-deep); border-radius: 99px; }

/* ===== Toast notifications ===== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--crimson);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  box-shadow: var(--shadow-card);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  max-width: 300px;
}
.toast.error { border-left-color: #e74c3c; }
.toast.success { border-left-color: #2ecc71; }

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

/* ===== Loading spinner ===== */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  #toast-container { bottom: 5rem; right: 1rem; left: 1rem; }
  .toast { max-width: 100%; }
}
