@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-ThinItalic.woff2") format("woff2");
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-ExtraLight.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-ExtraLightItalic.woff2") format("woff2");
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-LightItalic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-MediumItalic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-SemiBoldItalic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./styles/fonts/JetBrainsMono-ExtraBoldItalic.woff2") format("woff2");
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}

:root {
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 15px;
  background: #1a1c21;
  color: #f1f1f1;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 60px;
  --primary-color: #4b82ff;
  --success-color: #7edba5;
  --danger-color: #d36d6d;
  --bg-dark: #111217;
  --bg-panel: #181a1f;
  --bg-content: #1a1c21;
  --border-color: #2a2d35;
  --text-muted: #9ea4b9;
  --message-bg: #1e2028;
  --message-bg-user: #2d4fcc;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-dark);
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  overflow: hidden;
  position: relative;
  min-width: 200px;
  max-width: 500px;
  resize: horizontal;
  flex-shrink: 0;
}

.sidebar-right {
  border-right: none;
  border-left: 1px solid var(--border-color);
  order: 3;
}

.sidebar-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: transparent;
  z-index: 10;
}

.sidebar-resize-handle-left {
  right: auto;
  left: 0;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.resizing {
  background: var(--primary-color);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
  max-width: var(--sidebar-collapsed-width);
}

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

.sidebar-header h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}

.toggle-sidebar {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-sidebar:hover {
  background: rgba(255, 255, 255, 0.05);
}

.connection-section,
.channel-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.section-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #3a3f4d;
  border-radius: 4px;
  background: #101218;
  color: #f1f1f1;
}

.form-group input:focus {
  border-color: var(--primary-color);
  outline: none;
}

.button-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

button {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #3a3f4d;
  background: #242730;
  color: #f1f1f1;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

button:hover:not(:disabled) {
  background: #2c303a;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover:not(:disabled) {
  background: #5a92ff;
}

.btn-danger {
  background: var(--danger-color);
  border-color: var(--danger-color);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.75rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger-color);
}

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

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
}

.channel-item {
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.channel-item.active {
  background: rgba(75, 130, 255, 0.15);
  color: var(--primary-color);
}

.channel-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.channel-icon svg {
  width: 100%;
  height: 100%;
}

.channel-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.people-section {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.people-search-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #3a3f4d;
  border-radius: 4px;
  background: #101218;
  color: #f1f1f1;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.people-search-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.people-list-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.people-list {
  padding: 0;
  position: relative;
  min-height: 0;
  width: 100%;
}

.people-list-spacer {
  width: 100%;
  flex-shrink: 0;
  height: 0;
}

.people-item {
  padding: 6px 12px;
  border-radius: 4px;
  margin-bottom: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.people-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.people-item.op {
  color: #ff5f87;
  font-weight: bold;
}

.people-item.voiced {
  color: #5af78e;
}

.people-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.people-icon svg {
  width: 100%;
  height: 100%;
}

.people-prefix {
  font-size: 0.75rem;
  width: 12px;
  text-align: center;
  flex-shrink: 0;
}

.people-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Main Content Styles */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-content);
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  background: #14151a;
  overflow-x: auto;
}

.tab {
  padding: 8px 16px;
  border-radius: 4px 4px 0 0;
  border: 1px solid #2f323a;
  border-bottom: none;
  background: #1b1d23;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab.active {
  background: #23252d;
  color: #f5f5f5;
}

.tab-close {
  margin-left: 4px;
  opacity: 0.6;
  font-size: 0.8rem;
}

.tab-close:hover {
  opacity: 1;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
}

.message-line {
  display: flex;
  padding: 2px 0;
}

.message-sender {
  min-width: 120px;
  font-weight: 500;
  padding-right: 8px;
  text-align: right;
  color: var(--text-muted);
}

.message-sender.you {
  color: var(--primary-color);
}

.message-content {
  flex: 1;
  color: #e1e1e1;
}

.system-message {
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

.irc-message {
  color: #a0a0a0;
  font-size: 0.8rem;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-panel);
}

.composer-input {
  position: relative;
  display: flex;
  align-items: center;
  background: #2a2e35;
  border-radius: 24px;
  padding: 0 16px;
}

.composer-input input {
  flex: 1;
  border: none;
  background: transparent;
  color: #f1f1f1;
  padding: 12px 0;
  font-size: 0.95rem;
  outline: none;
  font-family: 'JetBrains Mono', monospace;
}

.composer-input input::placeholder {
  color: #6a7283;
}

.suggestions {
  position: absolute;
  bottom: 110%;
  left: 0;
  right: 0;
  background: #101116;
  border: 1px solid #3a3f4d;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.suggestions button {
  border: none;
  background: transparent;
  text-align: left;
  border-radius: 0;
}

.suggestions button:hover,
.suggestions button.active {
  background: #222430;
}

.suggestions.hidden {
  display: none;
}

/* Collapsed sidebar styles */
.sidebar.collapsed .section-title,
.sidebar.collapsed .form-group,
.sidebar.collapsed .button-group,
.sidebar.collapsed .status-indicator,
.sidebar.collapsed .channel-name,
.sidebar.collapsed .people-name {
  display: none;
}

.sidebar.collapsed .sidebar-header h1 {
  display: none;
}

.sidebar.collapsed .connection-section,
.sidebar.collapsed .channel-section,
.sidebar.collapsed .people-section {
  padding: 16px 8px;
}

.sidebar.collapsed .channel-item,
.sidebar.collapsed .people-item {
  justify-content: center;
  padding: 8px;
}

/* Responsive styles */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    z-index: 100;
    height: 100%;
  }

  .sidebar:not(.collapsed) {
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
  }

  .composer {
    grid-template-columns: 1fr;
  }
}

input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}