/* Brand Design System & Variables */
:root {
  --bg-color: #f8fafc;
  --panel-bg: rgba(255, 255, 255, 0.75);
  --panel-border: rgba(15, 23, 42, 0.08);
  --panel-border-glow: rgba(99, 102, 241, 0.15);
  
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #db2777 100%);
  --btn-hover-gradient: linear-gradient(135deg, #4f46e5 0%, #c026d3 100%);
  --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --success: #10b981;
  --error: #ef4444;
  
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.1);
}

/* Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: #f1f5f9;
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.1);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.2);
}

/* Mobile-first Frame wrapper (centered on Desktop) */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--bg-color);
  border-left: 1px solid rgba(15, 23, 42, 0.04);
  border-right: 1px solid rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(15, 23, 42, 0.08);
  position: relative;
}

/* App Header styling */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--panel-border);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  box-shadow: 0 0 8px #db2777;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Global Counter Indicator */
.global-counter {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
}

.pulse-ring {
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.pulse-ring::after {
  content: '';
  width: 100%;
  height: 100%;
  background-color: var(--success);
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  animation: pulse 2s infinite ease-in-out;
}

.counter-value {
  font-weight: 700;
  color: var(--text-primary);
}

.counter-label {
  color: var(--text-secondary);
}

/* Share Button */
.share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.share-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(219, 39, 119, 0.3);
}

.share-btn:active {
  transform: translateY(1px);
}

/* Main Body container */
.app-main {
  flex: 1;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 10px 8px 0 8px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.4;
}

/* Featured Top Idea Card */
.featured-section {
  width: 100%;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.featured-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(219, 39, 119, 0.04) 100%);
  border: 1px solid rgba(245, 158, 11, 0.2);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.03);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.featured-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--gold-gradient);
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.15);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.featured-text {
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 14px;
}

.featured-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.votes-count {
  font-size: 12px;
  font-weight: 600;
  color: #fbbf24;
}

.mini-vote-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mini-vote-btn:hover {
  background: rgba(15, 23, 42, 0.08);
}

.mini-vote-btn.voted {
  background: var(--gold-gradient);
  border-color: transparent;
  color: #fff;
}

/* Post New Idea Form */
.post-section {
  width: 100%;
}

.post-cta-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #4f46e5;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.idea-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@keyframes ctaBorderPulse {
  0%, 100% {
    border-color: var(--panel-border);
    box-shadow: var(--shadow-sm);
  }
  50% {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.12);
  }
}

.input-wrapper {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
  animation: ctaBorderPulse 3s infinite ease-in-out;
}

.input-wrapper:focus-within {
  animation: none;
  border-color: #6366f1;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.idea-form textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  resize: none;
  min-height: 70px;
}

.idea-form textarea::placeholder {
  color: var(--text-muted);
}

.input-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.char-counter {
  font-size: 11px;
  color: var(--text-muted);
}

.char-counter.warning {
  color: var(--error);
  font-weight: 600;
}

.submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.submit-btn:hover {
  background: var(--btn-hover-gradient);
  transform: translateY(-1px);
}

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

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

/* Feed Headers and Filters */
.feed-header-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.feed-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.03);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(15, 23, 42, 0.05);
  width: 100%;
}

.feed-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.feed-tab:hover {
  color: var(--text-primary);
}

.feed-tab.active {
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.feed-tab.active svg {
  color: #6366f1;
}

/* Live Feed Items */
.ideas-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
}

.idea-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.idea-card:hover {
  border-color: var(--panel-border-glow);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.05);
}

.idea-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.idea-text {
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
  font-weight: 400;
  word-break: break-word;
}

.idea-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.vote-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* Fire vote button */
.vote-btn {
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.06);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-size: 18px;
}

.vote-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  transform: scale(1.08);
}

.vote-btn:active {
  transform: scale(0.9);
}

.vote-btn.voted {
  background: rgba(219, 39, 119, 0.08);
  border-color: rgba(219, 39, 119, 0.2);
  animation: votePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.vote-count-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.vote-btn.voted + .vote-count-text {
  color: #db2777;
}

/* Spinners, Shakes and Loaders */
.feed-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 32px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state-desc {
  font-size: 13px;
  max-width: 240px;
  line-height: 1.4;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: rgba(255, 255, 255, 0.98);
  border-left: 4px solid #6366f1;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideDownFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
  border-top: 1px solid rgba(15, 23, 42, 0.03);
  border-right: 1px solid rgba(15, 23, 42, 0.03);
  border-bottom: 1px solid rgba(15, 23, 42, 0.03);
}

.toast.toast-error {
  border-left-color: var(--error);
}

.toast.toast-success {
  border-left-color: var(--success);
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

/* Confetti Container & Particles */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall 2.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

/* Footer style */
.app-footer {
  margin-top: auto;
  padding: 24px;
  text-align: center;
  border-top: 1px solid var(--panel-border);
}

.app-footer p {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

/* Utilities */
.hidden {
  display: none !important;
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* Keyframe Animations */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

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

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

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

@keyframes votePop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1.1);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes confettiFall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0;
  }
}

/* Desktop optimization border overlay */
@media (min-width: 481px) {
  body {
    background: radial-gradient(circle at center, #ffffff 0%, #cbd5e1 100%);
  }
  
  .app-container {
    margin: 20px 0;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: calc(100vh - 40px);
  }
  
  .app-header {
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
  }
}

/* Modal Dialog Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.25s ease-out;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  padding: 24px;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  font-size: 24px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.modal-btn {
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.15s;
}

.modal-btn:hover {
  opacity: 0.9;
}

/* User's Own Pending Cards in Public Feed */
.idea-card.my-pending {
  border: 1.5px dashed #d97706;
  background: rgba(245, 158, 11, 0.04);
  opacity: 0.9;
}

.pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 6px;
  width: fit-content;
}

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