@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Rajdhani:wght@400;500;600;700&family=Share+Tech+Mono&display=swap');

/* ================= DESIGN SYSTEMS & THEMES ================= */
:root {
  /* Default: Neo-Kitsch (Gold/Yellow) */
  --bg-color: #0a0907;
  --panel-bg: rgba(22, 20, 16, 0.9);
  --border-color: rgba(252, 238, 10, 0.35);
  --border-focus: #f59e0b;
  --accent-color: #fcee0a;
  --accent-secondary: #ff9d00;
  --text-color: #fffbeb;
  --text-muted: #78350f;
  --glow-shadow: 0 0 10px rgba(252, 238, 10, 0.35);
  --glow-secondary: 0 0 10px rgba(245, 158, 11, 0.3);
  --clip-cut: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  --clip-cut-small: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  --font-family: 'Rajdhani', sans-serif;
  --grid-opacity: 0.05;
  --hud-display: block;
  --backdrop-blur: none;
}

[data-theme="neo-kitsch"] {
  --bg-color: #0a0907;
  --panel-bg: rgba(22, 20, 16, 0.9);
  --border-color: rgba(252, 238, 10, 0.35);
  --border-focus: #f59e0b;
  --accent-color: #fcee0a;
  --accent-secondary: #ff9d00;
  --text-color: #fffbeb;
  --text-muted: #78350f;
  --glow-shadow: 0 0 10px rgba(252, 238, 10, 0.35);
  --glow-secondary: 0 0 10px rgba(245, 158, 11, 0.3);
  --clip-cut: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  --clip-cut-small: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  --font-family: 'Rajdhani', sans-serif;
  --grid-opacity: 0.05;
  --hud-display: block;
  --backdrop-blur: none;
}

[data-theme="kitsch"] {
  --bg-color: #07080d;
  --panel-bg: rgba(14, 16, 26, 0.85);
  --border-color: rgba(0, 240, 255, 0.3);
  --border-focus: #ff0055;
  --accent-color: #00f0ff;
  --accent-secondary: #ff0055;
  --text-color: #e2e8f0;
  --text-muted: #6b7280;
  --glow-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
  --glow-secondary: 0 0 10px rgba(255, 0, 85, 0.4);
  --clip-cut: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  --clip-cut-small: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  --font-family: 'Rajdhani', sans-serif;
  --grid-opacity: 0.08;
  --hud-display: block;
  --backdrop-blur: none;
}

[data-theme="entropism"] {
  --bg-color: #040906;
  --panel-bg: rgba(8, 18, 12, 0.92);
  --border-color: rgba(51, 255, 153, 0.35);
  --border-focus: #10b981;
  --accent-color: #33ff99;
  --accent-secondary: #059669;
  --text-color: #d1fae5;
  --text-muted: #064e3b;
  --glow-shadow: 0 0 8px rgba(51, 255, 153, 0.35);
  --glow-secondary: 0 0 8px rgba(16, 185, 129, 0.3);
  --clip-cut: none;
  --clip-cut-small: none;
  --font-family: 'Share Tech Mono', monospace;
  --grid-opacity: 0.14;
  --hud-display: block;
  --backdrop-blur: none;
}

[data-theme="glassmorphism"] {
  --bg-color: #0b0f19;
  --panel-bg: rgba(17, 24, 39, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #818cf8;
  --accent-color: #818cf8;
  --accent-secondary: #c084fc;
  --text-color: #f3f4f6;
  --text-muted: #9ca3af;
  --glow-shadow: none;
  --glow-secondary: none;
  --clip-cut: none;
  --clip-cut-small: none;
  --font-family: 'Outfit', sans-serif;
  --grid-opacity: 0;
  --hud-display: none;
  --backdrop-blur: blur(18px);
}

/* ================= BASIC STYLING ================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Scanline and Grid overlays */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, var(--grid-opacity)) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, var(--grid-opacity)) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.15) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.3;
}

/* Decorative glowing blobs for glassmorphism */
.bg-blob {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -3;
  opacity: 0.4;
  animation: float-blob 22s infinite alternate;
  display: none;
}
[data-theme="glassmorphism"] .bg-blob {
  display: block;
}
.blob-1 { background: #6366f1; top: 5%; left: 15%; }
.blob-2 { background: #a855f7; bottom: 10%; right: 15%; animation-delay: -6s; }

@keyframes float-blob {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, -50px) scale(1.15); }
  100% { transform: translate(-30px, 30px) scale(0.9); }
}

/* ================= TECH CARDS & BOXES ================= */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  box-shadow: var(--glow-shadow);
  clip-path: var(--clip-cut);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Tech decorations for Cyberpunk HUD cards */
.glass-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--accent-color);
  box-shadow: var(--glow-shadow);
  display: var(--hud-display);
}

.center-container {
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Title text glows */
.login-card h2, .glass-card h3, .glass-card h4, .chat-header h1 span {
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-color);
  text-shadow: var(--glow-shadow);
}

.login-card h2 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 8px;
  text-transform: uppercase;
}

/* Inputs & Buttons */
input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  clip-path: var(--clip-cut-small);
  padding: 14px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all 0.3s ease;
}

input::placeholder {
  color: var(--text-muted);
  opacity: 0.65;
}

input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--glow-secondary);
  background: rgba(0, 0, 0, 0.7);
}

button {
  width: 100%;
  background: var(--accent-color);
  border: none;
  color: #000;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  clip-path: var(--clip-cut-small);
  padding: 14px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--glow-shadow);
}

button:hover {
  background: var(--accent-secondary);
  box-shadow: var(--glow-secondary);
  color: #fff;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

/* Dropdown theme select custom styling */
select {
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
  color: var(--accent-color);
  clip-path: var(--clip-cut-small);
  padding: 12px 16px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--glow-shadow);
}
select option {
  background: #08090f;
  color: #fff;
}

/* Alert Notification popup */
.alert {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 0, 85, 0.95);
  color: #fff;
  padding: 12px 24px;
  clip-path: var(--clip-cut-small);
  box-shadow: 0 0 20px rgba(255, 0, 85, 0.5);
  font-weight: 600;
  z-index: 10000;
  font-size: 0.9rem;
  animation: slide-down-alert 0.25s ease;
  letter-spacing: 0.05em;
}

@keyframes slide-down-alert {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.hidden {
  display: none !important;
}

/* ================= ROOM DASHBOARD ================= */
.dashboard-container {
  max-width: 600px;
  width: 100%;
  margin: 40px auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.topbar span {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-color);
  text-shadow: var(--glow-shadow);
}

.dashboard-box {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-secondary);
  text-shadow: var(--glow-secondary);
}

.scroll-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 8px;
}

/* Custom scrollbars */
.scroll-list::-webkit-scrollbar, #messages::-webkit-scrollbar, .scroll-box::-webkit-scrollbar {
  width: 5px;
}
.scroll-list::-webkit-scrollbar-track, #messages::-webkit-scrollbar-track, .scroll-box::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
}
.scroll-list::-webkit-scrollbar-thumb, #messages::-webkit-scrollbar-thumb, .scroll-box::-webkit-scrollbar-thumb {
  background: var(--border-color);
  box-shadow: var(--glow-shadow);
}
.scroll-list::-webkit-scrollbar-thumb:hover, #messages::-webkit-scrollbar-thumb:hover, .scroll-box::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  clip-path: var(--clip-cut-small);
  cursor: pointer;
  transition: all 0.2s ease;
}

.room-item:hover {
  background: rgba(0, 240, 255, 0.05);
  border-color: var(--accent-color);
  box-shadow: var(--glow-shadow);
  transform: translateX(4px);
}

.room-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-name {
  font-weight: 700;
  color: var(--text-color);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.room-owner {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.delete-icon {
  color: var(--accent-secondary);
  font-weight: bold;
  font-size: 1.1rem;
  padding: 4px 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  text-shadow: var(--glow-secondary);
}

.delete-icon:hover {
  color: #ff0000;
  transform: scale(1.15);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-box {
  width: 100%;
  max-width: 320px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-box h3 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions button:last-child {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border-color);
  color: var(--accent-color);
  box-shadow: none;
}
.modal-actions button:last-child:hover {
  background: var(--accent-secondary);
  color: #fff;
  border-color: var(--accent-secondary);
}

/* ================= CHAT HUD WINDOWS ================= */
.chat-wrapper {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.chat-header {
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--panel-bg);
  box-shadow: var(--glow-shadow);
  z-index: 50;
}

.chat-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chat-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.message-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.2);
  position: relative;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  width: 100%;
}

.msg-row {
  display: flex;
  width: 100%;
  animation: slide-up-chat 0.25s ease-out;
  justify-content: flex-start;
}

.msg-row.me {
  justify-content: flex-end;
}

@keyframes slide-up-chat {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.bubble {
  max-width: 65%;
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  clip-path: var(--clip-cut-small);
  box-shadow: var(--glow-shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.me .bubble {
  border-color: var(--accent-secondary);
  box-shadow: var(--glow-secondary);
  background: rgba(255, 0, 85, 0.08);
}

.msg-row:not(.me) .bubble {
  border-color: var(--border-color);
  box-shadow: var(--glow-shadow);
  background: rgba(0, 0, 0, 0.45);
}

.name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
  color: var(--accent-color);
  text-shadow: var(--glow-shadow);
}
.me .name {
  color: var(--accent-secondary);
  text-shadow: var(--glow-secondary);
}

.time {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
}

.text {
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
  letter-spacing: 0.02em;
}

.text img {
  max-width: 100%;
  max-height: 280px;
  border: 1px solid var(--border-color);
  margin-top: 6px;
  display: block;
  box-shadow: var(--glow-shadow);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.text img:hover {
  transform: scale(1.01);
}

.text pre {
  background: #000;
  color: #33ff99;
  font-family: 'Share Tech Mono', monospace;
  padding: 10px;
  border-left: 2px solid var(--accent-color);
  overflow-x: auto;
  margin-top: 6px;
  font-size: 0.85rem;
}

.date-separator {
  text-align: center;
  margin: 16px 0;
  font-size: 0.75rem;
  color: var(--accent-color);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-shadow: var(--glow-shadow);
}

/* Input Bar */
.input-bar {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  background: var(--panel-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: var(--glow-shadow);
  align-items: center;
  z-index: 10;
}

.input-bar input {
  flex: 1;
}

.input-bar button {
  width: auto;
  padding: 14px 24px;
}

/* ================= SIDE DRAWER & TAB DESIGN ================= */
.drawer {
  width: 280px;
  max-width: 280px;
  min-width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-color);
  background: var(--panel-bg);
  box-shadow: var(--glow-shadow);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              border-left 0.3s ease;
  overflow: hidden;
  z-index: 40;
}

.drawer.hidden {
  width: 0 !important;
  max-width: 0 !important;
  min-width: 0 !important;
  border-left: 0px solid transparent !important;
  transform: translateX(100%);
}

.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
  flex: 1;
  text-align: center;
  padding: 14px 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tab-btn:hover {
  color: var(--accent-color);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  background: rgba(0, 0, 0, 0.3);
  text-shadow: var(--glow-shadow);
}

.tab-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.tab-content.hidden {
  display: none !important;
}

.drawer-box {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-box h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-secondary);
  text-shadow: var(--glow-secondary);
  margin-bottom: 16px;
  font-weight: 700;
}

.scroll-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.scroll-box div {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
}

.scroll-box .online::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent-color);
  border-radius: 50%;
  box-shadow: var(--glow-shadow);
  display: inline-block;
}

.scroll-box .offline::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  display: inline-block;
}

/* Typing Indicator bouncing dots */
#typingIndicator {
  padding: 8px 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
  height: 32px;
  font-style: italic;
  display: flex;
  align-items: center;
  background: transparent;
}

/* Floating Scroll button */
#scrollDown {
  position: absolute;
  bottom: 90px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border-color);
  box-shadow: var(--glow-shadow);
  color: var(--accent-color);
  display: none;
  z-index: 20;
}
#scrollDown:hover {
  background: var(--accent-secondary);
  color: #fff;
}

@media (max-width: 768px) {
  .chat-body {
    position: relative;
  }
  .drawer {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    z-index: 100;
  }
  .bubble {
    max-width: 85%;
  }
}