/* CSS Variables for Themes */
:root {
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-light: #8b5cf6;
  --secondary: #f5d0fe;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: all 0.3s ease;
}

.dark-mode {
  --primary: #a78bfa;
  --primary-dark: #8b5cf6;
  --primary-light: #c4b5fd;
  --secondary: #4c1d95;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-card: #1f2937;
  --border: #374151;
  --success: #34d399;
  --error: #f87171;
  --warning: #fbbf24;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, var(--secondary), var(--bg-primary));
  color: var(--text-primary);
  min-height: 100vh;
  transition: var(--transition);
  line-height: 1.6;
}

.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Header & Navigation */
header {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  background: linear-gradient(to right, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

h1 i {
  font-size: 2.2rem;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  width: 60px;
  height: 30px;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.theme-toggle:after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: var(--primary);
  border-radius: 50%;
  transition: var(--transition);
}

.theme-toggle.active:after {
  left: calc(100% - 27px);
}

.theme-toggle i {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  z-index: 1;
}

.theme-toggle .fa-sun {
  left: 8px;
  color: #f59e0b;
}

.theme-toggle .fa-moon {
  right: 8px;
  color: #6b7280;
}

/* Main Layout */
.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .main-content {
    grid-template-columns: 1fr 1fr;
  }
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  border: 1px solid transparent;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.card h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}

.card h2 i {
  font-size: 1.3rem;
}

/* Textareas */
textarea {
  width: 100%;
  padding: 1rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  resize: vertical;
  transition: var(--transition);
  min-height: 120px;
  font-family: 'Monaco', 'Courier New', monospace;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

textarea::placeholder {
  color: var(--text-secondary);
}

/* Buttons */
button {
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(to right, var(--primary), var(--primary-dark));
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

/* Character Count */
.char-count {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.char-count span {
  font-weight: bold;
  color: var(--primary);
}

/* Action Buttons */
.actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* Error Messages */
.error {
  color: var(--error);
  margin-top: 0.5rem;
  font-size: 0.9rem;
  padding: 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
}

.error i {
  font-size: 1rem;
}

.hidden {
  display: none !important;
}

/* Decoded Message Box */
.decoded-box {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border-left: 4px solid var(--success);
  position: relative;
  overflow: hidden;
}

.decoded-box:before {
  content: 'DECODED MESSAGE';
  position: absolute;
  top: 0;
  right: 0;
  background: var(--success);
  color: white;
  font-size: 0.7rem;
  padding: 0.3rem 0.8rem;
  border-radius: 0 0 0 var(--radius);
  font-weight: bold;
}

.decoded-content {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 1.1rem;
  word-break: break-word;
}

/* Self-destruct Animation */
.self-destruct {
  animation: burn 4s linear forwards;
}

@keyframes burn {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* Footer */
footer {
  text-align: center;
  margin-top: 3rem;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border-top: 1px solid var(--border);
}

footer i {
  color: var(--warning);
  margin-right: 5px;
}

/* How It Works Section */
.info-section {
  margin-top: 2rem;
  grid-column: 1 / -1;
}

.info-section h2 {
  color: var(--primary);
}

.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.info-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  border-top: 4px solid var(--primary);
}

.info-card h3 {
  margin-bottom: 0.8rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app {
    padding: 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .actions {
    flex-direction: column;
  }
  
  .actions button {
    width: 100%;
  }
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: var(--text-primary);
  color: var(--bg-primary);
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.8rem;
  font-weight: normal;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Copy Feedback */
.copy-feedback {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--success);
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateY(100px);
  transition: transform 0.3s ease;
}

.copy-feedback.show {
  transform: translateY(0);
}

/* Buy Me a Coffee Button */
.coffee-wrap {
  margin-top: 1.2rem;
}

.coffee-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.7rem 1.4rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffdd00, #ffb703);
  color: #1f2937;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.coffee-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(255, 183, 3, 0.4);
}

/* M-Pesa Donation */
.mpesa-wrap {
  margin-top: 1rem;
}

.mpesa-btn {
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #00a650, #008f45);
  color: white;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.mpesa-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 166, 80, 0.4);
}

.mpesa-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border-left: 4px solid #00a650;
  animation: fadeIn 0.3s ease;
}

.mpesa-box h3 {
  margin: 0.3rem 0;
  color: var(--primary);
  font-family: monospace;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
/* End of styles.css */