/* ============================================
   KUSANAGI SIDEBAR - RESPONSIVE DESIGN
   Mobile-first approach with collapsible sidebar
   ============================================ */

/* CSS Variables */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 60px;
  --header-height: 70px;
  --mobile-header-height: 60px;
  --sidebar-bg: rgba(10, 15, 30, 0.95);
  --sidebar-border: rgba(0, 255, 249, 0.2);
  --sidebar-hover: rgba(0, 255, 249, 0.1);
  --sidebar-active: rgba(0, 255, 249, 0.2);
  --transition-speed: 0.3s;
}

/* ============================================
   LAYOUT STRUCTURE
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--sidebar-border);
  z-index: 1000;
  transition: transform var(--transition-speed) ease, 
              width var(--transition-speed) ease;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

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

.sidebar.hidden {
  transform: translateX(-100%);
}

/* Sidebar Header */
.sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.sidebar-logo img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--neon-cyan);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-speed);
}

.sidebar.collapsed .sidebar-logo-text {
  opacity: 0;
  width: 0;
}

/* Header Toggle Button (Hamburger) - Always stays as sandwich */
.header-toggle {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--neon-cyan);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-right: 1rem;
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.header-toggle:hover {
  background: rgba(0, 255, 249, 0.2);
  box-shadow: 0 0 10px var(--neon-cyan);
}

.header-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--neon-cyan);
  border-radius: 1px;
  /* No transform animation - always stays as sandwich */
  transition: none;
}

/* ============================================
   NAVIGATION MENU
   ============================================ */

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 0.75rem;
}

.nav-section-title {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  padding: 0.25rem 1rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-speed);
}

.sidebar.collapsed .nav-section-title {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

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

.nav-item {
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--neon-cyan);
  border-left-color: var(--neon-cyan);
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--neon-cyan);
  border-left-color: var(--neon-cyan);
}

.nav-link i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-link-text {
  opacity: 1;
  transition: opacity var(--transition-speed);
}

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

/* Badges */
.nav-badge {
  margin-left: auto;
  background: var(--neon-pink);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  opacity: 1;
  transition: opacity var(--transition-speed);
}

.sidebar.collapsed .nav-badge {
  opacity: 0;
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 0.6rem;
  padding: 1px 4px;
  min-width: 16px;
}

/* Status Indicator in Sidebar */
.sidebar-status {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.75rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.6);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ff00;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition-speed);
  display: flex;
  flex-direction: column;
}

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

.sidebar.hidden ~ .main-content {
  margin-left: 0;
}

/* Content Header */
.content-header {
  height: var(--header-height);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.25rem;
  color: var(--neon-cyan);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Content Body */
.content-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }
  
  /* Sidebar devient un drawer sur mobile */
  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar.collapsed {
    width: 280px; /* Pas de collapsed sur mobile */
  }
  
  .sidebar.collapsed .sidebar-logo-text,
  .sidebar.collapsed .nav-link-text,
  .sidebar.collapsed .nav-section-title {
    opacity: 1;
    width: auto;
  }
  
  /* Overlay quand sidebar ouverte */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
  }
  
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
  
  /* Main content prend toute la largeur */
  .main-content {
    margin-left: 0 !important;
  }
  
  .content-header {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }
  
  .header-title {
    font-size: 1rem;
    max-width: 120px;
  }
  
  .header-toggle {
    width: 36px;
    height: 36px;
  }
  
  .content-body {
    padding: 1rem;
  }
  
  /* Grille responsive pour les cards */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Tables scrollables horizontalement */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  /* System status bar - hide some items on mobile */
  .system-status-bar {
    flex-wrap: wrap;
    gap: 0.5rem !important;
    font-size: 0.65rem !important;
    justify-content: center !important;
  }
  
  .system-item:nth-child(4),
  .system-item:nth-child(5) {
    display: none;
  }
  
  /* Quick links bar - better wrapping on mobile */
  .quick-links-bar {
    justify-content: center;
    padding: 0.5rem !important;
  }
  
  .quick-links-bar span:first-child {
    display: none;
  }
}

/* ============================================
   TABLET RESPONSIVE
   ============================================ */

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-collapsed-width);
  }
  
  .sidebar:hover {
    width: var(--sidebar-width);
  }
  
  .sidebar .sidebar-logo-text,
  .sidebar .nav-link-text,
  .sidebar .nav-section-title {
    opacity: 0;
  }
  
  .sidebar:hover .sidebar-logo-text,
  .sidebar:hover .nav-link-text,
  .sidebar:hover .nav-section-title {
    opacity: 1;
  }
  
  .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }
  
  .header-toggle {
    display: flex;
  }
}

/* ============================================
   DARK/LIGHT THEME SUPPORT
   ============================================ */

[data-theme="light"] {
  --sidebar-bg: rgba(255, 255, 255, 0.95);
  --sidebar-border: rgba(0, 150, 150, 0.2);
  --sidebar-hover: rgba(0, 200, 200, 0.1);
  --sidebar-active: rgba(0, 200, 200, 0.2);
}

[data-theme="light"] .nav-link {
  color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link.active {
  color: var(--neon-cyan);
}

/* ============================================
   ANIMATIONS
   ============================================ */

.nav-link {
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--neon-cyan);
  transform: scaleY(0);
  transition: transform 0.2s;
}

.nav-link:hover::before,
.nav-link.active::before {
  transform: scaleY(1);
}

/* Loading state */
.nav-link.loading {
  opacity: 0.6;
  pointer-events: none;
}

.nav-link.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Scrollbar styling pour la sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

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

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 249, 0.3);
  border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 249, 0.5);
}

/* ============================================
   UTILITIES
   ============================================ */

.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


