/* ============================================
   SIMPLE SIDEBAR - Clean, working implementation
   ============================================ */

/* Dimensions */
:root {
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 64px;
  --sidebar-transition: 0.2s ease;
}

/* Theme colors - Light (default) */
:root {
  --sidebar-bg: #f9fafb;
  --sidebar-text: #111827;
  --sidebar-muted: #6b7280;
  --sidebar-border: #e5e7eb;
  --sidebar-hover: #f3f4f6;
  --sidebar-active: #e5e7eb;
}

/* Dark theme */
[data-theme="dark"] {
  --sidebar-bg: #0f0f0f;
  --sidebar-text: #f5f5f7;
  --sidebar-muted: #a1a1a6;
  --sidebar-border: #333;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: rgba(255,255,255,0.12);
}

/* Main sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width var(--sidebar-transition);
  overflow: hidden;
}

/* Inner wrapper */
.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* Header */
.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid transparent;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--sidebar-text);
}

.sidebar-logo-mark {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #34c759, #248a3d);
  border-radius: 6px;
  flex-shrink: 0;
}

.sidebar-logo-mark svg {
  width: 16px;
  height: 16px;
  color: white;
}

.sidebar-logo-label {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar-logo-sublabel {
  font-size: 11px;
  color: var(--sidebar-muted);
  white-space: nowrap;
}

/* Content */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  max-width: 100%;
}

.sidebar-content::-webkit-scrollbar {
  width: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--sidebar-border);
  border-radius: 2px;
}

/* Group */
.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

/* Menu */
.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-menu-item {
  display: flex;
}

.sidebar-menu-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-menu-button:hover {
  background: var(--sidebar-hover);
}

.sidebar-menu-button[data-state="active"] {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
}

.sidebar-menu-button-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-menu-button-label {
  flex: 1;
  white-space: nowrap;
  min-width: 0;
}

/* Group */
.sidebar-group {
  margin-bottom: 12px;
}

.sidebar-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-muted);
  white-space: nowrap;
}

.sidebar-group-label svg {
  width: 14px;
  height: 14px;
}

/* Menu */
.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-menu-item {
  display: flex;
}

.sidebar-menu-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-menu-button:hover {
  background: var(--sidebar-hover);
}

.sidebar-menu-button[data-state="active"] {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
}

.sidebar-menu-button[data-state="active"] .sidebar-menu-button-icon {
  opacity: 1;
  color: #34c759;
}

.sidebar-menu-button-label {
  flex: 1;
  white-space: nowrap;
}

/* Separator */
.sidebar-separator {
  height: 1px;
  background: var(--sidebar-border);
  margin: 8px 0;
}

/* Footer */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px;
  border-top: 1px solid transparent;
  flex-shrink: 0;
  overflow: hidden;
  justify-content: flex-start;
}

.sidebar-footer-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--sidebar-muted);
  transition: background 0.15s;
  flex-shrink: 0;
}

.sidebar-footer-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

#sidebarThemeBtn svg {
  width: 16px;
  height: 16px;
}

.sidebar-footer-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--sidebar-muted);
  transition: background 0.15s;
  flex-shrink: 0;
}

.sidebar-footer-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.sidebar-footer-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

#sidebarThemeBtn svg {
  width: 18px;
  height: 18px;
}

/* Collapse trigger */
.sidebar-collapse-trigger {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
}

/* ==================== COLLAPSED STATE ==================== */
.sidebar[data-state="collapsed"] {
  width: var(--sidebar-width-collapsed);
}

/* Hide text when collapsed */
.sidebar[data-state="collapsed"] .sidebar-logo-label,
.sidebar[data-state="collapsed"] .sidebar-logo-sublabel,
.sidebar[data-state="collapsed"] .sidebar-group-label,
.sidebar[data-state="collapsed"] .sidebar-menu-button-label,
.sidebar[data-state="collapsed"] .sidebar-separator {
  display: none;
}

/* Center icons when collapsed */
.sidebar[data-state="collapsed"] .sidebar-logo {
  justify-content: center;
}

.sidebar[data-state="collapsed"] .sidebar-menu-button {
  justify-content: center;
  padding: 0;
}

.sidebar[data-state="collapsed"] .sidebar-menu-button-icon {
  width: 18px;
  height: 18px;
}

.sidebar[data-state="collapsed"] .sidebar-footer {
  justify-content: center;
  gap: 4px;
  flex-direction: column;
  padding: 4px;
}

.sidebar[data-state="collapsed"] .sidebar-footer-item {
  width: 32px;
  height: 32px;
}

.sidebar[data-state="collapsed"] .sidebar-footer-item svg {
  width: 16px;
  height: 16px;
}

/* Hover to expand - NO icon size changes */
.sidebar[data-state="collapsed"]:hover {
  width: var(--sidebar-width);
}

.sidebar[data-state="collapsed"]:hover .sidebar-logo-label,
.sidebar[data-state="collapsed"]:hover .sidebar-logo-sublabel,
.sidebar[data-state="collapsed"]:hover .sidebar-group-label,
.sidebar[data-state="collapsed"]:hover .sidebar-menu-button-label {
  display: block !important;
}

.sidebar[data-state="collapsed"]:hover .sidebar-logo {
  justify-content: flex-start;
}

.sidebar[data-state="collapsed"]:hover .sidebar-menu-button {
  justify-content: flex-start;
  padding: 0 10px;
}

.sidebar[data-state="collapsed"]:hover .sidebar-menu-button-icon {
  width: 18px;
  height: 18px;
}

.sidebar[data-state="collapsed"]:hover .sidebar-footer {
  justify-content: flex-start;
  gap: 2px;
  flex-direction: row;
}

.sidebar[data-state="collapsed"]:hover .sidebar-footer-item {
  width: 32px;
  height: 32px;
}

.sidebar[data-state="collapsed"]:hover .sidebar-footer-item svg {
  width: 16px;
  height: 16px;
}

.sidebar[data-state="collapsed"]:hover .sidebar-footer-item {
  width: 36px;
  height: 36px;
}

.sidebar[data-state="collapsed"]:hover .sidebar-footer-item svg {
  width: 18px;
  height: 18px;
}

/* Body padding */
body {
  padding-left: var(--sidebar-width) !important;
  transition: padding-left var(--sidebar-transition);
}

body.sidebar-collapsed {
  padding-left: var(--sidebar-width-collapsed) !important;
}

/* Overlay for mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

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

/* Mobile trigger */
.sidebar-trigger {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--sidebar-text);
  z-index: 1001;
}

.sidebar-trigger svg {
  width: 18px;
  height: 18px;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  body {
    padding-left: 0 !important;
  }

  .sidebar-trigger {
    display: flex;
  }

  .sidebar-collapse-trigger {
    display: none;
  }
}

@media (min-width: 1025px) {
  .sidebar-overlay.active {
    display: none;
  }
}

/* Focus styles */
.sidebar-menu-button:focus-visible,
.sidebar-footer-item:focus-visible {
  outline: 2px solid #34c759;
  outline-offset: 2px;
}

/* ============================================
   GLOBAL DARK THEME (applies to entire page)
   When [data-theme="dark"] is set on html element
   ============================================ */
[data-theme="dark"] body {
  background: #0A0A0B !important;
  color: #F3F4F6;
}

[data-theme="dark"] .page-header h1,
[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3 {
  color: #F3F4F6;
}

[data-theme="dark"] .card,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .content-card,
[data-theme="dark"] .itinerary-card {
  background: #1F2937 !important;
  border-color: #374151 !important;
  color: #F3F4F6;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #374151 !important;
  border-color: #4B5563 !important;
  color: #F3F4F6 !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #9CA3AF !important;
}

[data-theme="dark"] .btn-primary {
  background: #3B82F6 !important;
  color: white !important;
}

[data-theme="dark"] .btn-secondary {
  background: #374151 !important;
  border-color: #4B5563 !important;
  color: #F3F4F6 !important;
}

[data-theme="dark"] a {
  color: #60A5FA;
}

[data-theme="dark"] table {
  color: #F3F4F6;
}

[data-theme="dark"] table th {
  background: #1F2937 !important;
  color: #D1D5DB !important;
  border-color: #374151 !important;
}

[data-theme="dark"] table td {
  border-color: #374151 !important;
  color: #E5E7EB;
}

[data-theme="dark"] .status-badge,
[data-theme="dark"] .badge {
  background: #374151;
  color: #F3F4F6;
}

[data-theme="dark"] .alert,
[data-theme="dark"] .info-box {
  background: #1F2937 !important;
  border-color: #374151 !important;
  color: #E5E7EB;
}

[data-theme="dark"] .alert-success {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #6EE7B7 !important;
}

[data-theme="dark"] .alert-warning {
  background: rgba(245, 158, 11, 0.2) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #FCD34D !important;
}

[data-theme="dark"] .alert-error {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #FCA5A5 !important;
}

[data-theme="dark"] .dropdown-menu {
  background: #1F2937 !important;
  border-color: #374151 !important;
}

[data-theme="dark"] .dropdown-item {
  color: #E5E7EB;
}

[data-theme="dark"] .dropdown-item:hover {
  background: #374151 !important;
}

/* Common element overrides */
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-muted {
  color: #9CA3AF !important;
}

[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-primary {
  color: #F3F4F6 !important;
}

[data-theme="dark"] .bg-white {
  background: #1F2937 !important;
}

[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-100 {
  background: #1F2937 !important;
}

[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300 {
  border-color: #374151 !important;
}

[data-theme="dark"] .shadow {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
}

/* ============================================
   BUTTON DARK MODE FIXES
   ============================================ */
[data-theme="dark"] .btn-primary {
  background: #6366f1 !important;
  color: white !important;
  border-color: #6366f1 !important;
}

[data-theme="dark"] .btn-primary:hover {
  background: #4f46e5 !important;
  border-color: #4f46e5 !important;
  color: white !important;
}

[data-theme="dark"] .btn-secondary,
[data-theme="dark"] button:not(.btn-primary) {
  background: #374151 !important;
  border-color: #4B5563 !important;
  color: #E5E7EB !important;
}

[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] button:not(.btn-primary):hover {
  background: #4B5563 !important;
  border-color: #6B7280 !important;
  color: #F3F4F6 !important;
}

/* Fix specific button text color */
[data-theme="dark"] .itinerary-card .btn-primary,
[data-theme="dark"] .card .btn-primary,
[data-theme="dark"] .settings-card .btn-primary {
  color: white !important;
}

[data-theme="dark"] a {
  color: #818cf8;
}

[data-theme="dark"] a:hover {
  color: #a5b4fc;
}
