/* CalorieTally Main Stylesheet - Applied across all pages */

:root {
  /* Core colors */
  --primary: #F01B42;
  --primary-dark: #C01236;
  --primary-light: #FF3961;
  --accent: #FF8E20;

  /* Background colors */
  --bg-darkest: #111111;
  --bg-dark: #1A1A1A;
  --bg-card: #242424;
  --bg-elevated: #2D2D2D;

  /* Text colors */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.87);
  --text-tertiary: rgba(255, 255, 255, 0.6);

  /* Border colors */
  --border-light: rgba(255, 255, 255, 0.12);

  /* Sidebar dimensions */
  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-darkest);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-light);
  text-decoration: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
}

h1 {
  font-size: 40px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 32px;
}

h3 {
  font-size: 24px;
}

h4 {
  font-size: 20px;
}

p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* Auth Pages */
.auth-page {
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.auth-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  filter: blur(70px);
  opacity: 0.15;
  border-radius: 50%;
}

.blob-1 {
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  width: 800px;
  height: 800px;
  top: -250px;
  right: -200px;
}

.blob-2 {
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  width: 600px;
  height: 600px;
  bottom: -200px;
  left: -150px;
}

.blob-3 {
  background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  width: 400px;
  height: 400px;
  bottom: 10%;
  right: 20%;
}

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  z-index: 1;
  position: relative;
  padding: 16px;
}

.auth-content {
  display: flex;
  width: 100%;
  max-width: 1400px;
  height: auto;
  min-height: 800px;
  max-height: 900px;
  background: rgba(26, 26, 26, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-left {
  flex: 1.2;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
}

.auth-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(240, 27, 66, 0.9) 0%, rgba(17, 17, 17, 0.9) 100%);
  z-index: 1;
}

.auth-content-inner {
  position: relative;
  z-index: 2;
  padding: 40px;
  width: 100%;
  max-width: 650px;
  text-align: center;
}

.auth-title {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.auth-icon {
  margin: 24px auto;
}

.auth-subtitle {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 32px;
  opacity: 0.9;
}

.auth-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}

.auth-feature {
  display: flex;
  align-items: center;
  text-align: left;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  width: calc(50% - 8px);
}

.feature-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 18px;
}

.feature-text {
  font-weight: 500;
  font-size: 14px;
}

.auth-right {
  width: 480px;
  padding: 50px;
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.auth-brand {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  overflow: hidden;
  margin-right: 12px;
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
}

.brand-name span {
  color: var(--primary);
}

.auth-form-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-form-subtitle {
  color: var(--text-tertiary);
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
}

.form-control {
  width: 100%;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(240, 27, 66, 0.2);
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

.password-field {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  cursor: pointer;
  z-index: 3;
}

.form-check {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.form-check-input {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  cursor: pointer;
}

.form-check-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: 12px;
  padding: 14px 20px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-family: 'Inter', sans-serif;
}

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

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

.btn-google {
  background-color: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 12px;
  width: 100%;
  margin-top: 12px;
}

.btn-google:hover {
  background-color: #e0e0e0;
  color: #333;
}

.btn i {
  margin-right: 8px;
}

.auth-separator {
  display: flex;
  align-items: center;
  margin: -10px 0;
}

.auth-separator::before,
.auth-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-light);
}

.auth-separator span {
  padding: 0 16px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.error-message {
  color: var(--primary);
  font-size: 13px;
  margin-top: 6px;
}

/* Main app layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Enhanced Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile browsers */
  position: fixed;
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(36, 36, 36, 0.95) 100%);
  display: flex;
  flex-direction: column;
  z-index: 1100;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.25);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border-right: 1px solid var(--border-light);
}

/* Glass morphism effect */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top left, rgba(240, 27, 66, 0.1), transparent 50%);
  pointer-events: none;
}

/* Sidebar Header */
.sidebar-header {
  padding: 28px 24px;
  position: relative;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  position: relative;
}

.sidebar-logo {
  height: 40px;
  transition: all 0.4s ease;
  filter: drop-shadow(0 2px 8px rgba(240, 27, 66, 0.3));
  display: block;
}

.sidebar-icon {
  display: none;
}

/* Desktop Toggle Button */
.desktop-toggle {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.desktop-toggle:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(240, 27, 66, 0.4);
}

/* Mobile Close Button */
.mobile-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: auto;
}

.mobile-close:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-50%) rotate(90deg) scale(1.1);
}

/* Menu Section */
.sidebar-menu {
  flex: 1;
  padding: 24px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.menu-section {
  margin-bottom: 32px;
}

.menu-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 0 24px;
  margin-bottom: 12px;
  opacity: 1;
  transition: all 0.3s ease;
  overflow: hidden;
  height: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  margin: 4px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 16px;
  position: relative;
  transition: all 0.3s ease;
  overflow: hidden;
  border: none;
  background: none;
  width: calc(100% - 24px);
  text-align: left;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

.menu-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.3s ease;
  opacity: 0.1;
}

.menu-item:hover::before {
  width: 100%;
}

.menu-item:hover {
  color: var(--text-primary);
  transform: translateX(4px);
}

.menu-item.active {
  background: linear-gradient(135deg, rgba(240, 27, 66, 0.15), rgba(240, 27, 66, 0.05));
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(240, 27, 66, 0.2);
}

.menu-item.active::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(240, 27, 66, 0.6);
}

.menu-icon {
  width: 24px;
  height: 24px;
  margin-right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
  font-size: 18px;
}

.menu-item.active .menu-icon {
  transform: scale(1.1);
}

.menu-item:hover .menu-icon {
  transform: rotate(-5deg) scale(1.1);
}

.menu-text {
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 20px 12px;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
}

/* Logout button styling */
.logout-form {
  margin: 0;
  width: 100%;
}

.logout-btn {
  font-family: 'Inter', sans-serif;
  width: 100%;
  margin: 0;
  justify-content: flex-start;
  font-size: 15px;
}

.logout-btn:hover {
  color: var(--primary);
  background: rgba(240, 27, 66, 0.1);
}

/* Collapsed State */
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header {
  padding: 28px 16px;
  justify-content: center;
}

.sidebar.collapsed .sidebar-logo {
  display: none;
}

.sidebar.collapsed .sidebar-icon {
  display: none;
}

.sidebar.collapsed .desktop-toggle {
  left: 50%;
  right: auto;
  transform: translateY(-50%) translateX(-50%);
}

.sidebar.collapsed .desktop-toggle i {
  transform: none;
}

.sidebar.collapsed .menu-section-title {
  opacity: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

.sidebar.collapsed .menu-item {
  padding: 14px;
  justify-content: center;
  margin: 4px 8px;
  width: calc(100% - 16px);
}

.sidebar.collapsed .menu-icon {
  margin: 0;
}

.sidebar.collapsed .menu-text {
  display: none;
}

.sidebar.collapsed .menu-item.active::after {
  display: none;
}

.sidebar.collapsed .menu-item.active::before {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
  opacity: 1;
}

.sidebar.collapsed .sidebar-footer {
  padding: 20px 8px;
}

/* Tooltips for collapsed state */
.sidebar.collapsed .menu-item[data-tooltip] {
  position: relative;
}

.sidebar.collapsed .menu-item[data-tooltip]:not(.active)::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 16px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  z-index: 1000;
  pointer-events: none;
}

.sidebar.collapsed .menu-item:hover[data-tooltip]:not(.active)::after {
  opacity: 1;
  visibility: visible;
  margin-left: 24px;
}

/* Menu ripple effect */
.menu-ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Main content adjustment */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
}

/* Top Bar */
.top-bar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background-color: var(--bg-dark);
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

/* User Menu in Top Bar */
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-menu .user-info {
  text-align: right;
}

.user-menu .user-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.user-menu .user-role {
  font-size: 12px;
  color: var(--text-tertiary);
}

.user-menu .user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--primary);
  transition: all 0.3s ease;
}

.user-menu .user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(240, 27, 66, 0.3);
}

.content-wrapper {
  flex: 1;
  padding: 32px;
  background-color: var(--bg-darkest);
}

/* Scrollbar Styling */
.sidebar-menu::-webkit-scrollbar {
  width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-light);
}

.card-header {
  padding: 16px 20px;
  background-color: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-weight: 600;
  margin: 0;
  font-size: 18px;
}

.card-body {
  padding: 20px;
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0px); }
}

@keyframes bounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  75% { transform: scale(1.1) rotate(5deg); }
}

.floating {
  animation: float 6s ease-in-out infinite;
}

/* Helper classes */
.text-danger { color: var(--primary) !important; }
.text-success { color: #4CAF50 !important; }
.text-warning { color: #FFC107 !important; }
.text-info { color: #2196F3 !important; }

.bg-danger { background-color: var(--primary) !important; }
.bg-success { background-color: #4CAF50 !important; }
.bg-warning { background-color: #FFC107 !important; }
.bg-info { background-color: #2196F3 !important; }

.text-center { text-align: center !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 24px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 16px !important; }
.mt-4 { margin-top: 24px !important; }

/* Responsive */
@media (max-width: 991px) {
  .auth-content {
    flex-direction: column;
    max-height: none;
  }

  .auth-left {
    min-height: 300px;
  }

  .auth-right {
    width: 100%;
  }

  .main-content {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  /* Mobile sidebar styles */
  .sidebar {
    width: 85%;
    max-width: 300px;
    transform: translateX(-100%);
    background: var(--bg-card);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  }

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

  .desktop-toggle {
    display: none !important;
  }

  .sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  .sidebar-logo-link {
    flex: 1;
    display: flex;
    justify-content: center;
  }

  .mobile-close {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
  }

  .menu-item {
    padding: 16px 20px !important;
    margin: 4px 16px !important;
    font-size: 16px;
    width: calc(100% - 32px) !important;
  }

  .menu-item.active {
    background: linear-gradient(135deg, rgba(240, 27, 66, 0.2), rgba(240, 27, 66, 0.1));
  }

  .menu-item.active::after {
    display: none;
  }

  .menu-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 20px;
  }

  .sidebar-footer {
    padding: 20px 16px;
  }

  .logout-btn {
    padding: 16px 20px;
    margin: 4px 16px;
    width: calc(100% - 32px);
  }

  .main-content {
    margin-left: 0 !important;
    width: 100%;
  }
}

@media (max-width: 576px) {
  .auth-content-inner {
    padding: 24px 16px;
  }

  .auth-right {
    padding: 24px 16px;
  }

  .auth-title {
    font-size: 32px;
  }

  .content-wrapper {
    padding: 16px;
  }

  .top-bar {
    padding: 0 16px;
  }
}