:root {
  --bg: #121212;
  --card: #1e1e1e;
  --text: #ffffff;
  --accent: #00b7ff;
  --border: #444444;
  --input-bg: #2a2a2a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #000;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-left img { height: 42px; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.platform-text {
  font-size: 1em;
  opacity: 0.9;
  white-space: nowrap;
}

.admin-link, .logout-link {
  font-size: 13px;
  color: #9ca3af;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.admin-link:hover, .logout-link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.admin-link {
  color: var(--accent);
}

@media (max-width: 768px) {
  .platform-text {
    display: none;
  }
  .header-right {
    gap: 8px;
  }
  header {
    padding: 10px 15px;
  }
  .brand-left {
    gap: 12px;
  }
}

.filter-bar {
  background: #1a1a1a;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.filter-bar label {
  font-size: 13px;
  color: #9ca3af;
}

.filter-bar select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  min-width: 200px;
  max-width: 400px;
}

.filter-bar select:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-spacer {
  flex: 1;
}

.filter-admin-btn {
  background: var(--accent);
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}

.filter-admin-btn:hover {
  background: #0095d6;
}

@media (max-width: 768px) {
  .filter-bar {
    padding: 8px 15px;
  }
  .filter-bar select {
    min-width: 120px;
    flex: 1;
  }
  .filter-admin-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}

.container { flex: 1; display: flex; flex-direction: column; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.row { margin-bottom: 30px; display: flex; }
.user .row { justify-content: flex-end; }

.bubble {
  background: var(--card);
  padding: 20px;
  border-radius: 18px;
  max-width: 85%;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.user .bubble { background: #005588; }

.meta { font-weight: 600; color: var(--accent); margin-bottom: 12px; }

/* Feedback buttons */
.feedback-buttons {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.feedback-label {
  font-size: 13px;
  color: #9ca3af;
}

.feedback-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.feedback-btn:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
}

.feedback-btn.thumbs-up:hover {
  border-color: #22c55e;
}

.feedback-btn.thumbs-down:hover {
  border-color: #ef4444;
}

.feedback-thanks {
  font-size: 13px;
  color: #22c55e;
}

/* Input bar */
.composer {
  padding: 20px;
  background: var(--bg);
}

.input-wrapper {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
}

.input-wrapper input {
  width: 100%;
  padding: 18px 70px 18px 24px;
  font-size: 1.1em;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: white;
  outline: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.input-wrapper input::placeholder { color: #888; }

.input-wrapper #sendBtn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.6em;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Page box */
.page-box {
  margin-top: 30px;
  background: #282828;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0,0,0,0.5);
}

.page-nav {
  padding: 16px 20px;
  background: #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 600;
}

.page-nav .filename {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
}

.page-nav button {
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.full-btn {
  background: var(--accent);
  font-weight: bold;
}

.scroll-box {
  background: #000;
}

.scroll-box img {
  width: 100%;
  height: auto;
  display: block;
}

/* Full page view */
.full-body {
  background: #000;
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.viewer-header {
  background: #000;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  font-weight: 600;
}

.viewer-header button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.full-viewer {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  overflow-y: auto;
}

.full-viewer img {
  max-width: 100%;
  height: auto;
  box-shadow: 0 8px 30px rgba(255,255,255,0.1);
}

/* Mobile tweaks */
@media (max-width: 768px) {
  .messages {
    padding-bottom: 90px; /* Space for fixed composer */
  }
  .composer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom)); /* iPhone notch */
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
  }
  .input-wrapper input {
    padding: 16px 60px 16px 20px;
    font-size: 16px;
  }
  .bubble {
    padding: 16px;
  }
  .page-nav {
    flex-direction: column;
    gap: 10px;
  }
  .page-nav .filename {
    order: -1;
    max-width: 100%;
  }
}