/* ============================================
   EmojiStories – Modernes Design
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-input: #1a1a30;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6a6a80;
  --accent: #7c3aed;
  --accent-hover: #8b5cf6;
  --accent-glow: rgba(124, 58, 237, 0.3);
  --success: #10b981;
  --error: #ef4444;
  --border: #2a2a40;
  --border-focus: #7c3aed;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
}

/* --- Header --- */
.header {
  text-align: center;
  padding: 2rem 1.5rem 1rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-credit {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.3;
  text-align: left;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

.header-handle {
  color: var(--accent);
  font-weight: 500;
}

/* --- Language Switcher --- */
.lang-switch {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.lang-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.lang-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.lang-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  align-self: center;
  margin: 0 0.15rem;
}

.share-site-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(to right, #2196F3, #0D47A1);
  color: white;
  border: none;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.share-site-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
  color: white;
}

.logo {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-icon {
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

.logo-highlight {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-top: 0.4rem;
  font-weight: 400;
}

/* --- Main Container --- */
.main-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: 1rem 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
}

/* --- Panels --- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color 0.3s ease;
  min-height: 500px;
}

.panel:hover {
  border-color: #3a3a55;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.panel-icon {
  font-size: 1.4rem;
}

.panel-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* --- Story Input --- */
.story-input {
  width: 100%;
  flex: 1;
  min-height: 200px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.7;
  padding: 1rem;
  resize: vertical;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
}

.story-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.story-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.char-counter {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
}

.char-counter.warning {
  color: #f59e0b;
}

.char-counter.danger {
  color: var(--error);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), #9b6dff);
  box-shadow: 0 6px 25px rgba(124, 58, 237, 0.45);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #252540;
  border-color: #4a4a60;
}

/* --- Share Buttons --- */
.btn-share {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.1rem;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.btn-share:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.btn-whatsapp:hover { background: #25D366; border-color: #25D366; color: white; }
.btn-facebook:hover { background: #1877F2; border-color: #1877F2; color: white; }
.btn-linkedin:hover { background: #0A66C2; border-color: #0A66C2; color: white; }
.btn-email:hover   { background: #EA4335; border-color: #EA4335; color: white; }
.btn-twitter:hover  { background: #1DA1F2; border-color: #1DA1F2; color: white; }
.btn-instagram:hover { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); border-color: transparent; color: white; }

/* --- Emoji Output --- */
.emoji-output {
  flex: 1;
  min-height: 200px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s ease;
  overflow-wrap: break-word;
  word-break: break-word;
}

.emoji-output.has-content {
  align-items: flex-start;
  justify-content: flex-start;
  font-size: 2.5rem;
  line-height: 1.6;
  letter-spacing: 0.15em;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.output-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.placeholder-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.75rem;
  animation: float 3s ease-in-out infinite;
}

.output-placeholder p {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* --- Loading Spinner --- */
.loading-spinner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.loading-spinner.hidden {
  display: none;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* --- Error Message --- */
.error-message {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.error-message.hidden {
  display: none;
}

/* --- Action Buttons Container --- */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.action-buttons.hidden {
  display: none;
}

.copy-feedback {
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 600;
}

.copy-feedback.hidden {
  display: none;
}

.share-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.3rem;
}

.share-divider::before,
.share-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.share-divider span {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.share-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* --- Examples --- */
.examples {
  margin-top: 0.25rem;
}

.examples summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 0.4rem 0;
  transition: color 0.2s;
}

.examples summary:hover {
  color: var(--accent-hover);
}

.example-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.example-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  text-align: left;
  transition: all 0.2s;
  font-family: inherit;
}

.example-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: #1e1e38;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.85rem 1.5rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-6px);
}

.toast.hidden {
  display: none;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.footer-credit {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.8;
}

/* --- Animations --- */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.emoji-output.has-content {
  animation: fadeInUp 0.4s ease;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
  .main-container {
    grid-template-columns: 1fr;
    padding: 0.75rem 1rem 1.5rem;
    gap: 1rem;
  }

  .header {
    padding: 1.5rem 1rem 0.5rem;
  }

  .logo {
    font-size: 1.8rem;
  }

  .tagline {
    font-size: 0.9rem;
  }

  .panel {
    min-height: auto;
    padding: 1.25rem;
  }

  .story-input {
    min-height: 160px;
  }

  .emoji-output {
    min-height: 140px;
  }

  .emoji-output.has-content {
    font-size: 2rem;
  }

  .share-buttons {
    justify-content: center;
  }

  .action-buttons {
    justify-content: center;
  }
}

@media (max-width: 400px) {
  .btn-share {
    width: 38px;
    height: 38px;
  }

  .emoji-output.has-content {
    font-size: 1.7rem;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4a4a60;
}

/* --- Live Feed --- */
.feed-section {
  max-width: 1200px;
  margin: 2rem auto 1rem;
  padding: 0 1.5rem;
}

.feed-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.feed-header h2 {
  font-size: 1.15rem;
  color: var(--text-primary);
}

.feed-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.feed-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  transform: translateY(-2px);
}

.feed-card-story {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.feed-card-emojis {
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.feed-card-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.8;
}

.feed-loading {
  text-align: center;
  color: var(--text-muted);
  grid-column: 1 / -1;
  padding: 2rem;
}

@media (max-width: 768px) {
  .feed-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
