/* ─── Settings Redesign ──────────────────────────────── */

.settings-modal-container {
  display: flex;
  flex-direction: column;
  width: 650px !important;
  height: 650px !important;
  max-width: 90vw !important;
  max-height: 85vh !important;
  background: var(--bg-modal);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  border: 1px solid var(--border-light);
  animation: modalSpring 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 768px) {
  .settings-modal-container {
    width: 100% !important;
    height: 100% !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0;
  }
}

.settings-sidebar {
  width: 100%;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.settings-sidebar-header {
  padding: 20px 24px 8px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-header-actions {
  display: flex;
  gap: 8px;
}

.settings-header-actions .icon-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  width: 38px;
  height: 38px;
}

.settings-header-actions .icon-btn:hover {
  background: var(--bg-active);
  color: var(--primary);
  transform: translateY(-2px);
}

.settings-header-actions .save-btn {
  color: #2ecc71;
}

.settings-header-actions .save-btn:hover {
  background: rgba(46, 204, 113, 0.1);
  color: #27ae60;
  border-color: rgba(46, 204, 113, 0.2);
}

.settings-tabs-scroll {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 16px 16px;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.settings-tabs-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.settings-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 10px 20px;
  border: none;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.settings-tab-btn:hover {
  background: var(--bg-active);
  color: var(--text-primary);
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.settings-tab-btn:active {
  transform: translateY(0) scale(0.96);
}

.settings-tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px var(--primary-glow);
  transform: translateY(-2px);
}

.settings-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-modal);
  position: relative;
}

.settings-header {
  display: none !important; /* Title moved to sidebar-header, close btn moved */
}

/* Custom scrollbar for content */
.settings-content::-webkit-scrollbar {
  width: 6px;
}
.settings-content::-webkit-scrollbar-track {
  background: transparent;
}
.settings-content::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 10px;
}

.settings-tab-content {
  animation: tabFadeIn 0.4s ease;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(10px); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Close button repositioning - REMOVED ABSOLUTE TO FIX OVERLAP */
.settings-modal-container .modal-close {
  z-index: 20;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  transition: all 0.3s ease;
}

.settings-modal-container .modal-close:hover {
  background: var(--text-danger);
  color: #fff;
  transform: rotate(90deg) scale(1.1);
  border-color: transparent;
}

.settings-section {
  padding: 24px;
  background: transparent !important;
}

.section-title {
  margin-bottom: 16px;
  font-size: 1.1rem;
  color: var(--primary);
}

/* Plugin Cards */
.plugin-card {
  background: var(--bg-hover);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.plugin-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.plugin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.plugin-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.plugin-author {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.plugin-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.plugin-actions {
  display: flex;
  gap: 8px;
}

.delete-plugin-btn {
  color: var(--text-danger);
  background: rgba(214, 48, 49, 0.1);
  width: 32px;
  height: 32px;
}

.delete-plugin-btn:hover {
  background: var(--text-danger);
  color: #fff;
}

.loading-spinner {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
}

@media (max-width: 480px) {
  .settings-modal-container {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  
  .settings-sidebar-header {
    padding: 16px 20px 4px;
    font-size: 1.3rem;
  }
  
  .settings-tabs-scroll {
    padding: 8px 12px 12px;
  }
  
  .settings-tab-btn {
    padding: 8px 16px;
    font-size: 0.88rem;
  }
}

/* ─── Sidebar Drawer (Premium Redesign) ──────────────── */
.drawer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(2px);
}

.drawer-overlay.show {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .sidebar-menu {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    background: #17212b;
    z-index: 2000;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 10px 0 25px rgba(0,0,0,0.3);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    visibility: visible !important;
    animation: none !important;
    will-change: transform;
  }

  .sidebar-menu.drawer-open {
    transform: translateX(0) !important;
  }

  .drawer-overlay {
    backdrop-filter: blur(0px);
    transition: opacity 0.35s ease, visibility 0.35s ease, backdrop-filter 0.35s ease;
  }

  .drawer-overlay.show {
    backdrop-filter: blur(2px);
  }

  .sidebar-menu-profile {
    padding: 40px 24px 24px;
    background: linear-gradient(180deg, rgba(51, 144, 236, 0.15) 0%, rgba(23, 33, 43, 0) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .sidebar-menu #sidebar-avatar-mini {
    width: 80px;
    height: 80px;
    font-size: 2rem;
    margin-bottom: 16px;
    border: 3px solid #3390ec;
    box-shadow: 0 0 20px rgba(51, 144, 236, 0.3);
    position: relative;
  }

  .sidebar-menu .sidebar-profile-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .sidebar-menu .profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
  }

  .sidebar-menu .profile-status {
    font-size: 0.85rem;
    color: #4caf50;
    font-weight: 600;
  }

  .sidebar-menu .menu-item {
    padding: 12px 20px;
    margin: 4px 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #aeb7c2;
    display: flex;
    align-items: center;
    gap: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .sidebar-menu .menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
  }

  .sidebar-menu .menu-item:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.08);
  }

  .sidebar-menu .menu-item svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
  }

  .sidebar-menu .menu-item:hover svg {
    opacity: 1;
  }

  .sidebar-menu .menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 8px 20px;
  }

  .sidebar-menu .menu-item-danger {
    color: #ff5252;
    margin-top: auto;
    margin-bottom: 16px;
  }

  .sidebar-menu .menu-item-danger svg {
    color: #ff5252;
  }
}
