@import url("/static/fonts/fonts.css");

:root {
  --bg: #f6f6f7;
  --card: #ffffff;
  --text: #1a1a1d;
  --muted: #6b6b73;
  --primary: #f71319;      /* đỏ ITP */
  --primary-d: #c80d12;
  --primary-soft: #fde8e9;
  --border: #e4e4e8;
  --err-bg: #fde8e9;
  --err: #b30c11;
  --ok-bg: #e9f8ef;
  --ok: #11733f;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 16px; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
a:hover { color: var(--primary-d); }

/* ---- tiêu đề kiểu logo ITP: đậm, nghiêng ---- */
h1, h2, .display {
  font-weight: 900; font-style: italic; letter-spacing: -.01em; line-height: 1.1;
}
h1 { font-size: 1.9rem; margin: 0 0 18px; }
h2 { font-size: 1.35rem; margin: 0 0 12px; }
h1::after {
  content: ""; display: block; width: 56px; height: 5px; margin-top: 10px;
  background: var(--primary); transform: skewX(-20deg);
}

/* ---- thanh trên ---- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 24px; background: var(--card);
  border-bottom: 4px solid var(--primary);
}
.topbar nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.topbar nav a { text-decoration: none; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand img { height: 34px; display: block; }
.brand span {
  font-weight: 800; font-style: italic; font-size: 1.15rem; text-transform: uppercase;
  letter-spacing: .02em; padding-left: 12px; border-left: 2px solid var(--border);
}

.container { max-width: 780px; margin: 32px auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 26px; margin-bottom: 20px; }
.narrow { max-width: 420px; margin: 40px auto; }
.auth-logo { display: block; height: 58px; margin: 0 auto 20px; }

/* ---- form ---- */
label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 14px; }
input, textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 6px; font: inherit; font-weight: 400; background: #fff;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); border-color: transparent; }
.row { margin-bottom: 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.voice { min-width: 200px; }

/* ---- nút: đỏ, chữ đậm nghiêng như logo ---- */
button.primary, .button {
  display: inline-block; background: var(--primary); color: #fff; border: 0; border-radius: 6px;
  padding: 11px 22px; font-family: var(--font); font-size: 1.05rem; font-weight: 800; font-style: italic;
  text-transform: uppercase; letter-spacing: .03em; cursor: pointer; text-decoration: none;
  transition: background .15s, transform .15s;
}
button.primary:hover, .button:hover { background: var(--primary-d); color: #fff; }
button.primary:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: wait; }
button.link { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; font-weight: 600; padding: 0; }
button.link:hover { color: var(--primary-d); text-decoration: underline; }
form.inline { display: inline; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.alert { background: var(--err-bg); color: var(--err); padding: 10px 14px; border-radius: 6px; margin: 14px 0; border-left: 4px solid var(--primary); }
.result { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.result audio { width: 100%; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.history li .small { grid-column: 2; }
.htext { word-break: break-word; }

/* ---- admin ---- */
.container.wide { max-width: 1200px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-left: 5px solid var(--primary);
  border-radius: 8px; padding: 14px 16px; color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase;
}
.stat span { display: block; font-size: 2rem; font-weight: 900; font-style: italic; color: var(--text); text-transform: none; }
.notice { background: var(--ok-bg); color: var(--ok); padding: 10px 14px; border-radius: 6px; margin: 14px 0; border-left: 4px solid var(--ok); }
.search { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.search input { margin: 0; flex: 1; }
.table-wrap { overflow-x: auto; }
table.users { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.users th {
  text-align: left; color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .04em; padding: 8px; border-bottom: 2px solid var(--text); white-space: nowrap;
}
table.users td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.users tr.locked td { background: #fafafa; color: var(--muted); }
td.actions { white-space: nowrap; }
td.actions form + form { margin-left: 10px; }
button.link.danger { color: var(--err); }
.badge { margin-left: 4px; display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eeeef1; color: #4a4a52; vertical-align: middle; text-transform: uppercase; letter-spacing: .03em; }
.badge.admin { background: var(--primary); color: #fff; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--err-bg); color: var(--err); }
dl.info { display: grid; grid-template-columns: 180px 1fr; gap: 8px 12px; margin: 0; }
dl.info dt { color: var(--muted); } dl.info dd { margin: 0; }
.history.plain li { grid-template-columns: 1fr; }
.history.plain li .small { grid-column: 1; }

@media (max-width: 600px) {
  .topbar { padding: 10px 16px; }
  .brand span { display: none; }
  .card { padding: 20px; }
  dl.info { grid-template-columns: 1fr; }
}

/* ---- trang đăng nhập / đăng ký: giới thiệu + form ---- */
.container.auth { max-width: 1120px; }
.auth-layout {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(26, 26, 29, .06);
}
.auth-hero {
  position: relative; color: #fff; padding: 36px 40px 32px;
  background:
    radial-gradient(circle at 90% 10%, rgba(255,255,255,.16) 0, transparent 45%),
    linear-gradient(150deg, #f71319 0%, #c80d12 100%);
}
.auth-hero::after { /* sọc nghiêng kiểu logo */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: repeating-linear-gradient(-60deg, rgba(255,255,255,.35) 0 10px, transparent 10px 20px);
}
.hero-logo { height: 40px; display: block; filter: brightness(0) invert(1); margin-bottom: 22px; }
.hero-title { font-size: 2.2rem; margin: 0 0 10px; color: #fff; }
.hero-sub { margin: 0 0 18px; font-size: 1.05rem; opacity: .92; max-width: 480px; }
.hero-illus { display: block; width: 100%; max-width: 440px; height: auto; margin: 4px 0 18px; }
.hero-wave rect { transform-box: fill-box; transform-origin: center; animation: wave 1.4s ease-in-out infinite; }
.hero-wave rect:nth-child(2) { animation-delay: -.2s; }
.hero-wave rect:nth-child(3) { animation-delay: -.4s; }
.hero-wave rect:nth-child(4) { animation-delay: -.6s; }
.hero-wave rect:nth-child(5) { animation-delay: -.8s; }
.hero-wave rect:nth-child(6) { animation-delay: -1s; }
@keyframes wave { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.45); } }
.hero-arrows path { animation: blink 1.4s ease-in-out infinite; }
.hero-arrows path:nth-child(2) { animation-delay: .2s; }
.hero-arrows path:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hero-wave rect, .hero-arrows path { animation: none; } }

.features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.features li { display: flex; gap: 12px; align-items: flex-start; }
.features b { display: block; font-weight: 800; font-style: italic; font-size: 1.02rem; }
.features span:not(.ficon) { display: block; font-size: .88rem; opacity: .88; line-height: 1.35; margin-top: 2px; }
.ficon {
  flex: none; width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.18);
  display: grid; place-items: center;
}
.ficon svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.auth-card { border: 0; border-radius: 0; margin: 0; padding: 48px 44px; align-self: center; }
.auth-card form button.primary { width: 100%; margin-top: 4px; }
.auth-card .muted { text-align: center; margin-top: 18px; }

@media (max-width: 860px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-card { order: -1; padding: 30px 24px; }   /* trên điện thoại: form lên trước */
  .auth-hero { padding: 28px 24px; }
  .hero-title { font-size: 1.7rem; }
}
@media (max-width: 520px) {
  .features { grid-template-columns: 1fr; }
}
