@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&family=Quicksand:wght@300;400;500;600;700&display=swap');

:root {
  /* Dashboard Color Palette - Shared/Constant */
  --color-primary: #E93B81;
  /* Main Pink */
  --font-heading: 'Fredoka', sans-serif;

  --sidebar-width: 260px;
  --header-height: 64px;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --transition-speed: 0.3s;

  /* Mood Tracker Colors (Light Default) */
  --color-mood-bar-bg: #E8F5E9;
  --color-mood-cal-bg: #F3E8FF;
  --color-gauge-track: #EEEEEE;
  --color-calendar-day: #FFFFFF;
}

/* Light Theme (Default) */
[data-theme="light"],
:root:not([data-theme="dark"]) {
  --color-bg-sidebar: #FFFFFF;
  --color-bg-page: #FDFBFC;
  --color-border: #F0F2F5;
  --color-text-main: #2D3748;
  --color-text-muted: #718096;

  /* Additional theme colors for landing/login pages */
  --color-bg-primary: #FFF0F5;
  --color-secondary: #FFE4E1;
  --color-accent: #FFB6C1;

  /* Additional theme colors for components */
  --color-bg-light: #F7FAFC;
  --color-bg-secondary: #F3F0FF;
  --color-input-bg: #FFFFFF;
  --color-card-alt: #F8F7FF;
  --color-white: #FFFFFF;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --header-bg: rgba(255, 255, 255, 0.9);
  --card-bg: #FFFFFF;
  --color-secondary-brand: #4A154B;
  --color-nav-hover: #FEEFF5;
  --color-nav-active: #FEEDF4;
  --color-icon-hover: #F7FAFC;
}

/* Dark Theme */
[data-theme="dark"] {
  --color-bg-sidebar: #1A202C;
  --color-bg-page: #171923;
  --color-border: #2D3748;
  --color-text-main: #EDF2F7;
  --color-text-muted: #A0AEC0;

  --color-bg-primary: #2D1B24;
  --color-bg-secondary: #2D3748;
  /* Darker secondary for settings */
  --color-input-bg: #1A202C;
  --color-card-alt: #2D3748;
  --color-secondary: #3D2B32;
  --color-accent: #4D3B40;

  --color-bg-light: #2D3748;
  --color-white: #4A5568;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --header-bg: rgba(26, 32, 44, 0.9);
  --card-bg: #1A202C;
  --color-secondary-brand: #E9D8FD;

  /* Nav Hover states */
  --color-nav-hover: #2D1B24;
  --color-nav-active: #3D2B32;
  --color-icon-hover: #2D3748;

  --color-mood-bar-bg: #1B2E1B;
  --color-mood-cal-bg: #211B2E;
  --color-gauge-track: #2D3748;
  --color-calendar-day: #2D3748;
}


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  background-color: var(--color-bg-page);
  color: var(--color-text-main);
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Remove global transition that causes flashing on page load */
/* Transitions will be handled by specific components or during theme toggle only */

.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

/* Dashboard Wrapper */
.dashboard-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
  /* Soft shadow for depth */
}

/* ... */
.sidebar-logo {
  padding: 8px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  margin-left: 10px;
  margin-right: 10px;
}

.sidebar-logo img {
  width: 100%;
  height: auto;
  max-height: 120px;
  /* Maximum visibility */
  object-fit: contain;
  mix-blend-mode: multiply;
}

[data-theme="dark"] .sidebar-logo {
  background: transparent;
  box-shadow: none;
}

[data-theme="dark"] .sidebar-logo img {
  filter: invert(1) hue-rotate(180deg) brightness(1.2) contrast(1.1);
  mix-blend-mode: normal;
}

.nav-section {
  padding: 0 16px;
  flex-grow: 1;
}

.nav-label {
  display: none;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-nav a::after {
  content: '...';
  position: absolute;
  right: 14px;
  font-size: 1.2rem;
  line-height: 0;
  margin-top: -4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar-nav a:hover::after,
.sidebar-nav a.active::after {
  opacity: 1;
}

.sidebar-nav a:hover {
  background: var(--color-nav-hover);
  color: var(--color-primary);
}

.sidebar-nav a.active {
  background: var(--color-nav-active);
  color: var(--color-primary);
  font-weight: 600;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.green {
  background: #48BB78;
}

.dot.orange {
  background: #ED8936;
}

.dot.purple {
  background: #9F7AEA;
}

.dot.blue {
  background: #4299E1;
}

.dot.pink {
  background: #E93B81;
}

.sidebar-footer {
  padding: 24px 16px 0;
  border-top: 1px solid var(--color-border);
}

/* Main Content Area */
.main-view {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

/* Top Header */
.top-header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--color-border);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 90;
  transition: background var(--transition-speed) ease, border var(--transition-speed) ease;
}

.header-center {
  flex-grow: 1;
  display: flex;
  justify-content: center;
}

.header-center img {
  height: 40px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-icons {
  display: flex;
  gap: 8px;
  color: var(--color-text-muted);
}

.header-icons span {
  cursor: pointer;
  font-size: 1.5rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.header-icons span svg {
  width: 24px;
  height: 24px;
}

.header-icons span:hover {
  background: var(--color-icon-hover);
  color: var(--color-primary);
  transform: translateY(-2px);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 24px;
  transition: all 0.2s ease;
}

.user-profile:hover {
  background: var(--color-icon-hover);
}

.user-profile svg {
  width: 20px;
  height: 20px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.2;
}

.points-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.points-badge span:first-child {
  color: #F6AD55;
  /* Yellow star */
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  border: 1.5px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Container & Page Layout */
.page-container,
.container {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.animate-fade-in {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Common Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: background var(--transition-speed) ease, border var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 64px;
  height: 64px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(233, 59, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 10px 25px rgba(233, 59, 129, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 80px;
  }

  .nav-label,
  .sidebar-nav span,
  .user-name {
    display: none;
  }

  .sidebar-logo {
    padding: 0;
    display: flex;
    justify-content: center;
  }
}

/* Legacy Navbar Rules for Non-Dashboard Pages (Backwards Compatibility) */

/* Helper Text Classes */
.text-primary {
  color: var(--color-primary);
}

.text-secondary {
  color: var(--color-secondary-brand);
}

.text-muted {
  color: var(--color-text-muted);
}

.emoji-large {
  font-size: 1.8rem;
}

/* Header Formatting */
.header-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  width: 90%;
  max-width: 500px;
  position: relative;
  border-radius: var(--radius-lg);
  padding: 32px;
}

.modal-title {
  font-family: var(--font-heading);
  margin-bottom: 8px;
  color: var(--color-text-main);
}

.modal-subtitle {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* Form Styles */
.compose-form {
  margin-top: 20px;
}

.input-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-main);
}

.input-group select,
.input-group input,
.input-group textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-light);
  color: var(--color-text-main);
  font-family: inherit;
  transition: border-color 0.2s ease, background var(--transition-speed) ease, color var(--transition-speed) ease;
}

.input-group select:focus,
.input-group input:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.input-group textarea {
  resize: vertical;
  min-height: 100px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.btn {
  padding: 10px 24px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  border: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: #D53272;
}

.btn-secondary {
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.btn-secondary:hover {
  background: var(--color-bg-light);
}

/* Theme Toggle Specifics */
.theme-toggle-btn .sun-icon {
  display: none;
}

.theme-toggle-btn .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle-btn .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle-btn .moon-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle-btn {
  color: #F6AD55;
}

/* Custom Modal Popup */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.custom-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.custom-modal {
  background: var(--color-bg-sidebar);
  width: 90%;
  max-width: 400px;
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.custom-modal-overlay.active .custom-modal {
  transform: translateY(0);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  display: block;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 12px;
}

.modal-body {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

.modal-close-btn {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.modal-close-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(233, 59, 129, 0.3);
}

[data-theme="dark"] .custom-modal {
  border: 1px solid rgba(255, 255, 255, 0.1);
}