/* ==========================================================================  
   Main CSS - FitJourney Base Styles with Enhanced Sidebar
   ========================================================================== */

/* CSS Variables */
:root {
  --primary: #6A1B9A;       /* Deeper Purple */
  --primary-light: #9c4dcc; /* Lighter Purple */
  --primary-dark: #38006b;  /* Darker Purple */
  --accent:  #FF6F00;       /* Vibrant Amber */
  --accent-light: #ffa040;  /* Lighter Amber */
  --accent-dark: #c43e00;   /* Darker Amber */
  --dark-bg: #1C1C1C;       /* Dark Background for content */
  --darker-bg: #121212;     /* Even Darker Background */
  --card-bg: #1E1E1E;       /* Card Background */
  --sidebar-bg: #161616;    /* Sidebar Background */
  --text-color: #e0e0e0;
  --light-text: #b0b0b0;
  --muted-text: #808080;
  --border-color: rgba(255, 255, 255, 0.1);
  --glow: rgba(106, 27, 154, 0.4);
  --success: #4CAF50;
  --warning: #FFC107;
  --error: #F44336;
  --info: #2196F3;
  --transition-speed: 0.3s;
  --border-radius: 8px;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --sidebar-width: 280px;
  --header-height: 70px;
  
  /* Color palette for elements */
  --amber: #FF6F00;
  --green: #388E3C;
  --blue: #1976D2;
  --purple: #6A1B9A;
  --red: #D32F2F;
  --teal: #00796B;
  --orange: #E64A19;
}

/* Base Styles */
body {
  font-family: var(--font-family);
  background-color: var(--dark-bg);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  transition: background-color var(--transition-speed) ease;
}

* {
  box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  font-weight: 600;
  line-height: 1.3;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

a:hover {
  color: var(--accent-light);
}

button {
  cursor: pointer;
  font-family: var(--font-family);
  background: none;
  border: none;
  outline: none;
}

button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header Styles */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  background-size: 200% 200%;
  animation: gradientShift 10s ease infinite;
  z-index: 1000;
  box-shadow: 0 2px 8px var(--glow);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color var(--transition-speed) ease;
}

.sidebar-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: white;
  font-weight: 600;
  font-size: 1.4rem;
}

.logo img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  margin-right: 0.75rem;
  background: white;
}

.nav {
  display: flex;
}

.nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav ul li {
  margin: 0 1rem;
}

.nav ul li a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.nav ul li a:hover,
.nav ul li a.active {
  background-color: rgba(255, 255, 255, 0.2);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
}

.theme-toggle button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color var(--transition-speed) ease;
}

.theme-toggle button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.user-profile {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 24px;
  background-color: rgba(255, 255, 255, 0.1);
  transition: background-color var(--transition-speed) ease;
}

.user-profile:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.user-profile .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 0.5rem;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--text-color);
}

.user-profile .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-profile .user-name {
  margin: 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.dropdown-arrow {
  transition: transform var(--transition-speed) ease;
}

.user-profile.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* User Dropdown */
.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-speed) ease;
  z-index: 1001;
  border: 1px solid var(--border-color);
}

.user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color var(--transition-speed) ease;
  border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.dropdown-item.logout:hover {
  background-color: rgba(244, 67, 54, 0.1);
  color: var(--error);
}

.dropdown-item i {
  margin-right: 0.75rem;
  font-size: 1.1rem;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0.5rem 0;
}

/* Sidebar Styles */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--sidebar-bg);
  transform: translateX(-100%);
  transition: transform var(--transition-speed) ease;
  z-index: 999;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
}

.sidebar.active {
  transform: translateX(0);
}

.sidebar-content {
  padding: 1.5rem 0;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-title {
  padding: 0 1.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav-item {
  margin-bottom: 0.25rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: var(--light-text);
  text-decoration: none;
  transition: all var(--transition-speed) ease;
  position: relative;
}

.sidebar-nav-link:hover,
.sidebar-nav-link.active {
  background-color: rgba(106, 27, 154, 0.1);
  color: var(--accent);
}

.sidebar-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.sidebar-nav-link i {
  margin-right: 1rem;
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.sidebar-nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}

.sidebar-nav-badge.water-badge {
  background: var(--info);
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-speed) ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Main Content */
.main-wrapper {
  margin-top: var(--header-height);
  margin-left: 0;
  transition: margin-left var(--transition-speed) ease;
  min-height: calc(100vh - var(--header-height));
}

.main-wrapper.sidebar-open {
  margin-left: var(--sidebar-width);
}

.main-content {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Content Sections */
.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-header h1 {
  font-size: 2.5rem;
  margin: 0;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.section-description {
  color: var(--light-text);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 90px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--card-bg);
  border-left: 4px solid;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  animation: slideInRight 0.3s ease;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--error);
}

.toast.warning {
  border-color: var(--warning);
}

.toast.info {
  border-color: var(--info);
}

.toast-icon {
  color: var(--text-color);
  font-size: 1.5rem;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--error);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast.info .toast-icon {
  color: var(--info);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 4px;
}

.toast-message {
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 500;
}

.toast-close {
  color: var(--muted-text);
  background: transparent;
  border: none;
  font-size: 1.25rem;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.toast-close:hover {
  color: var(--text-color);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Button styles */
.btn {
  padding: 0.75rem 1.25rem;
  border-radius: var(--border-radius);
  font-weight: 500;
  transition: all var(--transition-speed) ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: var(--font-family);
  text-decoration: none;
  border: none;
}

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

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

.btn-secondary {
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}

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

.btn-success:hover {
  background: #66BB6A;
}

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

.btn-danger:hover {
  background: #E57373;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  transition: all var(--transition-speed) ease;
  padding: 0;
}

.btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
}

/* Form controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--light-text);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background-color: var(--darker-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-color);
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  font-family: var(--font-family);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--glow);
}

select.form-control {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23b0b0b0' 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 1rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Keyframes */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Spinner Animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  color: var(--light-text);
}

/* Footer */
.dashboard-footer {
  background: var(--darker-bg);
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
}

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

.footer-left p {
  margin: 0;
  color: var(--light-text);
  font-size: 0.9rem;
}

.footer-right {
  display: flex;
  gap: 1.5rem;
}

.footer-right a {
  color: var(--light-text);
  font-size: 0.9rem;
  transition: color var(--transition-speed) ease;
}

.footer-right a:hover {
  color: var(--text-color);
}

/* Responsive styles */
@media (max-width: 1200px) {
  .main-wrapper.sidebar-open {
    margin-left: 0;
  }
  
  .sidebar {
    width: 100%;
    max-width: var(--sidebar-width);
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }
  
  .header .container {
    padding: 0 1rem;
  }
  
  .desktop-nav {
    display: none;
  }
  
  .user-name {
    display: none;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .section-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 576px) {
  .header .container {
    padding: 0 0.75rem;
  }
  
  .logo span {
    display: none;
  }
  
  .main-content {
    padding: 0.75rem;
  }
}

/* Make sure we respect dark mode preferences */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}