/* CSS Variables for theming */
:root {
  --background: 350 100% 97%; /* Lightest Pink */
  --foreground: 350 60% 25%;
  --card: 350 100% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 350 100% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 345 90% 85%; /* Light Pink */
  --primary-foreground: 345 90% 10%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 350 20% 45%;
  --accent: 0 90% 85%; /* Light Red */
  --accent-foreground: 0 90% 20%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 350 5.9% 90%;
  --input: 350 5.9% 90%;
  --ring: 345 90% 85%;
  --radius: 0.8rem;
}

.dark {
  --background: 350 10% 10%;
  --foreground: 0 0% 98%;
  --card: 350 10% 12%;
  --card-foreground: 0 0% 98%;
  --popover: 350 10% 3.9%;
  --popover-foreground: 0 0% 98%;
  --primary: 345 80% 75%;
  --primary-foreground: 345 90% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 0 0% 63.9%;
  --accent: 0 90% 75%;
  --accent-foreground: 0 90% 10%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 350 3.7% 15.9%;
  --input: 350 3.7% 15.9%;
  --ring: 345 80% 75%;
}

/* Base styles */
* {
  border-color: hsl(var(--border));
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  background-image: linear-gradient(135deg, hsl(var(--primary) / 0.3), hsl(var(--accent) / 0.3));
  font-family: "Times New Roman", Times, serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
}

.dark body {
  background-image: linear-gradient(135deg, hsl(var(--primary) / 0.3), hsl(var(--accent) / 0.3));
}

/* Utility classes */
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-4 { top: 1rem; }
.right-4 { right: 1rem; }
.z-20 { z-index: 20; }
.z-10 { z-index: 10; }
.z-0 { z-index: 0; }
.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.overflow-hidden { overflow: hidden; }
.pointer-events-none { pointer-events: none; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.p-4 { padding: 1rem; }
.pt-4 { padding-top: 1rem; }
.pr-4 { padding-right: 1rem; }
.pb-4 { padding-bottom: 1rem; }
.pl-4 { padding-left: 1rem; }
.p-2 { padding: 0.5rem; }
.pt-2 { padding-top: 0.5rem; }
.pr-2 { padding-right: 0.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pl-2 { padding-left: 0.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-2xl { 
  max-width: 42rem; 
  width: 80%;
  box-sizing: border-box;
}
.space-y-8 > * + * { margin-top: 2rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.text-center { text-align: center; }
.text-lg { 
  font-size: 1.125rem; 
  line-height: 1.75rem; 
  margin-bottom: 0.75rem;
  display: block;
}
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.tracking-tight { letter-spacing: -0.025em; }
.mt-2 { margin-top: 0.5rem; }
.mr-2 { margin-right: 0.5rem; }
.hidden { display: none; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }
.border { border-width: 1px; }
.border-white\/20 { border-color: rgb(255 255 255 / 0.2); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05); }
.backdrop-blur-lg { backdrop-filter: blur(16px); }
.bg-card { background-color: hsl(var(--card)); }
.bg-card\/80 { background-color: hsl(var(--card) / 0.8); }
.bg-muted { background-color: hsl(var(--muted)); }
.bg-background { background-color: hsl(var(--background)); }
.text-foreground { color: hsl(var(--foreground)); }
.text-muted-foreground { color: hsl(var(--muted-foreground)); }
.text-card-foreground { color: hsl(var(--card-foreground)); }
.border-border { border-color: hsl(var(--border)); }
.min-h-\[120px\] { min-height: 120px; }
.break-words { word-break: break-word; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gap-2 { gap: 0.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-transform { transition-property: transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transform { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); }
.hover\:scale-105:hover { transform: scale(1.05); }
.hover\:scale-110:hover { transform: scale(1.1); }
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Responsive typography */
@media (min-width: 768px) {
  .md\:text-6xl { font-size: 3.75rem; line-height: 1; }
}

/* Font families */
.font-body { font-family: "Times New Roman", Times, serif; }
.font-headline { font-family: "Times New Roman", Times, serif; }

/* Main heading glow effect */
.main-heading-glow {
  text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff;
}

.dark .main-heading-glow {
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

/* Floating emojis animation */
@keyframes float {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  50% { transform: translateY(-25px) rotate(180deg); opacity: 0.5; }
  100% { transform: translateY(0) rotate(360deg); opacity: 1; }
}

.floating-emoji {
  position: absolute;
  animation-name: float;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  user-select: none;
}

/* Theme toggle button */
.theme-toggle-btn {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--accent)));
  border: 2px solid hsl(var(--primary));
  border-radius: 9999px;
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  backdrop-filter: blur(10px);
  color: hsl(var(--primary-foreground));
}

.theme-toggle-btn:hover {
  transform: scale(1.15) rotate(15deg);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.3), 0 12px 15px -6px rgba(0, 0, 0, 0.2);
  border-color: hsl(var(--accent));
}

.sun-icon, .moon-icon {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-icon {
  transform: rotate(0deg) scale(1);
}

.moon-icon {
  position: absolute;
  transform: rotate(90deg) scale(0);
}

.dark .sun-icon {
  transform: rotate(-90deg) scale(0);
}

.dark .moon-icon {
  transform: rotate(0deg) scale(1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Emoji cipher card */
.emoji-cipher-card {
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.8rem;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
  margin: 0 auto;
}

.tabs-container {
  padding: 1rem;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .tabs-container {
    padding: 1.5rem;
  }
}

.tabs-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  background-color: hsl(var(--muted));
  border-radius: 0.5rem;
  padding: 0.25rem;
}

.tab-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  background: transparent;
  border: none;
  color: hsl(var(--muted-foreground));
}

.tab-trigger.active {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.tab-trigger:hover:not(.active) {
  color: hsl(var(--foreground));
}

.tab-content {
  display: none;
  margin-top: 1.5rem;
  padding: 0;
}

.tab-content.active {
  display: block;
}

/* Form elements */
textarea {
  width: 100%;
  min-height: 120px;
  padding: 1rem;
  border: 2px solid hsl(var(--border));
  border-radius: 0.75rem;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 1rem;
  line-height: 1.6rem;
  resize: vertical;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  display: block;
  margin: 0;
  vertical-align: top;
}

textarea:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.2);
  transform: translateY(-1px);
}

/* Result containers */
#encoded-text-display,
#decoded-text-display {
  position: relative !important;
  overflow: visible !important;
  min-height: 140px !important;
  padding: 1rem !important;
  word-wrap: break-word !important;
  white-space: pre-wrap !important;
  display: block !important;
}

/* Ensure result containers have proper stacking context */
#encoded-result,
#decoded-result {
  position: relative !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
  background-color: hsl(var(--primary) / 0.9);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

.btn-outline:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
}

.alert-destructive {
  background-color: hsl(var(--destructive) / 0.1);
  border-color: hsl(var(--destructive) / 0.2);
  color: hsl(var(--destructive));
}

/* Ensure hidden alerts are completely hidden */
.alert.hidden {
  display: none !important;
}

/* Copy button styles */
.copy-btn {
  position: absolute !important;
  top: 0.5rem !important;
  right: 0.5rem !important;
  background: hsl(var(--primary)) !important;
  border: 2px solid hsl(var(--primary-foreground)) !important;
  color: hsl(var(--primary-foreground)) !important;
  cursor: pointer !important;
  padding: 0.5rem !important;
  border-radius: 0.5rem !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  z-index: 1000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.5rem !important;
  height: 2.5rem !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.copy-btn:hover {
  background: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  opacity: 1 !important;
}

.copy-text {
  display: none !important;
}

.copy-btn:active {
  transform: scale(0.95) !important;
}

.copy-text {
  color: inherit !important;
  font-weight: 600 !important;
}

/* Toast notification */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
  padding: 1rem;
  min-width: 300px;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateX(0);
}

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.toast-title {
  font-weight: 600;
  color: hsl(var(--foreground));
}

.toast-description {
  color: hsl(var(--muted-foreground));
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .max-w-2xl {
    width: 95%;
  }
  
  .text-5xl {
    font-size: 2.25rem;
  }
  
  .tabs-container {
    padding: 0.75rem;
  }
  
  .gap-2 {
    gap: 0.25rem;
  }
  
  .flex {
    flex-direction: column;
  }
  
  .toast {
    right: 0.5rem;
    left: 0.5rem;
    min-width: auto;
  }
  
  /* Mobile theme toggle positioning */
  .theme-toggle-btn {
    width: 3rem;
    height: 3rem;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
  }
  
  .top-4.right-4 {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
  }
}

/* Utility for opacity */
.opacity-90 {
  opacity: 0.9;
}
