@import url("https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  --wa-green: #25d366;
  --wa-dark: #128c7e;
  --wa-darker: #075e54;
  --accent: #34b7f1;
  --bg-light: #f8fafc;
  --bg-dark: #0b141a;
  --card-light: #ffffff;
  --card-dark: #1a2730;
  --text-light: #111b21;
  --text-dark: #e9edef;
  --muted-light: #667781;
  --muted-dark: #8696a0;
  --border-light: #e9edef;
  --border-dark: #2a3940;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  font-family: "DM Sans", -apple-system, sans-serif;
  background-color: var(--bg-light);
  transition: background-color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.dark body {
  background-color: var(--bg-dark);
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

/* Hero */
.hero-gradient {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 50%, #075e54 100%);
  position: relative;
  overflow: hidden;
}

.hero-gradient::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
  transform: rotate(25deg);
}

.hero-gradient::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.25), transparent);
  pointer-events: none;
}

/* WhatsApp Background */
.wa-bg {
  background-color: #efeae2;
  background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png");
  background-repeat: repeat;
  transition: background-color 0.3s ease;
}

.dark .wa-bg {
  background-color: #0b141a;
  background-blend-mode: overlay;
  opacity: 0.9;
}

/* Chat Bubble */
.chat-bubble {
  background-color: var(--card-light);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
  position: relative;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-light);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.dark .chat-bubble {
  background-color: #202c33;
  color: var(--text-dark);
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.5);
}

.chat-bubble::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 10px 10px 0;
  border-color: transparent var(--card-light) transparent transparent;
}

.dark .chat-bubble::before {
  border-color: transparent #202c33 transparent transparent;
}

/* Formatting Previews */
.chat-bubble strong { font-weight: 700; }
.chat-bubble em { font-style: italic; }

.chat-bubble .quote {
  display: block;
  border-left: 4px solid var(--accent);
  background: rgba(52, 183, 241, 0.08);
  padding: 6px 12px;
  margin: 6px 0;
  border-radius: 4px;
}

.chat-bubble code {
  background: #f0f2f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9em;
}

.dark .chat-bubble code {
  background: #111b21;
}

.chat-bubble .code-block {
  display: block;
  background: #f0f2f5;
  padding: 12px;
  border-radius: 8px;
  margin: 8px 0;
  white-space: pre;
  overflow-x: auto;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.85em;
  line-height: 1.5;
}

.dark .chat-bubble .code-block {
  background: #111b21;
  color: #8696a0;
}

/* Animations */
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.animate-pop {
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Theme Toggle */
.theme-toggle-btn {
  z-index: 100;
  padding: 0.5rem;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

/* Card sections */
section {
  transition: all 0.3s ease;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--wa-green);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Button hover effects */
button {
  cursor: pointer;
}

/* Copy button pulse */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 24px rgba(37, 211, 102, 0.3); }
  50% { box-shadow: 0 4px 32px rgba(37, 211, 102, 0.5); }
}

#copyBtn {
  animation: pulse-glow 3s ease-in-out infinite;
}

/* Toast animation */
#toast {
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Mobile nav animation */
#navMenuMobile {
  animation: fadeIn 0.2s ease-out;
}

/* Link hover effect */
a {
  transition: color 0.2s ease;
}

/* Footer link grid */
footer a {
  position: relative;
  display: inline-block;
}

footer a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

footer a:hover::after {
  width: 100%;
}

/* Textarea focus enhancement */
textarea:focus {
  box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.1);
}

/* Dark mode card */
.dark .bg-white {
  background-color: var(--card-dark);
}

.dark .border-gray-100 {
  border-color: var(--border-dark);
}

/* Guide card hover */
.guide-card {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.guide-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Responsive text adjustments */
@media (max-width: 640px) {
  .chat-bubble {
    font-size: 14px;
    padding: 12px 14px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Skip to content */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--wa-green);
  color: #fff;
  padding: 8px 24px;
  border-radius: 0 0 8px 8px;
  font-weight: 700;
  font-size: 14px;
  z-index: 10000;
  transition: top 0.2s ease;
  text-decoration: none;
}

.skip-to-content:focus {
  top: 0;
  outline: 2px solid #fff;
  outline-offset: 2px;
}