/* Core Premium CSS Design System for NeedAsk */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Tokens - Indigo & Purple gradients */
  --primary-hue: 250;
  --secondary-hue: 280;
  
  --primary: hsl(var(--primary-hue), 85%, 62%);
  --primary-hover: hsl(var(--primary-hue), 85%, 55%);
  --secondary: hsl(var(--secondary-hue), 85%, 62%);
  
  --font-family-title: 'Outfit', sans-serif;
  --font-family-body: 'Plus Jakarta Sans', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

/* Dark Mode Variables (Default) */
html[data-theme='dark'] {
  --bg-app: hsl(230, 25%, 8%);
  --bg-surface: hsl(230, 25%, 12%);
  --bg-surface-glass: hsla(230, 25%, 12%, 0.7);
  --border-color: hsla(230, 25%, 22%, 0.5);
  --border-focus: hsla(var(--primary-hue), 85%, 62%, 0.6);
  --text-primary: hsl(210, 20%, 95%);
  --text-secondary: hsl(210, 10%, 70%);
  --text-muted: hsl(210, 10%, 50%);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --glow-effect: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Light Mode Variables */
html[data-theme='light'] {
  --bg-app: hsl(210, 30%, 98%);
  --bg-surface: hsl(0, 0%, 100%);
  --bg-surface-glass: rgba(255, 255, 255, 0.8);
  --border-color: hsl(210, 30%, 90%);
  --border-focus: hsla(var(--primary-hue), 85%, 62%, 0.6);
  --text-primary: hsl(220, 30%, 15%);
  --text-secondary: hsl(220, 15%, 45%);
  --text-muted: hsl(220, 10%, 65%);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 15px 30px rgba(99, 102, 241, 0.06), 0 5px 15px rgba(0, 0, 0, 0.03);
  --glow-effect: 0 0 20px rgba(99, 102, 241, 0.05);
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-family-body);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-title);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Global layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main.content-area {
  flex-grow: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Header & Navigation Styles */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-family-title);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 2px;
  letter-spacing: -0.04em;
}

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

.logo-tld {
  font-size: 14px;
  opacity: 0.5;
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: var(--transition-smooth);
  position: relative;
  padding: 6px 0;
}

.nav-item:hover, .nav-item.active-nav {
  color: var(--text-primary);
}

.nav-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: var(--transition-smooth);
}

.nav-item.active-nav::after, .nav-item:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Buttons and Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-title);
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
  font-size: 14px;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

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

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border-color);
}

.btn-outline:hover {
  background-color: var(--border-color);
}

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

.btn-secondary:hover {
  background-color: hsla(230, 25%, 32%, 0.8);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.icon-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.lang-selector-wrapper {
  position: relative;
}

.lang-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.lang-select:focus {
  border-color: var(--primary);
}

/* Sun/Moon Toggle Styles */
html[data-theme='dark'] .theme-icon-sun { display: block; }
html[data-theme='dark'] .theme-icon-moon { display: none; }
html[data-theme='light'] .theme-icon-sun { display: none; }
html[data-theme='light'] .theme-icon-moon { display: block; }

.theme-icon-sun, .theme-icon-moon {
  width: 20px;
  height: 20px;
}

/* User nickname displaying */
.user-nickname {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-right: 8px;
}

.auth-state {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hero & Search Header */
.hero-section {
  text-align: center;
  margin-bottom: 48px;
  margin-top: 20px;
}

.hero-title {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-primary) 50%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 18px;
  max-width: 600px;
  margin: 0 auto 30px auto;
}

.search-container {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  gap: 12px;
  background: var(--bg-surface-glass);
  padding: 8px;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.search-container:focus-within {
  border-color: var(--primary);
  box-shadow: var(--glow-effect);
}

.search-input {
  flex-grow: 1;
  border: none;
  background: transparent;
  padding: 10px 20px;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
}

.search-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: #fff;
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.search-btn:hover {
  opacity: 0.95;
  transform: scale(1.02);
}

/* Needs Waterfall / Grid Layout */
.needs-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.need-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.need-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg), var(--glow-effect);
}

.need-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.need-meta-badge {
  background-color: var(--bg-app);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.need-time {
  font-size: 12px;
  color: var(--text-muted);
}

.need-title-text {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.3;
  color: var(--text-primary);
}

.need-content-snippet {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.need-thumbnail {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  background-color: var(--bg-app);
}

.need-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: auto;
}

.need-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.country-flag {
  font-size: 14px;
}

/* Floating Action Button for mobile quick-post */
.fab-post {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: none;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
  transition: var(--transition-smooth);
  z-index: 99;
}

.fab-post:hover {
  transform: translateY(-4px) rotate(90deg);
  box-shadow: 0 15px 30px rgba(99, 102, 241, 0.5);
}

/* Form layouts */
.form-card {
  max-width: 650px;
  margin: 0 auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

.form-title {
  font-size: 28px;
  margin-bottom: 24px;
  text-align: center;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: var(--transition-smooth);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: var(--glow-effect);
}

textarea.form-control {
  resize: vertical;
  min-height: 150px;
}

.image-preview-box {
  width: 100%;
  height: 200px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.image-preview-box:hover {
  border-color: var(--primary);
}

.image-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

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

.preview-placeholder svg {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 32px;
}

/* Detail View Layout */
.detail-container {
  max-width: 800px;
  margin: 0 auto;
}

.detail-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.detail-image {
  width: 100%;
  max-height: 450px;
  object-fit: cover;
  background-color: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
}

.detail-body {
  padding: 40px;
}

.detail-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.detail-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
  margin-bottom: 32px;
}

.detail-actions-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-app);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.publisher-info {
  display: flex;
  flex-direction: column;
}

.publisher-name {
  font-weight: 700;
  font-size: 15px;
}

.publisher-location {
  font-size: 12px;
  color: var(--text-muted);
}

.action-buttons {
  display: flex;
  gap: 12px;
}

/* User authentication screens */
.login-container {
  max-width: 420px;
  margin: 60px auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.auth-tab {
  flex-grow: 1;
  text-align: center;
  padding: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: var(--transition-smooth);
}

.auth-tab.active-tab {
  color: var(--text-primary);
  border-bottom-color: var(--primary);
}

.auth-switch-link {
  display: block;
  text-align: center;
  font-size: 14px;
  margin-top: 16px;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

.auth-switch-link:hover {
  text-decoration: underline;
}

/* Profile Panel Layout */
.profile-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}

.profile-sidebar {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.profile-user-details {
  text-align: center;
}

.profile-user-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-user-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.profile-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.profile-tab-btn {
  background: none;
  border: none;
  text-align: left;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.profile-tab-btn.active-tab, .profile-tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-app);
}

.profile-main-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  min-height: 400px;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 100px);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 40px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10000;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast-success {
  border-left: 4px solid #10b981;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

/* Footer layout */
footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 40px 20px;
  margin-top: 60px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.footer-tagline {
  color: var(--text-secondary);
  font-size: 14px;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 100%;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-smooth);
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* Admin Dashboard layout styling */
.admin-tabs-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.admin-nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.admin-nav-btn.active, .admin-nav-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.admin-table th, .admin-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  font-weight: 700;
  color: var(--text-secondary);
}

/* Responsive queries */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* simple mobile fallback, or hidden for simplicity */
  }
  
  .profile-grid {
    grid-template-columns: 1fr;
  }
  
  .hero-title {
    font-size: 32px;
  }
  
  .form-card, .detail-body {
    padding: 24px;
  }
}
