/* CRM-Style Vertical Sidebar Navigation - Modern & Elegant */

:root {
  --sidebar-width: 280px;
  --sidebar-bg: #f8fafb;
  --sidebar-text: #2d3748;
  --sidebar-text-light: #718096;
  --sidebar-border: #e2e8f0;
  --sidebar-hover-bg: #edf2f7;
  --sidebar-active-color: #10b981;
  --sidebar-active-bg: #d1fae5;
  --sidebar-section-header-color: #1a202c;
  --topbar-height: 70px;
  --transition-speed: 0.25s;
}

/* Main layout structure - Sticky Footer */
html {
  height: 100%;
}

body.with-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #ffffff;
  margin: 0;
  padding: 0;
}

body.with-sidebar > .topbar-modern {
  flex-shrink: 0;
  z-index: 980;
}

body.with-sidebar > .app-wrapper {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
}

body.with-sidebar > .site-footer {
  flex-shrink: 0;
  z-index: 10;
}

/* Top navbar - elevated and elegant */
.topbar-modern {
  height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  position: sticky;
  top: 0;
  z-index: 990;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: box-shadow var(--transition-speed) ease;
}

.topbar-modern:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.topbar-brand {
  font-size: 1.625rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: -0.5px;
}

.topbar-brand .brand-carla {
  color: var(--sidebar-section-header-color);
  font-weight: 800;
}

.topbar-brand .brand-ai {
  color: var(--sidebar-active-color);
  font-weight: 800;
}

.topbar-brand a {
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: opacity var(--transition-speed) ease;
}

.topbar-brand a:hover {
  opacity: 0.8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.topbar-user {
  font-size: 0.8125rem;
  color: var(--sidebar-text-light);
  cursor: pointer;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  transition: all var(--transition-speed) ease;
  font-weight: 500;
  background: transparent;
  border: none;
}

.topbar-user:hover {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-color);
  font-weight: 600;
}

/* Container wrapper for sidebar + content */
.app-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - var(--topbar-height));
  padding: 2rem 0;
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.04);
  transition: all var(--transition-speed) ease;
}

.app-sidebar::-webkit-scrollbar {
  width: 6px;
}

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

body.with-sidebar .app-content::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
  transition: background var(--transition-speed) ease;
}

body.with-sidebar .app-content::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Sidebar sections */
.sidebar-section {
  margin-bottom: 2rem;
  padding: 0;
}

.sidebar-section:first-child {
  padding-top: 0;
}

.sidebar-section:last-child {
  margin-bottom: 1rem;
}

.sidebar-section-header {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sidebar-section-header-color);
  padding: 0.75rem 1.75rem 1rem;
  margin-bottom: 0.5rem;
  opacity: 0.65;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity var(--transition-speed) ease;
}

.sidebar-section-header i {
  font-size: 0.875rem;
  opacity: 0.6;
}

.sidebar-section:hover .sidebar-section-header {
  opacity: 0.85;
}

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

.sidebar-nav-item {
  margin: 0;
  padding: 0;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.75rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition-speed) ease;
  border-left: 3px solid transparent;
  margin: 0;
  position: relative;
}

.sidebar-nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background var(--transition-speed) ease;
  pointer-events: none;
}

.sidebar-nav-link:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-active-color);
  border-left-color: var(--sidebar-active-color);
  padding-left: calc(1.75rem + 2px);
}

.sidebar-nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-color);
  border-left-color: var(--sidebar-active-color);
  font-weight: 700;
  padding-left: calc(1.75rem + 2px);
}

.sidebar-nav-link i {
  font-size: 1.0625rem;
  min-width: 22px;
  text-align: center;
  opacity: 0.8;
  transition: opacity var(--transition-speed) ease;
}

.sidebar-nav-link:hover i,
.sidebar-nav-link.active i {
  opacity: 1;
}

/* Main content area */
body.with-sidebar .app-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - var(--topbar-height));
  background: #ffffff;
}

/* Main content area without sidebar */
body:not(.with-sidebar) .app-content {
  flex: 1;
  margin-left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
}

body.with-sidebar .app-content::-webkit-scrollbar {
  width: 8px;
}

.app-content::-webkit-scrollbar-track {
  background: transparent;
}

.app-content::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

.app-content::-webkit-scrollbar-thumb:hover {
  background: #cbd5e0;
}

.app-content-container {
  padding: 2.5rem 3rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Responsive design */
@media (max-width: 1024px) {
  .app-content-container {
    padding: 2rem 2.5rem;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0;
    --topbar-height: 65px;
  }

  .site-footer {
    margin-left: 0;
  }

  .topbar-modern {
    padding: 0 1.5rem;
  }

  .topbar-brand {
    font-size: 1.375rem;
  }

  .topbar-user {
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
  }

  .app-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-speed) ease;
    z-index: 1000;
    width: 260px;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.12);
  }

  .app-sidebar.show {
    transform: translateX(0);
  }

  .app-content {
    margin-left: 0;
    width: 100%;
  }

  .sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--sidebar-hover-bg);
    border: none;
    border-radius: 8px;
    font-size: 1.25rem;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-speed) ease;
  }

  .sidebar-toggle-btn:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-color);
    transform: scale(1.05);
  }

  .app-content-container {
    padding: 1.5rem;
  }
}

@media (max-width: 576px) {
  :root {
    --topbar-height: 60px;
  }

  .topbar-modern {
    padding: 0 1rem;
    height: var(--topbar-height);
  }

  .site-footer {
    margin-left: 0;
    padding: 2rem 1rem;
  }

  .topbar-brand {
    font-size: 1.25rem;
  }

  .topbar-actions {
    gap: 1rem;
  }

  .topbar-user {
    display: none;
  }

  .app-sidebar {
    width: 100%;
    max-width: 100vw;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
  }

  .sidebar-nav-link {
    padding: 0.875rem 1.5rem;
  }

  .sidebar-section-header {
    padding: 0.75rem 1.5rem 1rem;
  }

  .app-content-container {
    padding: 1rem;
  }
}

/* Smooth transitions */
* {
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Footer Styles - At the end of page content */
.site-footer {
  background: #ffffff;
  border-top: 1px solid var(--sidebar-border);
  padding: 3rem 2.5rem;
  margin-left: var(--sidebar-width);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 10;
}

.site-footer .container {
  max-width: 1400px;
  margin: 0 auto;
}

.site-footer .footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.site-footer .footer-brand {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--sidebar-section-header-color);
  margin-bottom: 0.5rem;
}

.site-footer .footer-heading {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--sidebar-section-header-color);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.site-footer .footer-link {
  display: block;
  font-size: 0.9375rem;
  color: var(--sidebar-text-light);
  text-decoration: none;
  margin-bottom: 0.75rem;
  transition: all var(--transition-speed) ease;
}

.site-footer .footer-link:hover {
  color: var(--sidebar-active-color);
  padding-left: 0.25rem;
}

.site-footer .footer-bottom {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--sidebar-text-light);
}

/* Print styles */
@media print {
  .topbar-modern,
  .app-sidebar,
  .sidebar-toggle-btn,
  .site-footer {
    display: none;
  }

  .app-wrapper {
    display: flex;
    flex-direction: column;
  }

  .app-content {
    margin-left: 0;
    height: auto;
  }

  .app-content-container {
    padding: 0;
  }
}

/* Dark mode support disabled - site designed for light mode only
@media (prefers-color-scheme: dark) {
  :root {
    --sidebar-bg: #1a202c;
    --sidebar-text: #e2e8f0;
    --sidebar-text-light: #cbd5e0;
    --sidebar-border: #2d3748;
    --sidebar-hover-bg: #2d3748;
    --sidebar-active-bg: #2c5f4f;
    --sidebar-active-color: #68d391;
    --sidebar-section-header-color: #f7fafc;
  }

  body.with-sidebar {
    background: #0f1419;
  }

  .topbar-modern {
    background: #1a202c;
    border-bottom-color: var(--sidebar-border);
  }

  .app-content {
    background: #0f1419;
  }

  .app-sidebar {
    background: var(--sidebar-bg);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
  }

  .site-footer {
    background: #1a202c;
    border-top-color: var(--sidebar-border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
  }

  .site-footer .footer-bottom {
    border-top-color: var(--sidebar-border);
  }
}
*/

/* High contrast mode support */
@media (prefers-contrast: more) {
  :root {
    --sidebar-text: #000000;
    --sidebar-section-header-color: #000000;
    --sidebar-active-color: #008000;
  }

  .topbar-modern {
    border-bottom-width: 2px;
  }

  .app-sidebar {
    border-right-width: 2px;
  }

  .sidebar-nav-link.active {
    border-left-width: 4px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .topbar-modern,
  .topbar-user,
  .sidebar-nav-link,
  .sidebar-section-header,
  .app-sidebar,
  .sidebar-toggle-btn {
    transition: none !important;
  }
}
