/* static/style.css */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root{
  --bg-left:#8fb7e8;
  --bg-right:#2f7fe6;

  --text:#0b0f14;
  --muted:#7a8696;
  --border:#d7dde5;
  --card:#ffffff;

  --primary:#2d81e0;
  --primaryHover:#2573cc;

  --shadow: 0 12px 28px rgba(0,0,0,.18);
  --shadow-soft: 0 8px 18px rgba(0,0,0,.14);
  --focus: rgba(105,167,255,.28);
}

html, body { height: 100%; }

body{
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #e9f0fb;
}

/* ===== Topbar ===== */
.topbar{
  position: relative;
  z-index: 5;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(10px);
}

.topbar__inner{
  width: min(1200px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__search{
  flex: 1;
  max-width: 520px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
}

.topbar__searchIcon{
  width: 16px; height: 16px;
  display: inline-block;
  background:
    radial-gradient(circle at 55% 45%, transparent 6px, #6f7a86 6px 7px, transparent 7px),
    linear-gradient(#6f7a86,#6f7a86);
  background-size: 16px 16px, 8px 2px;
  background-position: 0 0, 12px 14px;
  background-repeat: no-repeat;
  transform: rotate(45deg);
  opacity: .9;
}

.topbar__search input{
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  color: #1b2430;
}
.topbar__search input::placeholder{ color: #7d8895; }

.topbar__bizBtn{
  margin-left: auto;
  height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  color: #1a2a3c;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
  transition: transform .12s ease, background .12s ease;
}
.topbar__bizBtn:hover{ transform: translateY(-1px); background: rgba(255,255,255,.86); }
.topbar__bizBtn:active{ transform: translateY(0px); }

/* ===== Stage ===== */
.stage{
  position: relative;
  min-height: calc(100vh - 52px);
  display: grid;
  place-items: center;
  padding: 34px 16px 18px;
}

.vk-bg{
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg-left), var(--bg-right));
  overflow: hidden;
}

.vk-bg__curve{
  position: absolute;
  border: 2px solid rgba(255,255,255,.22);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 999px;
  opacity: .9;
}
.vk-bg__curve--a{ width: 1040px; height: 1040px; right: -460px; top: -360px; transform: rotate(6deg); }
.vk-bg__curve--b{ width: 860px; height: 860px; right: -320px; top: -170px; transform: rotate(6deg); opacity: .58; }
.vk-bg__curve--c{ width: 1280px; height: 1280px; left: -720px; bottom: -840px; transform: rotate(10deg); opacity: .32; }

/* ===== Card ===== */
.auth{
  position: relative;
  z-index: 3;
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.auth__card{
  width: 360px;
  max-width: 92vw;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
  position: relative;
}

.auth__back{
  position: absolute;
  left: 14px;
  top: 12px;
  border: 0;
  background: transparent;
  font-size: 22px;
  color: #2b3a4a;
  opacity: .85;
  cursor: pointer;
}
.auth__back:hover{ opacity: 1; }

.auth__logo{
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #1976ff;
  display: grid;
  place-items: center;
  margin: 6px auto 12px;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

.vk-logo-img{
  width: 28px;
  height: 28px;
  display: block;
}

.auth__title{
  text-align: center;
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 12px;
}

/* ===== Segmented ===== */
.segmented{
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f2f4f7;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 12px;
}
.segmented__btn{
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  color: #44505e;
  cursor: pointer;
}
.segmented__btn.is-active{
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
  color: #111827;
}

/* ===== Tabs ===== */
.tab{ display: none; }
.tab.tab--active{ display: block; }

/* ===== Fields ===== */
.field{
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 44px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 12px;
}
.field:focus-within{
  border-color: #6aa9ff;
  box-shadow: 0 0 0 3px var(--focus);
}

.field__prefix{
  height: 100%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: #f6f8fb;
  border-right: 1px solid var(--border);
}

.field__code{
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}

.field__input{
  flex: 1;
  height: 100%;
  padding: 0 12px;
  border: 0;
  outline: 0;
  font-size: 15px;
  color: #111827;
}
.field__input::placeholder{ color: #8a96a3; }

.field--single .field__input{ padding-left: 14px; }

/* ===== Beautiful round flag (no ugly cropping) ===== */
.flag{
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;

  box-shadow:
    0 0 0 1px rgba(0,0,0,.12),
    inset 0 0 0 1px rgba(255,255,255,.35);
}

.flag--ru{
  background:
    linear-gradient(to bottom,
      #ffffff 0% 33.33%,
      #2f6fe6 33.33% 66.66%,
      #d52b1e 66.66% 100%
    );
}

/* ===== Row ===== */
.row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.check{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.check input{ display:none; }

.check__box{
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid #cfd6df;
  background: #fff;
  display: grid;
  place-items: center;
}
.check input:checked + .check__box{
  background: var(--primary);
  border-color: var(--primary);
}
.check input:checked + .check__box::after{
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}
.check__label{
  font-size: 14px;
  color: #111827;
  font-weight: 300;
}

.hint{
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #d7dde5;
  background: #fff;
  color: #7b8794;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
}
.hint:hover{ background: #f6f8fb; }

/* ===== Buttons ===== */
.btn{
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 400;
  transition: background .12s ease, transform .10s ease, border-color .12s ease;
}
.btn:active{ transform: translateY(1px); }

.btn--primary{
  background: var(--primary);
  color: #fff;
  margin-bottom: 10px;
}
.btn--primary:hover{ background: var(--primaryHover); }

.btn--ghost{
  background: #ffffff;
  color: #111827;
  border-color: var(--border);
  margin-bottom: 12px;
  font-weight: 400;
}
.btn--ghost:hover{ background: #f7f9fc; }

.or{
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  margin: 8px 0 10px;
}

.btn--qr{
  background: #ffffff;
  color: #111827;
  border-color: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn--qr:hover{ background: #f7f9fc; }

.qrIcon{
  width: 18px;
  height: 18px;
  display: inline-block;
  background:
    linear-gradient(#111827,#111827) 0 0/6px 6px no-repeat,
    linear-gradient(#111827,#111827) 12px 0/6px 6px no-repeat,
    linear-gradient(#111827,#111827) 0 12px/6px 6px no-repeat,
    linear-gradient(#111827,#111827) 12px 12px/6px 6px no-repeat,
    linear-gradient(#111827,#111827) 6px 6px/6px 2px no-repeat,
    linear-gradient(#111827,#111827) 6px 9px/2px 6px no-repeat;
  border-radius: 3px;
  opacity: .9;
}

/* ===== Texts ===== */
.auth__legal{
  margin-top: 12px;
  text-align: center;
  font-size: 11.8px;
  color: #8a96a3;
  line-height: 1.35;
  padding: 0 6px;
}

.help{
  color: rgba(255,255,255,.95);
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 10px;
  transition: background .12s ease;
}
.help:hover{ background: rgba(255,255,255,.12); }

/* ===== Footer ===== */
.footer{
  position: relative;
  z-index: 5;
  padding: 10px 16px 18px;
  background: transparent;
}

.footer__inner{
  width: min(1200px, 100%);
  margin: 0 auto;
  color: rgba(255,255,255,.92);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer__left{
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  opacity: .95;
}
.footer__dot{ opacity: .7; }

.footer__links{
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.footer__links a{
  color: rgba(255,255,255,.92);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 800;
  opacity: .92;
}
.footer__links a:hover{ text-decoration: underline; }

/* Custom styles for our system */
.login-form {
  width: 100%;
}

.form-group {
  margin-bottom: 20px;
}

.error-message {
  color: #ff3347;
  font-size: 14px;
  margin-top: 10px;
  text-align: center;
}

.info-message {
  color: #2d81e0;
  font-size: 14px;
  margin-top: 10px;
  text-align: center;
}

.attempts-history {
  margin-top: 20px;
  border-top: 1px solid #e7e8ec;
  padding-top: 15px;
}

.attempts-history h3 {
  font-size: 14px;
  color: #55677d;
  margin-bottom: 10px;
}

.attempts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.attempts-table th {
  text-align: left;
  padding: 8px;
  background: #f5f7fa;
  color: #55677d;
  border-bottom: 1px solid #e7e8ec;
}

.attempts-table td {
  padding: 8px;
  border-bottom: 1px solid #e7e8ec;
}

.attempts-table tr.correct {
  background: #f0fff4;
}

.attempts-table tr.incorrect {
  background: #fff0f0;
}

@media (max-width: 520px){
  .topbar__bizBtn{ display:none; }
  .auth__card{ width: min(360px, 92vw); }
}

/* Admin styles */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.admin-header {
  background: #2d81e0;
  color: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.admin-table {
  width: 100%;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-table th {
  background: #f5f7fa;
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  color: #55677d;
}

.admin-table td {
  padding: 12px 16px;
  border-top: 1px solid #e7e8ec;
}

.admin-status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-waiting { background: #cce5ff; color: #004085; }
.status-completed { background: #d4edda; color: #155724; }
.status-blocked { background: #f8d7da; color: #721c24; }

.admin-actions a {
  display: inline-block;
  padding: 6px 12px;
  margin-right: 5px;
  background: #2d81e0;
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-size: 13px;
}

.admin-actions a:hover {
  background: #2573cc;
}

.nav-links {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.nav-links a {
  padding: 10px 20px;
  background: #2d81e0;
  color: white;
  border-radius: 6px;
  text-decoration: none;
}

.nav-links a:hover {
  background: #2573cc;
}
