/* ==========================================================================
   UltraPlataformas Modern Shell - Layout, Navbar & Sidebar Styling
   ========================================================================== */

:root {
  --primary: #007AFF;
  --primary-hover: #0062cc;
  --text-main: #1D1D1F;
  --text-sec: #86868B;
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: 1px solid rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --sidebar-width: 280px;
}

html {
  scrollbar-gutter: stable;
}

body {
  padding-top: 0 !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f5f5f7;
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,90%,1) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,90%,1) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,90%,1) 0, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
}

body.modal-open {
  padding-right: 0 !important;
}

/* ==========================================================================
   Modern Navbar (Header Superior)
   ========================================================================== */

.modern-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.modern-navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modern-navbar-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-width: 0;
}

.modern-navbar-logo {
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #1D1D1F;
  letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.modern-navbar-logo:hover {
  color: #1D1D1F;
}

.modern-navbar-logo img {
  height: 28px;
  width: auto;
}

.modern-navbar-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modern-navbar-link {
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.04);
  color: #1D1D1F;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modern-navbar-link:hover {
  background: rgba(0,0,0,0.08);
  color: #1D1D1F;
  transform: translateY(-1px);
}

.modern-navbar-link.active {
  background: #1D1D1F;
  color: #ffffff !important;
}

.modern-navbar-link.active:hover {
  background: #1D1D1F;
  color: #ffffff !important;
}

.modern-navbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.modern-navbar-credits {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  background: rgba(0,0,0,0.04);
  border-radius: 999px;
  cursor: default;
}

.modern-navbar-credits i {
  color: #f59e0b;
}

.modern-navbar-credits span {
  font-weight: 700;
  font-size: 0.92rem;
  color: #1D1D1F;
}

.modern-navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.9rem;
  background: rgba(0,0,0,0.04);
  border-radius: 999px;
}

.modern-navbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #007AFF;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.modern-navbar-username {
  color: #1D1D1F;
  font-size: 0.9rem;
  font-weight: 600;
}

.modern-navbar-logout {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  color: #1D1D1F;
  text-decoration: none;
  background: rgba(0,0,0,0.04);
}

.modern-navbar-logout:hover {
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}

.modern-navbar-mobile-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.05);
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: #1D1D1F;
  font-size: 1.15rem;
}

@media (max-width: 1024px) {
  .modern-navbar-menu {
    display: none;
  }
  .modern-navbar-mobile-toggle {
    display: flex;
  }
  .modern-navbar-username {
    display: none;
  }
}

/* ==========================================================================
   Modern Sidebar (Menú Lateral Izquierdo)
   ========================================================================== */

.modern-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(0,0,0,0.06);
  padding: 5.25rem 1.25rem 2rem 1.25rem;
  overflow-y: auto;
  z-index: 90;
  transition: transform 0.3s ease;
}

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

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

.modern-sidebar::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.18);
  border-radius: 3px;
}

.modern-sidebar-section {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

/* Sección expandida */
.modern-sidebar-section.expanded {
  background: rgba(0, 122, 255, 0.035);
  border-radius: 12px;
  padding: 0.5rem;
  margin-bottom: 0.9rem;
  border-bottom: none;
  border-left: 3px solid rgba(0, 122, 255, 0.4);
}

.modern-sidebar-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.modern-sidebar-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #86868B;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}

.modern-sidebar-section.expanded .modern-sidebar-title {
  color: #007AFF;
  font-weight: 800;
}

.modern-sidebar-title:hover {
  color: #1D1D1F;
}

.modern-sidebar-section.expanded .modern-sidebar-title:hover {
  color: #0051D5;
}

.modern-sidebar-title i.chevron {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.modern-sidebar-title.collapsed i.chevron {
  transform: rotate(-90deg);
}

.modern-sidebar-title img {
  width: 20px !important;
  height: 20px !important;
  vertical-align: middle;
  margin-right: 6px;
}

.modern-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.modern-sidebar-links.collapsed {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
}

.modern-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  color: #1D1D1F;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s;
}

.modern-sidebar-link:hover {
  background: rgba(0,0,0,0.05);
  color: #1D1D1F;
  transform: translateX(3px);
}

.modern-sidebar-link.active {
  background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
  color: white !important;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.28);
}

.modern-sidebar-link.active:hover {
  background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
  color: white !important;
}

.modern-sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.modern-sidebar-badge {
  margin-left: auto;
  padding: 0.2rem 0.5rem;
  background: rgba(0, 122, 255, 0.1);
  color: #007AFF;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.modern-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 89;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ==========================================================================
   Contenido Principal ajustado al Sidebar
   ========================================================================== */

.modern-content-with-sidebar {
  margin-left: var(--sidebar-width);
  min-height: calc(100vh - 70px);
  transition: margin-left 0.3s ease;
}

@media (max-width: 1024px) {
  .modern-sidebar {
    transform: translateX(-100%);
    box-shadow: 2px 0 16px rgba(0,0,0,0.12);
    z-index: 110;
  }
  
  .modern-sidebar.active {
    transform: translateX(0);
  }
  
  .modern-sidebar-overlay.active {
    display: block;
    z-index: 105;
  }
  
  .modern-content-with-sidebar {
    margin-left: 0;
  }
}

/* ==========================================================================
   Dark Theme Overrides para Shell
   ========================================================================== */

body.dark-theme .modern-navbar {
  background: rgba(22, 27, 34, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .modern-navbar-logo,
body.dark-theme .modern-navbar-link,
body.dark-theme .modern-navbar-username,
body.dark-theme .modern-navbar-credits span {
  color: #e6edf3;
}

body.dark-theme .modern-navbar-link {
  background: rgba(255, 255, 255, 0.05);
}

body.dark-theme .modern-navbar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

body.dark-theme .modern-navbar-link.active {
  background: #007AFF;
  color: #fff !important;
}

body.dark-theme .modern-navbar-credits,
body.dark-theme .modern-navbar-user,
body.dark-theme .modern-navbar-logout,
body.dark-theme .modern-navbar-mobile-toggle {
  background: rgba(255, 255, 255, 0.06);
  color: #e6edf3;
}

body.dark-theme .modern-sidebar {
  background: rgba(18, 22, 28, 0.95);
  border-right-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .modern-sidebar-section {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .modern-sidebar-section.expanded {
  background: rgba(0, 122, 255, 0.1);
  border-left-color: #007AFF;
}

body.dark-theme .modern-sidebar-title {
  color: #8b949e;
}

body.dark-theme .modern-sidebar-title:hover {
  color: #e6edf3;
}

body.dark-theme .modern-sidebar-link {
  color: #c9d1d9;
}

body.dark-theme .modern-sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

body.dark-theme .modern-sidebar-link.active {
  background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
  color: #fff !important;
}
