/* WhatsApp Chat Analyzer stylesheet */

/* fonts */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

/* css variables */
:root {
  --bg-base:       #0b0d14;
  --bg-surface:    #111420;
  --bg-card:       rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);

  --border:        rgba(255, 255, 255, 0.08);
  --border-accent: rgba(79, 142, 247, 0.35);

  --blue:          #4F8EF7;
  --blue-dim:      rgba(79, 142, 247, 0.15);
  --orange:        #FF7A3D;
  --orange-dim:    rgba(255, 122, 61, 0.15);

  --text-primary:  #E2E8F8;
  --text-secondary:#98A4C0;
  --text-muted:    #5A637A;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 32px rgba(79, 142, 247, 0.12);

  --transition: 0.22s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Subtle animated mesh background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(79,142,247,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(255,122,61,0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* layout components */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* header styles */
.app-header {
  padding: 40px 0 32px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--blue), #7B5CF0);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(79, 142, 247, 0.35);
}

.header-text h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #E2E8F8 0%, #98A4C0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-text p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* upload drop zone */
#upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
}

.upload-container {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.upload-headline {
  text-align: center;
}

.upload-headline h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.upload-headline p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Drop zone */
#drop-zone {
  width: 100%;
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  background: var(--bg-card);
  position: relative;
  overflow: hidden;
}

#drop-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 50%, rgba(79,142,247,0.06), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

#drop-zone:hover,
#drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-dim);
  transform: translateY(-2px);
}

#drop-zone:hover::before,
#drop-zone.drag-over::before {
  opacity: 1;
}

.drop-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
  filter: drop-shadow(0 0 12px rgba(79,142,247,0.4));
}

.drop-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.drop-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.drop-highlight {
  color: var(--blue);
  font-weight: 500;
}

.supported-format {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 14px;
  background: rgba(255,255,255,0.04);
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
}

/* instructions panel */
.how-to-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.how-to-card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.how-to-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.how-to-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--blue-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue);
  margin-top: 1px;
}

/* error banner */
#error-banner {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: rgba(220, 60, 60, 0.92);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#dismiss-error {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px;
  flex-shrink: 0;
  transition: color var(--transition);
}

#dismiss-error:hover { color: #fff; }

/* loading indicator */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(11, 13, 20, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(79,142,247,0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

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

#loading-overlay p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

/* results display */
#results-section {
  animation: fadeUp 0.45s ease;
}

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

/* Results header bar */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 28px 0 24px;
}

.results-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.file-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 5px 14px 5px 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.file-tag span { font-size: 1rem; }

#file-name-display {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--blue);
  font-weight: 500;
}

/* Reset button */
#reset-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

#reset-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-dim);
}

/* stat cards layout */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
}

.stat-card.blue::after  { background: linear-gradient(90deg, var(--blue), #7B5CF0); }
.stat-card.orange::after{ background: linear-gradient(90deg, var(--orange), #FFB23D); }
.stat-card.purple::after{ background: linear-gradient(90deg, #7B5CF0, var(--blue)); }
.stat-card.green::after { background: linear-gradient(90deg, #3DD68C, #1FA67A); }
.stat-card.teal::after  { background: linear-gradient(90deg, #3DC8C8, #1FA6A6); }

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.14);
  box-shadow: var(--shadow-card);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.small {
  font-size: 1.2rem;
  letter-spacing: -0.5px;
}

/* main chart wrapper */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 28px 20px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.section-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.chart-legend {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.dot-blue   { background: var(--blue); }
.dot-orange { background: var(--orange); }

.chart-wrapper {
  position: relative;
  height: 340px;
}

/* active users grid */
.active-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.badge-count {
  background: var(--blue-dim);
  border: 1px solid var(--border-accent);
  color: var(--blue);
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.section-subtitle { margin-bottom: 20px; }

#active-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

/* User card */
.user-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
  animation: fadeUp 0.35s ease both;
}

.user-card:hover {
  transform: translateY(-3px);
  border-color: rgba(79,142,247,0.3);
  background: var(--bg-card-hover);
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-dim), rgba(123,92,240,0.2));
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Day pip row */
.day-pips {
  display: flex;
  gap: 5px;
  align-items: center;
}

.day-pip {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  flex: 1;
  transition: transform var(--transition);
}

.pip-filled { background: linear-gradient(90deg, var(--blue), #7B5CF0); }
.pip-empty  { background: rgba(255,255,255,0.08); }

/* empty state */
#no-active-msg {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

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

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

/* media queries */
@media (max-width: 640px) {
  .app-header { padding: 28px 0 20px; flex-wrap: wrap; }
  .header-text h1 { font-size: 1.35rem; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.6rem; }

  .chart-card { padding: 20px 16px 16px; }
  .chart-wrapper { height: 260px; }

  #active-users-grid { grid-template-columns: 1fr; }

  .results-header { flex-direction: column; align-items: flex-start; }
}
