/* Modern Sidebar Layout CSS */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 60px;
  
  /* Lighter Marshmallow Color Palette */
  --marshmallow-toasted: #F5E2D0;  /* Very light toasted marshmallow */
  --marshmallow-light: #FAF6F2;    /* Barely tinted marshmallow */
  --marshmallow-white: #FEFDFB;    /* Pure marshmallow white */
  
  --tree-bark-subtle: #D4C4B0;     /* Very light wood tone */
  --tree-bark-light: #E8DDD4;      /* Extremely light bark */
  --tree-accent: #C8B5A0;          /* Subtle wood accent */
  
  /* Very subtle background variations */
  --bg-color: #FEFCFA;             /* Main background - almost white */
  --bg-accent: #FAF8F6;            /* 5% darker for subtle depth */
  --card-bg: #FFFFFF;              /* Pure white for cards */
  --sidebar-bg: #FCFAF8;           /* 3% different from main bg */
  
  /* Text colors - softer */
  --text-color: #5A4A42;           /* Soft dark brown text */
  --text-light: #8B7B73;           /* Light brown text */
  --text-muted: #A89890;           /* Muted text */
  --white: #ffffff;
  
  /* Icon color */
  --icon-color: #8B7B73;           /* Consistent mono-color for icons */
  --icon-active: #5A4A42;          /* Darker for active state */
  
  /* Very subtle shadows */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.06);
  --transition: all 0.3s ease;
}

/* Reset for sidebar layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-color);
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.04);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 1000;
  border-right: 1px solid var(--marshmallow-light);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

/* Sidebar Header */
.sidebar-header {
  padding: 1.5rem 1.5rem 2rem 1.5rem;
  background: linear-gradient(135deg, var(--marshmallow-toasted) 0%, var(--tree-bark-light) 100%);
  color: var(--text-color);
  text-align: center;
  border-bottom: 1px solid var(--marshmallow-light);
  min-height: 120px; /* Ensure adequate height for logos */
}

.sidebar-header h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  margin: 0;
  transition: var(--transition);
  color: var(--text-color);
}

.sidebar.collapsed .sidebar-header h3 {
  font-size: 0;
  opacity: 0;
}

.sidebar-header .logo-icon {
  width: auto;
  height: auto;
  margin: 0 auto 0.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar.collapsed .sidebar-header {
  padding: 1rem;
  min-height: 80px; /* Smaller but still adequate when collapsed */
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  background: var(--sidebar-bg);
}

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

.sidebar-nav li {
  margin-bottom: 0.1rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  font-family: 'Open Sans', sans-serif;
  font-weight: 700;
  gap: 0.75rem; /* Consistent spacing between icon and text */
}

.sidebar-nav a:hover {
  background: var(--marshmallow-light);
  color: var(--text-color);
  padding-left: 1.25rem;
}

.sidebar-nav a.active {
  background: var(--marshmallow-toasted);
  color: var(--text-color);
  font-weight: 700;
}

.sidebar-nav a.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tree-accent);
}

.sidebar-nav .nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-color);
}

.sidebar-nav .nav-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.sidebar-nav a:hover .nav-icon {
  color: var(--text-color);
}

.sidebar-nav a.active .nav-icon {
  color: var(--icon-active);
}

.sidebar-nav .nav-text {
  transition: var(--transition);
  white-space: nowrap;
}

.sidebar.collapsed .nav-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-nav a {
  padding: 0.75rem;
  justify-content: center;
  gap: 0;
}

.sidebar.collapsed .sidebar-nav a:hover {
  padding-left: 0.75rem;
}

/* Submenu Styles */
.sidebar-nav .menu-item {
  position: relative;
}

.sidebar-nav .menu-toggle {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  font-family: 'Open Sans', sans-serif;
  font-weight: 700;
  gap: 0.75rem;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.sidebar-nav .menu-toggle:hover {
  background: var(--marshmallow-light);
  color: var(--text-color);
  padding-left: 1.25rem;
}

.sidebar-nav .menu-toggle.active {
  background: var(--marshmallow-toasted);
  color: var(--text-color);
  font-weight: 700;
}

.sidebar-nav .menu-toggle.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tree-accent);
}

.sidebar-nav .menu-toggle .toggle-arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
  font-size: 0.8rem;
}

.sidebar-nav .menu-toggle.expanded .toggle-arrow {
  transform: rotate(180deg);
}

.sidebar-nav .submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(138, 122, 107, 0.03);
}

.sidebar-nav .submenu.expanded {
  max-height: 500px;
}

.sidebar-nav .submenu li {
  margin-bottom: 0;
}

.sidebar-nav .submenu a {
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-light);
}

.sidebar-nav .submenu a:hover {
  background: var(--marshmallow-light);
  color: var(--text-color);
  padding-left: 2.75rem;
}

.sidebar-nav .submenu a.active {
  background: var(--marshmallow-toasted);
  color: var(--text-color);
  font-weight: 600;
}

.sidebar-nav .submenu a.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tree-accent);
}

.sidebar.collapsed .sidebar-nav .menu-toggle .toggle-arrow {
  display: none;
}

.sidebar.collapsed .sidebar-nav .submenu {
  display: none;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: absolute;
  right: -15px;
  top: 20px;
  width: 30px;
  height: 30px;
  background: var(--card-bg);
  border: 1px solid var(--marshmallow-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.sidebar-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
  background: var(--marshmallow-light);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  fill: var(--text-light);
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: var(--transition);
  min-height: 100vh;
  background-color: var(--bg-color);
}

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

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

/* Mobile Header (hidden on desktop) */
.mobile-header {
  display: none;
  background: var(--card-bg);
  padding: 1rem;
  box-shadow: var(--shadow);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  border-bottom: 1px solid var(--marshmallow-light);
}

.mobile-menu-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
}

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

/* Page Headers with subtle style */
.page-header {
  background: linear-gradient(135deg, var(--marshmallow-toasted) 0%, var(--tree-bark-light) 100%);
  color: var(--text-color);
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--marshmallow-light);
}

.page-header h1 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.page-header p {
  font-family: 'Open Sans', sans-serif;
  font-size: 1.1rem;
  opacity: 0.85;
  color: var(--text-light);
}

/* Cards with subtle variations */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 0.375rem; /* Reduced from 1.5rem to 6px */
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid var(--marshmallow-light);
}

/* Card title styling */
.card .card-title,
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6 {
  font-size: 1.5rem; /* Set card titles to 1.5rem */
  margin-bottom: 0.5rem;
}

/* Card text content width optimization */
.card .card-body {
  padding: 0.375rem; /* Match card padding */
}

.card .card-text,
.card p,
.card .text-content {
  font-size: 0.75rem; /* 12px equivalent */
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--marshmallow-toasted);
}

/* Buttons with subtle colors */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--tree-accent) 0%, var(--tree-bark-subtle) 100%);
  color: var(--white);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  filter: brightness(0.95);
}

.btn-secondary {
  background: var(--marshmallow-toasted);
  color: var(--text-color);
}

.btn-secondary:hover {
  background: var(--tree-bark-light);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--text-color);
  border: 2px solid var(--tree-bark-subtle);
}

.btn-outline:hover {
  background: var(--marshmallow-light);
  border-color: var(--tree-accent);
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .sidebar-toggle {
    display: none;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .sidebar.collapsed + .main-content {
    margin-left: 0;
  }
  
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .main-content .container {
    padding-top: 5rem; /* Account for fixed mobile header */
  }
  
  .sidebar.collapsed {
    width: var(--sidebar-width); /* Full width on mobile */
  }
  
  .sidebar.collapsed .nav-text {
    opacity: 1;
    width: auto;
  }
  
  .sidebar.collapsed .sidebar-nav a {
    padding: 0.75rem 1rem;
    justify-content: flex-start;
    gap: 0.75rem;
  }
  
  .sidebar.collapsed .sidebar-nav a:hover {
    padding-left: 1.25rem;
  }
}

/* Smooth transitions for dynamic content */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

/* Utility classes */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.pb-0 { padding-bottom: 0 !important; }

/* Top-right settings dropdown */
.top-actions {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 1101;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Open Sans', sans-serif;
}

.settings-dropdown {
  position: relative;
}

.settings-gear-btn {
  border: 1px solid var(--marshmallow-light);
  background: var(--card-bg, #fff);
  color: var(--text-color);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.95rem;
  gap: 0.35rem;
  white-space: nowrap;
}

.settings-gear-btn:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  background: var(--marshmallow-light);
}

.settings-gear-menu {
  position: absolute;
  top: 44px;
  right: 0;
  background: var(--card-bg, #fff);
  border: 1px solid var(--marshmallow-light);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  min-width: 200px;
  padding: 0.4rem 0;
  display: none;
  flex-direction: column;
}

.settings-dropdown:hover .settings-gear-menu,
.settings-dropdown:focus-within .settings-gear-menu {
  display: flex;
}

.settings-gear-menu a {
  padding: 0.75rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.settings-gear-menu a:hover {
  background: var(--marshmallow-light);
}

@media (max-width: 768px) {
  .top-actions {
    top: 10px;
    right: 12px;
  }
}