/* Brand + Light UI
   Primary: #B00020
   Header Background: #0b0b0b
*/
:root {
  --bg: #f8f9fc;
  --panel: #ffffff;
  --text: #111111;
  --muted: #666666;
  --border: #e5e7eb;

  --accent: #B00020;
  --accent-2: #7A0014;
  --accent-contrast: #ffffff;

  --header-bg: #0b0b0b;

  --success-bg: #f0fdf4; --success-bd: #86efac;
  --danger-bg:  #fef2f2; --danger-bd:  #fecaca;
  --warn-bg:    #fffbeb; --warn-bd:    #fcd34d;
  --info-bg:    #eff6ff; --info-bd:    #93c5fd;
}

/* Base */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.9; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1rem; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.logo { height: 40px; width: auto; display: block; }
@media (max-width: 900px) { .logo { height: 36px; } }
@media (max-width: 600px) { .logo { height: 32px; } }

/* Header */
.site-header {
  background: var(--header-bg);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.site-header nav a {
  color: #bbbbbb; margin-left: 1.5rem; font-weight: 500;
  padding: 0.15rem 0; transition: color .2s ease, border-color .2s ease;
  border-bottom: 2px solid transparent;
}
.site-header nav a:hover { color: #ffffff; }
.site-header nav a.active { color: #ffffff; border-bottom-color: var(--accent); }

/* Cards, layout */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 1rem; box-shadow: 0 8px 25px rgba(0,0,0,0.05); padding: 1.25rem; }
.card--glass { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); color: #fff; box-shadow: 0 8px 30px rgba(0,0,0,0.4); backdrop-filter: blur(12px); }
.stack > * + * { margin-top: 0.6rem; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Buttons */
.btn { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: var(--accent-contrast); border: none; padding: 0.8rem 1.6rem; border-radius: 50px; font-weight: 600; cursor: pointer; display: inline-block; transition: transform .15s ease, opacity .2s ease, box-shadow .2s ease; box-shadow: 0 6px 16px rgba(176,0,32,0.25); }
.btn:hover { opacity: 0.95; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.tiny { padding: 0.45rem 0.8rem; font-size: 0.875rem; }

/* Forms */
label { display: inline-flex; align-items: center; gap: 0.35rem; cursor: default; font-weight: 500; }
label[for] { cursor: pointer; }
input, select, textarea { width: 100%; padding: 0.8rem 1rem; border-radius: 10px; border: 1px solid #d1d5db; background: #ffffff; color: var(--text); transition: border-color .2s ease, box-shadow .2s ease; font-family: inherit; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #9aa0a6; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(176,0,32,0.18); outline: none; }

/* Flash messages */
.flash { list-style: none; padding-left: 0; margin: 0 0 1rem; }
.flash li { padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 0.6rem; border: 1px solid transparent; }
.flash-success { background: var(--success-bg); border-color: var(--success-bd); }
.flash-danger  { background: var(--danger-bg);  border-color: var(--danger-bd); }
.flash-warning { background: var(--warn-bg);    border-color: var(--warn-bd); }
.flash-info    { background: var(--info-bg);    border-color: var(--info-bd); }

.muted { color: var(--muted); }
.list { list-style: none; padding-left: 0; margin: 0; }
.list li { padding: 0.5rem 0; border-bottom: 1px dashed var(--border); }
.list li:last-child { border-bottom: none; }

.media img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.media audio { width: 100%; }

/* Avatars */
.avatar-lg { width: 120px; height: 120px; border-radius: 9999px; object-fit: cover; border: 2px solid var(--border); }

/* Chat layout */
.container.chat-layout { flex: 1; max-width: 1200px; margin: 2rem auto; display: grid; grid-template-columns: 280px 1fr; gap: 2rem; padding: 0 1rem; }
.chat-sidebar { background: #ffffff; border-radius: 1rem; box-shadow: 0 8px 25px rgba(0,0,0,0.05); padding: 1.5rem; display: flex; flex-direction: column; height: calc(100vh - 160px); }
.chat-sidebar h3 { font-size: 1.2rem; margin: 0 0 1rem; color: var(--accent); }
.chat-sidebar .list { flex: 1; overflow-y: auto; }
.chat-sidebar .list a { display: block; padding: 0.75rem 1rem; border-radius: 8px; color: #333; text-decoration: none; transition: background .2s ease, color .2s ease; }
.chat-sidebar .list a:hover { background: #f3f3f3; }
.chat-sidebar .list a.active { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #ffffff; }

.chat-main { background: #ffffff; border-radius: 1rem; box-shadow: 0 8px 25px rgba(0,0,0,0.05); display: flex; flex-direction: column; height: calc(100vh - 160px); }
.chat-title { border-bottom: 1px solid #eee; padding: 1rem 1.5rem; background: #fafafa; border-top-left-radius: 1rem; border-top-right-radius: 1rem; }
.chat-title h3 { margin: 0; font-weight: 600; color: var(--accent); }
.infobar { margin-top: 4px; color: #666; font-size: 0.9rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.infobar .sep { opacity: 0.6; }
.chat-messages { flex: 1; padding: 1.5rem; overflow-y: auto; }

.msg { margin-bottom: 1.25rem; animation: fadeIn 0.3s ease-in; }
.meta { font-size: 0.85rem; color: #888; margin-bottom: 0.3rem; display: flex; gap: 0.5rem; justify-content: space-between; }
.text { background: #f3f3f3; display: inline-block; padding: 0.75rem 1rem; border-radius: 12px; max-width: 80%; line-height: 1.4; white-space: pre-wrap; }
.msg.own .text { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #ffffff; border-radius: 12px 12px 0 12px; }
.msg.own .media { text-align: right; }

.chat-input { display: flex; align-items: center; gap: 1rem; border-top: 1px solid #eee; padding: 1rem 1.5rem; background: #fafafa; border-bottom-left-radius: 1rem; border-bottom-right-radius: 1rem; }
.chat-input input[name="message"] { flex: 1; padding: 0.8rem 1rem; border-radius: 50px; border: 1px solid #ccc; outline: none; font-size: 1rem; transition: border-color .2s ease, box-shadow .2s ease; background: #fff; color: var(--text); }
.chat-input input[name="message"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(176,0,32,0.15); }
.chat-input input[type="file"] { display: none; }
.chat-input label { color: #666; font-size: 1.1rem; transition: color .2s ease, transform .2s ease; }
.chat-input label:hover { color: var(--accent); transform: scale(1.07); }
.chat-input label.uploaded { color: var(--accent); }

/* Responsive */
@media (max-width: 900px) {
  .container.chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar, .chat-main { height: auto; }
  .chat-sidebar { max-height: 30vh; overflow-y: auto; }
}

/* Accessibility focus */
a:focus, .btn:focus, input:focus, select:focus, textarea:focus { outline: 2px solid rgba(176,0,32,0.6); outline-offset: 2px; }
