/* ============================= */
/* 1. RESET & VARIABLES         */
/* ============================= */
:root {
  --bg-main: #0e1117;
  --bg-card: #161b22;
  --bg-input: #0e1117;
  --border-color: #30363d;
  --text-primary: #e6e8eb;
  --text-secondary: #8b949e;
  --accent: #7c7cff;
  --accent-hover: #9696ff;
  --danger: #f85149;
  --radius: 12px;
  --transition: all 0.2s ease;
  --scroll-behaviour:smooth
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 50px;
}

/* ============================= */
/* 2. LAYOUT                     */
/* ============================= */
.app-header {
  padding: 48px 24px 24px;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.app-header h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, #7c7cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.app-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ============================= */
/* 3. CARDS                      */
/* ============================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================= */
/* 4. FORMS                      */
/* ============================= */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
  transition: var(--transition);
  appearance: none; /* Removes default arrow to style our own if needed */
}

textarea {
  min-height: 110px;
  resize: vertical;
}

select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 124, 255, 0.15);
}

/* ============================= */
/* 5. BUTTONS                    */
/* ============================= */
.primary-btn {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

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

.primary-btn:active {
  transform: translateY(0);
}

.text-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0.8;
  transition: var(--transition);
}

.text-btn:hover {
  opacity: 1;
  background: rgba(248, 81, 73, 0.1);
}

/* ============================= */
/* 6. HISTORY LIST               */
/* ============================= */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.history-header h2 { margin-bottom: 0; }

#historyList {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.entry-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid var(--accent);
  animation: slideIn 0.3s ease-out;
}

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

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.entry-mood {
  font-size: 18px;
  font-weight: 700;
}

.entry-time {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.entry-note {
  font-size: 14px;
  color: #c9d1d9;
  font-style: italic;
}

.muted {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 0;
}

/* ============================= */
/* 7. RESPONSIVE                 */
/* ============================= */
@media (max-width: 600px) {
  .app-header { padding: 32px 16px 16px; }
  .card { padding: 20px; }
  .app-header h1 { font-size: 26px; }
}

/* ============================= */
/* CHART SPECIFIC FIXES          */
/* ============================= */

.chart-card {
    display: flex;
    flex-direction: column;
    min-height: 400px; /* Gives enough room for header + chart */
}

.chart-wrapper {
    position: relative;
    flex-grow: 1; /* Fills remaining space in card */
    min-height: 250px; 
    width: 100%;
}

/* Force the canvas to respect the wrapper */
#moodChart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.filter-btn {
    background: #161b22;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
}

.filter-btn.active {
    background: #7c7cff;
    color: white;
    border-color: #7c7cff;
}
.mood-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.mood-item {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 12px 5px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    font-size: 20px;
}

.mood-item span {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.mood-item:hover { border-color: var(--accent); }

.mood-item.active {
    background: rgba(124, 124, 255, 0.1);
    border-color: var(--accent);
    transform: scale(1.05);
}

/* ============================= */
/* SMOOTH CUSTOM SLIDER          */
/* ============================= */

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px; /* Thin like YouTube/Spotify */
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  /* This creates the 'fill' logic */
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 50% 100%; /* Starts at 50% (value 5) */
  background-repeat: no-repeat;
  transition: background 0.1s ease;
}

/* The Handle (Thumb) */
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: #fff; /* White handle like Spotify */
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease-in-out;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.3); /* Grows slightly on hover */
}

/* Firefox Support */
.slider::-moz-range-thumb {
  height: 14px;
  width: 14px;
  border: none;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}
.insight-card {
    background: linear-gradient(145deg, #1c2128 0%, #161b22 100%);
    border: 1px solid var(--accent);
    position: relative;
    box-shadow: 0 0 15px rgba(124, 124, 255, 0.1);
}

.insight-badge {
    position: absolute;
    top: -10px;
    right: 20px;
    background: var(--accent);
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.forecast-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 10px;
}

.forecast-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.forecast-item strong {
    display: block;
    color: var(--accent);
    font-size: 12px;
    margin-bottom: 4px;
}

.forecast-item p {
    font-size: 13px;
    margin: 0;
}

/* ============================= */
/* AI PULSE ANIMATIONS           */
/* ============================= */

/* The Heartbeat Pulse */
@keyframes aiPulse {
  0% { box-shadow: 0 0 5px rgba(124, 124, 255, 0.2); border-color: rgba(124, 124, 255, 0.3); }
  50% { box-shadow: 0 0 20px rgba(124, 124, 255, 0.5); border-color: rgba(124, 124, 255, 0.8); }
  100% { box-shadow: 0 0 5px rgba(124, 124, 255, 0.2); border-color: rgba(124, 124, 255, 0.3); }
}

/* The Shimmer Scan */
@keyframes shimmerScan {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.insight-card {
  animation: aiPulse 3s infinite ease-in-out;
  background: linear-gradient(
    90deg, 
    #161b22 0%, 
    #1c2128 40%, 
    #161b22 60%, 
    #161b22 100%
  );
  background-size: 200% 100%;
  transition: all 0.5s ease;
}

/* Apply the shimmer only when it's "Thinking" (under 5 entries) */
.insight-card.thinking {
  animation: aiPulse 2s infinite ease-in-out, shimmerScan 3s infinite linear;
}

.insight-badge {
  /* Let's make the badge glow too */
  box-shadow: 0 0 10px var(--accent);
}

.portfolio-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background: #000; /* Change this per project! */
    color: #fff;
    border: 2px solid #333;
    border-radius: 50px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    z-index: 1000;
  }