
/* Navigation Bar */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: clamp(56px, 8vw, 64px);
  min-height: 56px;
  padding: 0 var(--space-sm);
  position: relative;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  background: rgba(10, 102, 195, 0.1);
  border: 1px solid rgba(10, 102, 195, 0.2);
  border-radius: var(--radius-md);
  color: #0A66C3;
  font-size: var(--text-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: var(--z-fixed);
}

.menu-toggle:hover {
  background: rgba(10, 102, 195, 0.15);
  transform: scale(1.05);
}

.menu-toggle:active {
  transform: scale(0.95);
}

/* App Title */
.nav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: clamp(0.9rem, 2.5vw, 1.25rem);
  font-weight: 600;
  color: #1a1a1a;
  text-align: center;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* User Section */
.nav-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.nav-user-name {
  color: #0A66C3;
  font-weight: 600;
  font-size: var(--text-sm);
}

.nav-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(10, 102, 195, 0.1);
  transition: all 0.2s ease;
}

.nav-user-avatar:hover {
  border-color: rgba(10, 102, 195, 0.3);
  transform: scale(1.05);
}

.nav-logout {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: var(--button-height-sm);
}

.nav-logout:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: clamp(280px, 25vw, 320px);
  height: 100vh;
  background: linear-gradient(180deg, #fafbfd 0%, #f4f6f9 100%);
  border-right: 1px solid rgba(10, 102, 195, 0.08);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: var(--z-modal);
  overflow-y: auto;
  padding-top: env(safe-area-inset-top);
  box-shadow: var(--shadow-lg);
}

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

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: var(--z-modal-backdrop);
}

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

/* Sidebar Content */
.sidebar-content {
  padding: var(--space-lg);
}

.sidebar-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid rgba(10, 102, 195, 0.1);
}

.sidebar-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 var(--space-sm) 0;
}

.sidebar-subtitle {
  font-size: var(--text-sm);
  color: #6b7280;
  margin: 0;
}

/* Sidebar Navigation */
.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav-item {
  margin-bottom: var(--space-xs);
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  color: #374151;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  font-weight: 500;
  min-height: var(--touch-target);
}

.sidebar-nav-link:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.sidebar-nav-link.active {
  background: #3b82f6;
  color: white;
}

.sidebar-nav-icon {
  width: 20px;
  height: 20px;
  margin-right: var(--space-sm);
  flex-shrink: 0;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-nav-item {
  flex: 1;
  min-width: 120px;
}

.tab-nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-lg);
  color: #64748b;
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  font-size: var(--text-sm);
  white-space: nowrap;
  min-height: var(--touch-target);
}

.tab-nav-link:hover {
  color: #1e293b;
  background: rgba(59, 130, 246, 0.05);
}

.tab-nav-link.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  background: white;
}

.tab-nav-link.disabled {
  color: #cbd5e1;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Tab Content */
.tab-content {
  background: white;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  min-height: 400px;
}

.tab-panel {
  display: none;
  padding: var(--space-lg);
}

.tab-panel.active {
  display: block;
}


/* Tablet Navigation */
@media (min-width: 481px) and (max-width: 768px) {
  .nav-bar {
    height: 64px;
    padding: 0 24px;
  }
  
  .nav-title {
    font-size: 1.1rem;
    max-width: 55%;
  }
  
  .nav-user-name {
    display: inline;
  }
  
  .nav-user-avatar {
    width: 36px;
    height: 36px;
  }
  
  .sidebar {
    width: min(70vw, 320px);
  }
  
  .tab-nav-link {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-sm);
    min-width: 140px;
  }
}

/* Desktop Navigation */
@media (min-width: 769px) {
  .nav-bar {
    height: 64px;
    padding: 0 32px;
  }
  
  .nav-title {
    font-size: 1.25rem;
    max-width: 60%;
  }
  
  .nav-user-name {
    display: inline;
  }
  
  .nav-user-avatar {
    width: 40px;
    height: 40px;
  }
  
  .sidebar {
    width: 320px;
  }
  
  .tab-nav-link {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-base);
    min-width: 160px;
  }
}


.content-with-sidebar {
  margin-left: 0;
  transition: margin-left 0.3s ease;
}

.content-with-sidebar.open {
  margin-left: clamp(280px, 25vw, 320px);
}

/* Mobile content adjustments */
@media (max-width: 480px) {
  .content-with-nav {
    margin-top: 60px;
    min-height: calc(100vh - 60px);
  }
  
  .content-with-sidebar.open {
    margin-left: 0;
    overflow: hidden;
  }
}

/* Tablet content adjustments */
@media (min-width: 481px) and (max-width: 768px) {
  .content-with-nav {
    margin-top: 64px;
    min-height: calc(100vh - 64px);
  }
  
  .content-with-sidebar.open {
    margin-left: min(70vw, 320px);
  }
}


/* High contrast mode */
@media (prefers-contrast: high) {
  .nav-container {
    background: white;
    border-bottom: 2px solid #000;
  }
  
  .nav-title {
    color: #000;
  }
  
  .nav-logout {
    background: #000;
    color: #fff;
    border: 2px solid #000;
  }
  
  .sidebar {
    background: white;
    border-right: 2px solid #000;
  }
  
  .sidebar-nav-link.active {
    background: #000;
    color: #fff;
  }
  
  .tab-nav-link.active {
    background: #000;
    color: #fff;
    border-bottom-color: #000;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-overlay,
  .menu-toggle,
  .nav-logout,
  .sidebar-nav-link,
  .tab-nav-link {
    transition: none;
  }
}


/* Tablet and desktop - show full title */
@media (min-width: 481px) {
  .app-title::after {
    display: none;
  }
  
  .app-title {
    font-size: inherit !important;
    line-height: inherit !important;
  }
}


/* Mobile title override */
@media (max-width: 480px) {
  .app-title {
    font-size: var(--text-lg);
    max-width: 200px;
  }
  
  /* Force show "AI Tools" on mobile if title is too long */
  .app-title:not([data-mobile-title]) {
    position: relative;
  }
  
  .app-title:not([data-mobile-title])::after {
    content: "AI Tools";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Tablet and desktop */
@media (min-width: 481px) {
  .app-title {
    font-size: var(--text-xl);
    max-width: none;
  }
  
  .app-title::after {
    display: none;
  }
}


/* Mobile title - show shorter version */
@media (max-width: 480px) {
  .app-title {
    font-size: var(--text-lg);
    max-width: 150px;
    margin: 0 auto;
  }
}

/* Tablet and desktop - show full title */
@media (min-width: 481px) {
  .app-title {
    font-size: var(--text-xl);
    max-width: none;
  }
}
