:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --bg-dark: #07090f;
  --bg-panel: rgba(18, 24, 38, 0.7);
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-input: rgba(10, 14, 23, 0.8);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.5);

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
  --accent-pink: #ec4899;
  --success-green: #10b981;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-main: 0 20px 40px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(236, 72, 153, 0.12) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Utility Glassmorphism Class */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-main);
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.full-width {
  width: 100%;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

/* Inputs & Labels */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* AUTH WRAPPER */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
}

.auth-bg-shapes .shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background: var(--primary);
  top: 15%;
  left: 20%;
  opacity: 0.25;
}

.shape-2 {
  width: 350px;
  height: 350px;
  background: var(--accent-pink);
  bottom: 15%;
  right: 20%;
  opacity: 0.2;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 36px;
  border-radius: var(--radius-lg);
  z-index: 10;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.logo-icon {
  font-size: 2rem;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.auth-tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.auth-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.avatar-presets {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 0;
}

.avatar-preset-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.avatar-preset-img.selected {
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 0 12px var(--primary);
}

/* APP CONTAINER */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.mobile-navbar {
  display: none;
}

/* SIDEBAR */
.sidebar {
  width: 300px;
  min-width: 300px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-light);
  border-radius: 0;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon-sm {
  font-size: 1.3rem;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.online-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--success-green);
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success-green);
}

.sidebar-nav {
  display: flex;
  padding: 12px;
  gap: 6px;
  border-bottom: 1px solid var(--border-light);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-tab.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  font-weight: 600;
}

.tab-icon {
  font-size: 1.2rem;
}

.tab-label {
  font-size: 0.75rem;
}

.unread-badge {
  position: absolute;
  top: 2px;
  right: 6px;
  background: var(--accent-pink);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.sidebar-section {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 12px;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.list-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.list-item.active {
  background: rgba(99, 102, 241, 0.2);
  border-left: 3px solid var(--primary);
}

.item-icon {
  font-size: 1.2rem;
}

.item-info {
  flex: 1;
  overflow: hidden;
}

.item-title {
  font-weight: 500;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-light);
}

.user-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.avatar-wrapper {
  position: relative;
}

.avatar-wrapper img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
}

.status-indicator.online {
  background-color: var(--success-green);
}

.status-indicator.offline {
  background-color: var(--text-dim);
}

.user-display-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-handle {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* MAIN CONTENT VIEWPORT */
.main-content {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.view-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-header, .view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.channel-icon-header {
  font-size: 1.8rem;
}

.dm-avatar-header {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.channel-name-header {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.channel-desc-header {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* MESSAGES STREAM */
.messages-stream {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-card {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.message-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.message-author {
  font-weight: 600;
  font-size: 0.92rem;
}

.message-time {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
}

.message-card.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-card.own .message-bubble {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
}

.message-card.own .message-header {
  flex-direction: row-reverse;
}

/* TYPING INDICATOR */
.typing-indicator {
  padding: 6px 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* CHAT INPUT AREA */
.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

.message-form {
  display: flex;
  gap: 12px;
}

.message-form input {
  flex: 1;
}

.btn-send {
  padding: 10px 24px;
}

/* COMMUNITY FEED / MURAL */
.feed-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.create-post-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.create-post-header {
  display: flex;
  gap: 12px;
}

.user-avatar-sm {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.create-post-header textarea {
  resize: none;
}

.create-post-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.input-url {
  flex: 1;
}

.posts-stream {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.post-author-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-author-name {
  font-weight: 600;
  font-size: 0.98rem;
}

.post-time {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.post-body {
  font-size: 0.98rem;
  line-height: 1.6;
}

.post-image {
  max-height: 380px;
  width: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.post-footer-actions {
  display: flex;
  gap: 20px;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

.action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: color 0.2s;
}

.action-btn:hover, .action-btn.active {
  color: var(--accent-pink);
}

.comments-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 14px;
  border-radius: var(--radius-md);
}

.comment-item {
  display: flex;
  gap: 10px;
  font-size: 0.88rem;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.comment-author {
  font-weight: 600;
  margin-right: 6px;
}

.add-comment-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* MEMBERS DIRECTORY */
.members-grid {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.member-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: transform 0.2s;
}

.member-card:hover {
  transform: translateY(-4px);
}

.member-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
}

.member-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.member-handle {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.member-bio {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
  height: 2.8em;
  overflow: hidden;
}

/* SEARCH BOX */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

.search-box input {
  background: transparent;
  border: none;
  padding: 4px;
}

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  padding: 28px;
  border-radius: var(--radius-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .mobile-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-light);
  }

  .mobile-toggle-btn {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
  }

  .mobile-toggle-btn span {
    width: 20px;
    height: 2px;
    background: var(--text-main);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

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

/* CS2 BANNER & WIDGET STYLES */
.cs2-connect-box {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  text-align: center;
}

.cs2-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--success-green);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.cs2-ip-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.cs2-ip-display code {
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fbbf24;
}

.btn-copy-sm {
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-copy-sm:hover {
  transform: scale(1.05);
}

.cs2-cmd-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sidebar-cs2-widget {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.badge-online {
  background: var(--success-green);
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.widget-ip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ip-text {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fbbf24;
}

.btn-copy-widget {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-copy-widget:hover {
  background: var(--primary);
}

.topbar-cs2-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  font-size: 0.82rem;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 0.8rem;
}

.auth-switch-link {
  text-align: center;
  margin-top: 14px;
  font-size: 0.85rem;
}

.auth-switch-link a {
  color: var(--primary);
  text-decoration: none;
}

.auth-switch-link a:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary-gradient);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 200;
  font-size: 0.9rem;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
