/* ═══════════════════════════════════════════════════
   Letter Page — Premium Dark Theme
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500;600&family=Dancing+Script:wght@500;700&display=swap');

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --text-primary: #e8e4df;
  --text-secondary: #a09a92;
  --text-muted: #6b6560;
  --accent: #c4956a;
  --accent-glow: rgba(196, 149, 106, 0.25);
  --accent-soft: #d4a87a;
  --special-gradient: linear-gradient(135deg, #f5c77e, #e8935a, #d46b8a, #b05ce6);
  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(196, 149, 106, 0.3);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(196, 149, 106, 0.1);
  --radius: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Background ambience ─── */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(196, 149, 106, 0.04) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(180, 120, 200, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: ambientDrift 20s ease-in-out infinite alternate;
}

@keyframes ambientDrift {
  from { transform: translate(0, 0) rotate(0deg); }
  to { transform: translate(-2%, 1%) rotate(2deg); }
}

/* ═══════════════════════════
   Decoy / Disabled Screen
   ═══════════════════════════ */

.decoy-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.decoy-content {
  text-align: center;
  opacity: 0.5;
}

.decoy-content svg {
  width: 64px;
  height: 64px;
  stroke: var(--text-muted);
  margin-bottom: 1.5rem;
}

.decoy-content h1 {
  font-family: 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ═══════════════════════════
   Letter Container
   ═══════════════════════════ */

.letter-container {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
  animation: fadeInUp 1s ease-out;
}

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

/* ─── Letter card ─── */
.letter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.letter-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}

/* ─── Greeting ─── */
.greeting {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 400;
  font-style: italic;
  color: var(--accent-soft);
  margin-bottom: 2.5rem;
  letter-spacing: 0.02em;
}

/* ─── Letter paragraphs ─── */
.letter-body p {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-primary);
  margin-bottom: 1.6rem;
  text-align: justify;
  hyphens: auto;
}

.letter-body p:last-child {
  margin-bottom: 0;
}

/* ─── Closing paragraph ─── */
.letter-closing {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.letter-closing p {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-secondary);
  font-style: italic;
  text-align: justify;
}

/* ─── Tooltips ─── */
.tooltip {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: help;
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-style: normal;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-soft);
  z-index: 100;
}

.tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border-accent);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 100;
}

.tooltip:hover::after,
.tooltip:hover::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.tooltip:hover::before {
  transform: translateX(-50%);
}

/* ═══════════════════════════
   Screen 2 — Response Section
   ═══════════════════════════ */

.response-section {
  margin-top: 3rem;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.response-prompt {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 2rem;
  font-style: italic;
}

.divider {
  width: 60px;
  height: 1px;
  background: var(--accent);
  margin: 2.5rem auto;
  opacity: 0.4;
}

/* ─── Response buttons ─── */
.response-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.btn-response {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.btn-response:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateX(6px);
  box-shadow: var(--shadow-glow);
}

.btn-response:active {
  transform: translateX(3px) scale(0.99);
}

/* ─── Special button (love you bachche) ─── */
.btn-special {
  border: 1px solid transparent;
  background: linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
              var(--special-gradient) border-box;
  position: relative;
  overflow: hidden;
  padding: 1.2rem 1.5rem;
}

.btn-special::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--special-gradient);
  opacity: 0.06;
  transition: opacity 0.4s ease;
}

.btn-special:hover::before {
  opacity: 0.12;
}

.btn-special:hover {
  transform: translateX(6px);
  box-shadow: 0 0 30px rgba(212, 107, 138, 0.15),
              0 0 60px rgba(176, 92, 230, 0.08);
}

.btn-special .btn-text {
  font-family: 'Dancing Script', cursive;
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--special-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  z-index: 1;
}

.btn-special .btn-subtitle {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-style: italic;
  position: relative;
  z-index: 1;
  -webkit-text-fill-color: initial;
}

@keyframes shimmer {
  from { background-position: -200% center; }
  to { background-position: 200% center; }
}

.btn-special .btn-text {
  background-size: 200% auto;
  animation: shimmer 4s linear infinite;
}

/* ─── Custom text input ─── */
.custom-input-group {
  margin-top: 1.2rem;
}

.custom-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: block;
}

.custom-input {
  width: 100%;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 80px;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.custom-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.custom-input::placeholder {
  color: var(--text-muted);
}

/* ─── Submit button ─── */
.btn-submit {
  display: block;
  width: 100%;
  margin-top: 1.2rem;
  padding: 1rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #a07850);
  color: #0a0a0f;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.03em;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ─── Success message ─── */
.success-message {
  text-align: center;
  padding: 3rem 2rem;
  animation: fadeInUp 0.6s ease-out;
}

.success-message .check-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.5rem;
  stroke: var(--accent);
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-message h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.success-message p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ═══════════════════════════
   Transition States
   ═══════════════════════════ */

.fade-out {
  animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-20px); }
}

.hidden { display: none !important; }

/* ═══════════════════════════
   Admin Panel Styles
   ═══════════════════════════ */

.admin-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.admin-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-top: 2rem;
}

.admin-header h1 {
  font-family: 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.admin-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ─── Toggle card ─── */
.toggle-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
}

.toggle-info h2 {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.toggle-status {
  font-size: 0.8rem;
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  transition: background 0.3s ease;
}

.status-dot.active {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.status-dot.inactive {
  background: #f87171;
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}

.status-text {
  color: var(--text-muted);
}

/* ─── Toggle switch ─── */
.toggle-switch {
  width: 56px;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  cursor: pointer;
  padding: 3px;
  transition: var(--transition);
  border: none;
  outline: none;
}

.toggle-switch.active {
  background: var(--accent);
}

.toggle-knob {
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  display: block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-switch.active .toggle-knob {
  transform: translateX(26px);
}

/* ─── Logs section ─── */
.logs-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.logs-header h2 {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.logs-header span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.logs-list {
  list-style: none;
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.log-entry {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.log-entry:last-child {
  border-bottom: none;
}

.log-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.log-icon.open { background: rgba(96, 165, 250, 0.15); }
.log-icon.response { background: rgba(74, 222, 128, 0.15); }
.log-icon.toggle { background: rgba(251, 191, 36, 0.15); }

.log-details {
  flex: 1;
  min-width: 0;
}

.log-details .log-type {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.log-details .log-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.log-details .log-response-text {
  font-size: 0.85rem;
  color: var(--accent-soft);
  margin-top: 0.3rem;
  padding: 0.5rem 0.8rem;
  background: rgba(196, 149, 106, 0.08);
  border-radius: 8px;
  border-left: 2px solid var(--accent);
}

.logs-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ═══════════════════════════
   Responsive
   ═══════════════════════════ */

@media (max-width: 640px) {
  .letter-container { padding: 2rem 1rem 3rem; }
  .letter-card { padding: 2rem 1.5rem; }
  .greeting { font-size: 1.5rem; }
  .letter-body p { font-size: 0.95rem; }
  .admin-container { padding: 1rem; }
  .toggle-card { padding: 1.2rem; }
  .tooltip::after {
    left: 0;
    transform: translateX(0) scale(0.9);
    white-space: normal;
    min-width: 200px;
  }
  .tooltip:hover::after {
    transform: translateX(0) scale(1);
  }
}
