/* =========================================================
   SmartCity AI Citizen Dashboard – style.css
   Theme: Beige Minimal Light UI
   ========================================================= */

/* ---------- CSS Variables / Design Tokens ---------- */
:root {
  --bg-primary: #f2f0e8;
  --bg-secondary: #ede9df;
  --bg-card: #ffffff;
  --bg-card-hover: #fdfcfb;
  --bg-card-border: rgba(168,85,247,0.12);

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  --accent-purple: #a855f7;
  --accent-purple-light: rgba(168,85,247,0.12);
  --accent-purple-glow: rgba(168,85,247,0.25);

  --accent-orange: #f59e0b;
  --accent-orange-light: rgba(245,158,11,0.12);
  --accent-orange-glow: rgba(245,158,11,0.25);

  --accent-green: #10b981;
  --accent-green-light: rgba(16,185,129,0.12);

  --accent-rose: #f43f5e;
  --accent-rose-light: rgba(244,63,94,0.12);

  --gradient-hero: linear-gradient(135deg, #f2f0e8 0%, #ede9df 60%, #e8e2d9 100%);
  --gradient-card: linear-gradient(145deg, #ffffff, #fdfcfb);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 2px 16px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 8px 32px rgba(168,85,247,0.14), 0 2px 8px rgba(0,0,0,0.08);

  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 70% 50% at 80% 10%, rgba(168,85,247,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 10% 80%, rgba(245,158,11,0.07) 0%, transparent 60%);
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(242,240,232,0.90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(168,85,247,0.12);
  padding: 0 24px;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 16px rgba(168,85,247,0.35);
}

.brand-icon svg { width: 20px; height: 20px; }

.brand-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(90deg, #a855f7, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.brand-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-green);
  letter-spacing: 0.08em;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.header-time {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 64px 24px 48px;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 60% at 50% 0%, rgba(168,85,247,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  background: linear-gradient(135deg, #1f2937 0%, #a855f7 60%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 500px;
  margin: 0 auto;
}

/* ---------- Dashboard Grid ---------- */
.dashboard {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 80px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 768px) {
  .dashboard { grid-template-columns: 1fr; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card--weather::before  { background: linear-gradient(90deg, #a855f7, #7c3aed); }
.card--currency::before { background: linear-gradient(90deg, #10b981, #059669); }
.card--citizen::before  { background: linear-gradient(90deg, #f43f5e, #e11d48); }
.card--fact::before     { background: linear-gradient(90deg, #f59e0b, #d97706); }

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(168,85,247,0.22);
}

.card:hover::before { opacity: 1; }

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 0;
}

.card-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon-wrap svg { width: 20px; height: 20px; }

.card-icon-wrap--blue   { background: var(--accent-purple-light); color: var(--accent-purple); }
.card-icon-wrap--green  { background: var(--accent-green-light);  color: var(--accent-green); }
.card-icon-wrap--purple { background: var(--accent-rose-light);   color: var(--accent-rose); }
.card-icon-wrap--orange { background: var(--accent-orange-light); color: var(--accent-orange); }

.card-title-group { flex: 1; }

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

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

.refresh-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.refresh-btn svg {
  width: 15px;
  height: 15px;
  transition: transform 0.6s ease;
}

.refresh-btn:hover {
  background: var(--accent-purple-light);
  color: var(--accent-purple);
  border-color: rgba(168,85,247,0.2);
}

.refresh-btn:hover svg { transform: rotate(180deg); }

.refresh-btn.spinning svg { animation: spin 0.7s linear infinite; }

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

.card-body { padding: 20px; }

/* ---------- Skeleton Loader ---------- */
.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-line, .skeleton-avatar {
  background: linear-gradient(90deg, #f0ede6 0%, #e8e4da 50%, #f0ede6 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

.skeleton-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 10px;
}

.skeleton-line--xl { height: 48px; width: 100%; }
.skeleton-line--md { height: 18px; width: 75%; }
.skeleton-line--sm { height: 14px; width: 50%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Weather Card ---------- */
.weather-main {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.weather-temp {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.weather-icon-big { font-size: 48px; }

.weather-condition {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

.weather-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.weather-stat {
  background: var(--bg-secondary);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.weather-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.weather-stat-value {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-purple);
}

/* ---------- Currency Card ---------- */
.currency-base {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.currency-tag {
  background: var(--accent-green-light);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-green);
}

.currency-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.currency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 12px;
  padding: 12px 16px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.currency-row:hover {
  background: var(--accent-purple-light);
  border-color: rgba(168,85,247,0.15);
}

.currency-pair {
  display: flex;
  align-items: center;
  gap: 10px;
}

.currency-flag { font-size: 22px; }

.currency-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

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

.currency-rate {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-purple);
}

.currency-inr-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 8px;
}

/* ---------- Citizen Card ---------- */
.citizen-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.citizen-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #a855f7, #f43f5e) border-box;
  flex-shrink: 0;
}

.citizen-info-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.citizen-info-tag {
  display: inline-block;
  background: var(--accent-rose-light);
  border: 1px solid rgba(244,63,94,0.2);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-rose);
  margin-bottom: 6px;
}

.citizen-detail-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.citizen-detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}

.citizen-detail-icon { font-size: 16px; }
.citizen-detail-label { color: var(--text-muted); min-width: 40px; }
.citizen-detail-value { color: var(--text-primary); font-weight: 500; word-break: break-all; }

/* ---------- Fact Card ---------- */
.fact-quote-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 12px;
  opacity: 0.7;
}

.fact-text {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
  font-style: italic;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--accent-orange-light);
  border-left: 3px solid var(--accent-orange);
  border-radius: 0 10px 10px 0;
}

.fact-source {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.fact-source-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-orange);
  border-radius: 50%;
}

/* ---------- Error State ---------- */
.card-error {
  text-align: center;
  padding: 16px;
  color: #ef4444;
  font-size: 13px;
  line-height: 1.6;
}

.card-error-icon { font-size: 32px; margin-bottom: 8px; }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid rgba(0,0,0,0.07);
}

/* ---------- Chatbot FAB ---------- */
.chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border: none;
  border-radius: 100px;
  padding: 14px 22px 14px 18px;
  cursor: pointer;
  color: white;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(168,85,247,0.45), 0 2px 8px rgba(0,0,0,0.12);
  transition: all var(--transition-base);
}

.chat-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 40px rgba(168,85,247,0.6), 0 4px 16px rgba(0,0,0,0.15);
}

.chat-fab:active { transform: scale(0.97); }

.chat-fab-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.chat-fab-icon--close { display: none; }
.chat-fab.is-open .chat-fab-icon--open  { display: none; }
.chat-fab.is-open .chat-fab-icon--close { display: block; }

.chat-fab-label { white-space: nowrap; }

.chat-fab-pulse {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: var(--accent-orange);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  animation: pulse-fab 2s infinite;
}

@keyframes pulse-fab {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245,158,11,0.6); }
  50%       { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}

/* ---------- Chatbot Window ---------- */
.chat-window {
  position: fixed;
  bottom: 90px;
  right: 28px;
  z-index: 999;
  width: 380px;
  max-height: 540px;
  background: #ffffff;
  border: 1px solid rgba(168,85,247,0.15);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 80px rgba(0,0,0,0.12), 0 4px 20px rgba(168,85,247,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.chat-window.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

@media (max-width: 480px) {
  .chat-window { width: calc(100vw - 32px); right: 16px; bottom: 80px; }
  .chat-fab    { right: 16px; bottom: 16px; }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  background: linear-gradient(135deg, rgba(168,85,247,0.06), rgba(245,158,11,0.04));
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.chat-avatar svg { width: 22px; height: 22px; }

.chat-header-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-header-status {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse-live 1.5s infinite;
}

.chat-close-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.chat-close-btn svg { width: 15px; height: 15px; }
.chat-close-btn:hover {
  background: var(--accent-rose-light);
  border-color: rgba(244,63,94,0.2);
  color: var(--accent-rose);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background: #fafaf8;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }

.chat-msg { display: flex; max-width: 100%; }
.chat-msg--bot  { justify-content: flex-start; }
.chat-msg--user { justify-content: flex-end; }

.chat-msg-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
}

.chat-msg--bot .chat-msg-bubble {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.chat-msg--user .chat-msg-bubble {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border-bottom-right-radius: 4px;
  color: white;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 18px;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* Suggestion Chips */
.chat-suggestions {
  padding: 8px 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  background: #ffffff;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.suggestion-chip {
  background: var(--bg-secondary);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 100px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  white-space: nowrap;
}

.suggestion-chip:hover {
  background: var(--accent-purple-light);
  border-color: rgba(168,85,247,0.3);
  color: var(--accent-purple);
}

/* Input Area */
.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(0,0,0,0.07);
  background: #ffffff;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.chat-input::placeholder { color: var(--text-muted); }
.chat-input:focus {
  border-color: rgba(168,85,247,0.4);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(168,85,247,0.08);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chat-send-btn svg { width: 17px; height: 17px; }

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(168,85,247,0.45);
}

.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
