/* ============================================================
   common.css — общие стили проекта torgi-online v2.0
   Подключается ПЕРЕД participant.css / monitor.css
   ============================================================ */


/* ╔══════════════════════════════════════════════════════════╗
   ║                       СБРОС                              ║
   ╚══════════════════════════════════════════════════════════╝ */

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


/* ╔══════════════════════════════════════════════════════════╗
   ║                  CSS-ПЕРЕМЕННЫЕ                          ║
   ╚══════════════════════════════════════════════════════════╝ */

:root {
  --bg:           #FFFFFF;
  --canvas:       #F6F6F7;
  --surface:      #FFFFFF;
  --border:       #E5E5E5;
  --accent:       #FFF200;
  --accent-hover: #F2E600;
  --on-accent:    #19191F;
  --green:        #146C2E;
  --red:          #B42318;
  --info:         #1D4E89;
  --muted:        #6B6B6B;
  --text:         #19191F;
  --hover:        #EDEDED;
  --header:       #F2F2F2;
  --radius:       10px;
}


/* ╔══════════════════════════════════════════════════════════╗
   ║                  БАЗА: BODY, ШРИФТЫ                      ║
   ╚══════════════════════════════════════════════════════════╝ */

html {
  font-size: clamp(12px, 1.2vw, 16px);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--canvas);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

a { color: var(--text); }

.user-action {
  color: var(--text);
  font-size: 11px;
  margin-left: 8px;
}

.user-action.logout-link { color: var(--red); }

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
}

.connection-state::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.connection-state.online { color: var(--green); }
.connection-state.offline { color: var(--red); }
.connection-state.connecting { color: var(--text); }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--on-accent);
  outline-offset: 3px;
}

:where(button, input, select, textarea):disabled {
  cursor: not-allowed;
  opacity: .55;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}


/* ╔══════════════════════════════════════════════════════════╗
   ║                  УНИВЕРСАЛЬНЫЕ ИНПУТЫ                    ║
   ╚══════════════════════════════════════════════════════════╝ */

.field {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color .2s;
  -webkit-appearance: none;
  appearance: none;
}
.field:focus { border-color: var(--on-accent); }


/* ╔══════════════════════════════════════════════════════════╗
   ║                  УНИВЕРСАЛЬНЫЕ КНОПКИ                    ║
   ╚══════════════════════════════════════════════════════════╝ */

.btn-primary {
  width: 100%;
  padding: 13px;
  margin-top: 10px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover    { background: var(--accent-hover); }
.btn-primary:active   { opacity: .85; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.err {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
}


/* ╔══════════════════════════════════════════════════════════╗
   ║                    ЛОГИН-БОКС                            ║
   ╚══════════════════════════════════════════════════════════╝ */

.login-box {
  width: 100%;
  max-width: 380px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
}
.login-logo  { margin-bottom: 20px; }
.login-box h1 { font-size: 22px; margin-bottom: 6px; }
.login-sub   { font-size: 13px; margin-bottom: 24px; line-height: 1.5; padding: 0 8px; color: var(--muted); }


/* ╔══════════════════════════════════════════════════════════╗
   ║                    БЕЙДЖИ                                ║
   ╚══════════════════════════════════════════════════════════╝ */

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.run  { background: #E8F6EC; color: var(--green); border: 1px solid #B7E0C2; }
.badge.stop { background: #FDECEC; color: var(--red);   border: 1px solid #F5C2C0; }


/* ╔══════════════════════════════════════════════════════════╗
   ║                    ЧАТ — БАЗА                            ║
   ╚══════════════════════════════════════════════════════════╝ */

.chat-msg          { font-size: 12px; line-height: 1.4; }
.chat-msg .time,
.chat-msg .t       { color: var(--muted); font-size: 10px; margin-right: 4px; }
.chat-msg .who,
.chat-msg .w       { font-weight: 600; margin-right: 5px; color: var(--text); }
.chat-msg .who.admin,
.chat-msg .w.admin { color: var(--red); }
.chat-msg .txt,
.chat-msg .tx      { color: var(--muted); }
.chat-empty        { font-size: 12px; color: var(--muted); }


/* ╔══════════════════════════════════════════════════════════╗
   ║                  МЕТРИКИ / КАРТОЧКИ                      ║
   ╚══════════════════════════════════════════════════════════╝ */

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.metric-card.green-card { border-color: #B7E0C2; background: #E8F6EC; }

.m-lbl {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 6px;
}
.m-val       { font-size: clamp(13px, 1.6vw, 20px); font-weight: 700; white-space: nowrap; }
.m-val.green { color: var(--green); }
.m-val.grey  { color: var(--muted); }


/* ╔══════════════════════════════════════════════════════════╗
   ║                    АНИМАЦИЯ FLASH                        ║
   ╚══════════════════════════════════════════════════════════╝ */

.flash { animation: flash .5s ease; }
@keyframes flash {
  0%,100% { opacity: 1; }
  50%     { opacity: .3; }
}


/* ╔══════════════════════════════════════════════════════════╗
   ║                    КОПИРАЙТ                              ║
   ╚══════════════════════════════════════════════════════════╝ */

.copyright {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  padding: 16px 0 8px;
}


#loginScreen {
  background: var(--bg);
}

.avo-logo {
  display: inline-block;
  width: 200px;
  height: auto;
  vertical-align: middle;
}

.avo-logo-compact {
  width: 140px;
}

.data-row:hover,
.draft-row:hover,
.log-row:hover,
.part-item:hover,
.p-card:hover,
.audit-row:hover {
  background: var(--hover);
}

.data-row:focus-within,
.draft-row:focus-within,
.part-item:focus-within {
  background: var(--hover);
  border-color: var(--on-accent);
}
