/**
 * Layout CSS - Layouts base, Topbar y Sidebar
 * Define estructura de layout responsivo adaptativo
 * Requisitos: 9.1-9.8, 2.1-2.9
 */

/* ==================== MAIN CONTAINER ==================== */
.desktop-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background-color: var(--surface);
}

.desktop-wrapper.with-sidebar {
  gap: 0;
}

/* ==================== TOPBAR ==================== */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(10, 10, 12, 0.65);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  width: 100%;
}

.topbar-content {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--tx);
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--ease);
}

/* Different title styles for sections */
.topbar-title.discovery {
  color: var(--tx);
}

.topbar-title.my-characters {
  color: var(--tx);
}

.topbar-title.groups {
  color: var(--tx);
}

.topbar-title.my-chats {
  color: var(--tx);
}

.topbar-title.profile {
  color: var(--tx);
}

.topbar-spacer {
  flex: 1;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
}

.topbar-coins,
.topbar-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: all var(--ease);
  color: var(--tx);
  font-size: 0.9375rem;
  font-weight: 500;
}

.topbar-coins:hover,
.topbar-menu:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #b39bff;
  color: #b39bff;
  box-shadow: 0 0 12px rgba(179, 155, 255, 0.3);
}

/* ==================== SIDEBAR - WRAPPER ==================== */
.sidebar-container {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 280px;
  background: rgba(10, 10, 12, 0.65);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 9;
  display: flex;
  flex-direction: column;
}

.sidebar-container.collapsed {
  width: 80px;
  align-items: center;
}

/* ==================== SIDEBAR - HEADER/TOGGLE ==================== */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--sidebar-pad);
  border-bottom: 1px solid var(--border);
  height: auto;
  min-height: 60px;
}

.sidebar-container.collapsed .sidebar-header {
  justify-content: center;
  width: 100%;
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--theme);
  transition: opacity var(--ease);
  flex: 1;
}

.sidebar-container.collapsed .sidebar-logo {
  opacity: 0;
  display: none;
  width: 0;
  flex: none;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  color: var(--tx);
  transition: all var(--ease);
}

.sidebar-toggle:hover {
  background: var(--surface2);
  border-color: var(--theme);
  color: var(--theme);
}

/* ==================== SIDEBAR - NAVIGATION ==================== */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 16px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.95rem;
  font-weight: 500;
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #b39bff;
  box-shadow: 0 0 12px rgba(179, 155, 255, 0.2);
}

.sidebar-nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #b39bff;
  border-left: 2px solid #b39bff;
  padding-left: 10px;
  box-shadow: inset 0 0 12px rgba(179, 155, 255, 0.25);
}

.sidebar-nav-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  font-size: 1.125rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.sidebar-container.collapsed .sidebar-nav-item-label {
  opacity: 0;
  display: none;
  width: 0;
}

.sidebar-container.collapsed .sidebar-nav-item {
  justify-content: center;
  padding: 12px;
  border-left: none;
  padding-left: 12px;
}

/* ==================== SIDEBAR - FOOTER ==================== */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px var(--sidebar-pad);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.sidebar-container.collapsed .sidebar-footer {
  align-items: center;
}

.sidebar-user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--ease);
}

.sidebar-user-menu:hover {
  background: var(--surface2);
  border-color: var(--theme);
}

.sidebar-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--theme), var(--theme-pk));
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 700;
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
  transition: opacity var(--ease);
}

.sidebar-container.collapsed .sidebar-user-info {
  opacity: 0;
  display: none;
  width: 0;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-status {
  font-size: 0.75rem;
  color: var(--tx3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== MAIN CONTENT AREA ==================== */
.main-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: flex var(--ease-long);
}

.main-content-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* ==================== CONTENT WRAPPER ==================== */
.content-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.content-area {
  flex: 1;
  padding: 0 var(--pad-horizontal-md);
  padding-top: 16px;
  padding-bottom: 32px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ==================== SCROLLBAR FOR MAIN CONTENT ==================== */
.main-content-scroll::-webkit-scrollbar {
  width: 8px;
}

.main-content-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.main-content-scroll::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: var(--r-sm);
}

.main-content-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==================== RESPONSIVE: DESKTOP (1200px+) ==================== */
@media (min-width: 1200px) {
  .content-area {
    padding-left: var(--pad-horizontal-md);
    padding-right: var(--pad-horizontal-md);
  }
}

/* ==================== RESPONSIVE: FULLHD (1920px+) ==================== */
@media (min-width: 1920px) {
  .content-area {
    padding-left: var(--pad-horizontal-lg);
    padding-right: var(--pad-horizontal-lg);
  }
}
