/* Basic CSS Variables for theming (Light mode by default) */
:root {
  --bg-color: #f4f7f6;
  --bg-color-card: #ffffff;
  --text-primary: #333333;
  --text-secondary: #666666;
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --border-color: #e5e7eb;
  --font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  background-color: var(--bg-color-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #ecfdf5;
  color: #065f46;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Cards */
.card {
  background-color: var(--bg-color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 2rem;
  min-width: 0;
}

/* Upload Section */
#upload-section {
  text-align: center;
  max-width: 600px;
  margin: 4rem auto;
}

#upload-section h2 {
  font-size: 1.875rem;
  margin-bottom: 0.5rem;
}

#upload-section p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  transition: all 0.2s ease;
  background-color: #fafafa;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.drop-zone.dragover {
  border-color: var(--primary-color);
  background-color: #eff6ff;
}

.upload-icon {
  color: var(--primary-color);
  margin-bottom: 1rem;
  width: 48px;
  height: 48px;
}

.drop-zone-or {
  margin: 1rem 0;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hidden-input {
  display: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  border: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

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

/* Loading Indicator */
#loading-indicator {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Dashboard Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  background-color: var(--bg-color-card);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  cursor: pointer;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: var(--bg-color-card);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card h3 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
}

.stat-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

.chart-container {
  padding: 1.5rem;
  position: relative;
}

.chart-container h3 {
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.chart-wide {
  grid-column: 1 / -1;
}

.canvas-wrapper {
  position: relative;
  height: 300px;
  width: 100%;
  min-width: 0;
}

.chart-wide .canvas-wrapper {
  height: 400px;
}

canvas {
  max-width: 100%;
}

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

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

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

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .card {
    padding: 1rem;
  }
}

/* Mood Calendar (GitHub Style) */
.mood-calendar-grid {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 1rem;
  align-items: flex-start;
}

.calendar-week {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-day {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background-color: #ebedf0;
  cursor: pointer;
  transition: transform 0.1s;
}

.calendar-day:hover {
  transform: scale(1.2);
  z-index: 10;
}

/* Default Sentiment Colors Mapping based roughly on 1-5 score */
.calendar-day[data-level="1"] { background-color: #fca5a5; }
.calendar-day[data-level="2"] { background-color: #fcd34d; }
.calendar-day[data-level="3"] { background-color: #93c5fd; }
.calendar-day[data-level="4"] { background-color: #6ee7b7; }
.calendar-day[data-level="5"] { background-color: #10b981; }

.calendar-tooltip {
  position: absolute;
  background-color: rgba(17, 24, 39, 0.9);
  color: #f9fafb;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 500;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}
