/* Voice Studio — giao diện kiểu VoicePro: thanh bên tối, nền sáng oải hương,
   thẻ trắng bo tròn, nhấn gradient tím–hồng. Mọi khối có min-width:0 và
   overflow-x:clip ở body để không tràn ngang trên điện thoại. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: #f3f1fa; color: #221d38; overflow-x: clip;
}
.hidden { display: none !important; }
a { color: #7c3aed; }
button { font-family: inherit; cursor: pointer; }

.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }

/* ---------- thanh bên ---------- */
.sidebar {
  background: linear-gradient(180deg, #16122b 0%, #1d1839 60%, #241c47 100%);
  color: #e9e5f9; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.brand-logo { font-size: 26px; }
.brand-text { font-size: 19px; font-weight: 600; line-height: 1.05; }
.brand-text b { background: linear-gradient(90deg, #a78bfa, #f472b6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-text small { display: block; font-size: 11px; color: #a79fd0; font-weight: 400; letter-spacing: .4px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: none; border: none; color: #c9c3e6; font-size: 14.5px; font-weight: 500;
  padding: 10px 12px; border-radius: 12px; text-decoration: none;
}
.side-item .ic { width: 20px; text-align: center; flex: none; }
.side-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-item.active { background: linear-gradient(90deg, #6d28d9, #9333ea); color: #fff; box-shadow: 0 6px 18px rgba(124,58,237,.35); }
.pro-card {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px; padding: 14px;
}
.pro-title { font-weight: 700; font-size: 14.5px; margin-bottom: 5px; }
.pro-card p { margin: 0 0 11px; font-size: 12.5px; color: #b6aede; line-height: 1.5; }
.pro-btn { width: 100%; background: linear-gradient(90deg, #7c3aed, #db2777); color: #fff; border: none; padding: 10px; font-weight: 700; }
.side-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: 14px; }
.side-user .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #7c3aed, #ec4899); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
#authUser { display: flex; align-items: center; gap: 9px; }
.uinfo { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.uinfo .hello { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uinfo small { color: #a79fd0; font-size: 11.5px; }
#authGuest { display: flex; gap: 8px; }
#authGuest .btn { flex: 1; }

/* ---------- nút bấm chung ---------- */
.btn {
  border: 1px solid #ddd6f5; background: #fff; color: #3b2f63; border-radius: 999px;
  padding: 8px 16px; font-size: 14px; font-weight: 600; display: inline-block; text-decoration: none;
}
.btn:hover { border-color: #c4b5fd; }
.btn.primary { background: linear-gradient(90deg, #7c3aed, #c026d3); border: none; color: #fff; box-shadow: 0 6px 20px rgba(147,51,234,.3); }
.btn.light { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.25); color: #fff; }
.btn.small { padding: 6px 13px; font-size: 13px; }
.btn.big { width: 100%; padding: 13px; font-size: 15.5px; margin-top: 10px; }
.btn.danger { color: #b91c1c; border-color: #fecaca; }
.btn:disabled { opacity: .55; cursor: wait; }
.chip-btn { padding: 6px 12px; font-size: 13px; border-radius: 999px; }
.link-btn { background: none; border: none; color: #7c3aed; font-size: 13px; font-weight: 700; padding: 4px; }

/* ---------- khu vực chính ---------- */
.main { padding: 18px 26px 8px; min-width: 0; max-width: 1460px; width: 100%; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.global-search {
  flex: 1; display: flex; align-items: center; gap: 9px; background: #fff;
  border: 1px solid #e6e1f7; border-radius: 999px; padding: 10px 16px; min-width: 0;
  box-shadow: 0 2px 10px rgba(90,70,180,.05);
}
.global-search input { border: none; outline: none; flex: 1; font-size: 14.5px; background: none; min-width: 0; color: #221d38; }
.quota-pill { background: #fff; border: 1px solid #e6e1f7; border-radius: 999px; padding: 9px 15px; font-size: 13px; color: #5b5480; white-space: nowrap; }

.hero {
  border-radius: 22px; overflow: hidden; margin-bottom: 18px; color: #fff;
  background: #1b1440 url("/static/img/hero-banner.webp") center 30% / cover no-repeat;
  box-shadow: 0 14px 34px rgba(60,30,140,.28);
}
.hero-inner { padding: 30px 34px; max-width: 640px; background: linear-gradient(90deg, rgba(16,10,44,.55), rgba(16,10,44,0) 75%); }
.hero h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.18; letter-spacing: -.4px; }
.hero h1 span { background: linear-gradient(90deg, #c4b5fd, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0 0 16px; color: #ddd6fe; font-size: 15px; line-height: 1.55; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-chips span { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); backdrop-filter: blur(6px); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; }

.create-grid { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 18px; align-items: start; }
.col-main, .col-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card { background: #fff; border: 1px solid #e9e4f8; border-radius: 20px; padding: 18px; box-shadow: 0 4px 18px rgba(90,70,180,.06); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head strong { font-size: 15.5px; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; }
.file-btn { cursor: pointer; }

textarea {
  width: 100%; border: 1.5px solid #e3ddf6; border-radius: 14px; padding: 13px 14px;
  font-size: 16px; line-height: 1.6; font-family: inherit; color: #221d38; resize: vertical; background: #fdfcff;
}
textarea:focus { outline: none; border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(167,139,250,.18); }
.counter { color: #857fb0; font-size: 13px; margin-top: 8px; }
.sample-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.sample-label { font-size: 13px; color: #857fb0; }
.sample-chip { border: 1.5px solid #e3ddf6; background: #fbfaff; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; color: #4c3a8f; }
.sample-chip:hover { border-color: #a78bfa; background: #f3efff; }

.custom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 26px; }
.slider-row { display: grid; grid-template-columns: 128px 1fr 44px; align-items: center; gap: 10px; padding: 7px 0; }
.slider-row label { font-size: 13.5px; color: #4a4370; }
.slider-row input[type="range"] { width: 100%; accent-color: #8b5cf6; }
.slider-val { font-size: 13px; color: #7c3aed; font-weight: 700; text-align: right; }
.custom-selects { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #4a4370; font-weight: 600; }
.field select {
  padding: 9px 11px; border: 1.5px solid #e3ddf6; border-radius: 11px; font-size: 14px;
  background: #fdfcff; color: #221d38; font-family: inherit; width: 100%;
}
.field select:disabled { opacity: .5; }

.clone-badge {
  background: #fdf2f8; border: 1.5px solid #f9a8d4; color: #9d174d; border-radius: 14px;
  padding: 11px 14px; font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.gen-btn { width: 100%; padding: 16px; font-size: 17px; border-radius: 16px; margin: 0; }
.status { min-height: 20px; margin: 2px 0 0; font-size: 14.5px; color: #4a4370; }
.status.error { color: #c02626; }
.hint { color: #857fb0; font-size: 13px; line-height: 1.55; }

/* ---------- thẻ giọng ---------- */
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-tabs.big { margin: 14px 0 16px; }
.ftab { border: 1.5px solid #e3ddf6; background: #fbfaff; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: #4c3a8f; }
.ftab.active { background: linear-gradient(90deg, #7c3aed, #c026d3); color: #fff; border-color: transparent; }
.voice-list { display: flex; flex-direction: column; gap: 8px; max-height: 430px; overflow-y: auto; padding-right: 2px; }
.voice-card {
  display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 15px;
  border: 1.5px solid #efeafc; background: #fff; cursor: pointer; text-align: left; width: 100%;
}
.voice-card:hover { border-color: #c4b5fd; }
.voice-card.selected { border-color: #8b5cf6; background: #f6f1ff; box-shadow: 0 4px 14px rgba(124,58,237,.14); }
.vava { width: 42px; height: 42px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 16px; position: relative; overflow: hidden; }
.vava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vinfo { flex: 1; min-width: 0; }
.vname { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 7px; }
.vbadge { font-size: 10px; background: #ede9fe; color: #6d28d9; border-radius: 999px; padding: 2px 7px; font-weight: 700; letter-spacing: .3px; }
.vbadge.free { background: #fef3c7; color: #b45309; }
.voice-divider { padding: 12px 8px 4px; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #b45309; }
.view-title.small { font-size: 19px; margin-top: 30px; }
#freeSection { margin-top: 6px; }
.vdesc { color: #857fb0; font-size: 12.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtags { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.vtags span { background: #f3f1fa; color: #6d6390; font-size: 11px; border-radius: 999px; padding: 2.5px 8px; }
.vplay {
  width: 34px; height: 34px; border-radius: 50%; flex: none; border: none; color: #fff;
  background: linear-gradient(135deg, #7c3aed, #c026d3); font-size: 12px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(147,51,234,.3);
}
.clone-cta {
  width: 100%; margin-top: 12px; padding: 11px; border-radius: 13px; font-size: 14px; font-weight: 700;
  border: 1.5px dashed #c4b5fd; background: #fbfaff; color: #6d28d9;
}
.clone-cta:hover { background: #f3efff; }

.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.voice-tile { background: #fff; border: 1.5px solid #e9e4f8; border-radius: 18px; padding: 16px; box-shadow: 0 4px 14px rgba(90,70,180,.05); }
.voice-tile .vava { width: 52px; height: 52px; font-size: 19px; }
.voice-tile .vname { font-size: 16px; margin-top: 10px; }
.voice-tile .vdesc { white-space: normal; font-size: 13px; }
.tile-actions { display: flex; gap: 8px; margin-top: 13px; }
.tile-actions .btn { flex: 1; text-align: center; }

/* ---------- các view phụ ---------- */
.view-title { font-size: 24px; margin: 4px 0 6px; }
.view-sub { color: #6d6390; margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; max-width: 720px; }
.clone-card { max-width: 640px; }
.upload-box {
  display: block; border: 2px dashed #c4b5fd; background: #fbfaff; border-radius: 16px;
  padding: 26px 16px; text-align: center; cursor: pointer; font-weight: 600; color: #6d28d9; margin-bottom: 12px;
}
.upload-box input { display: none; }
.upload-box:hover { background: #f3efff; }

.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #efeafc; border-radius: 14px; flex-wrap: wrap; }
.history-item .htext { flex: 1; min-width: 200px; }
.history-item .hname { font-size: 14px; font-weight: 600; }
.history-item .hmeta { color: #857fb0; font-size: 12.5px; margin-top: 2px; }
.history-item audio { height: 36px; max-width: 300px; flex: 1; min-width: 180px; }

.player-card audio { margin: 4px 0 10px; }
.player-card .hint { margin-bottom: 0; }

/* ---------- quản trị ---------- */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 7px; border-bottom: 1px solid #efeafc; vertical-align: top; }
.admin-table td .btn { margin: 0 4px 4px 0; }
.badge { display: inline-block; background: #ede9fe; color: #6d28d9; border-radius: 999px; padding: 1.5px 8px; font-size: 11px; font-weight: 700; margin-left: 6px; }
.badge.locked { background: #fee2e2; color: #b91c1c; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(24,16,54,.55); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 26px 14px; z-index: 60; }
.modal-card { background: #fff; border-radius: 20px; padding: 24px; width: 100%; max-width: 430px; position: relative; box-shadow: 0 24px 60px rgba(20,10,60,.35); }
.modal-card.terms-card { max-width: 620px; }
.modal-close { position: absolute; top: 12px; right: 12px; border: none; background: #f3f1fa; width: 32px; height: 32px; border-radius: 50%; font-size: 14px; }
.modal-title, .terms-title { margin: 0 34px 12px 0; font-size: 19px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { flex: 1; padding: 10px; border-radius: 11px; border: 1.5px solid #e3ddf6; background: #fbfaff; font-weight: 700; font-size: 14.5px; color: #4c3a8f; }
.tab.active { background: linear-gradient(90deg, #7c3aed, #c026d3); color: #fff; border-color: transparent; }
.auth-form label { display: block; font-size: 13.5px; font-weight: 600; color: #4a4370; margin-bottom: 11px; }
.auth-form input[type="text"], .auth-form input[type="password"] {
  width: 100%; margin-top: 5px; padding: 11px 12px; border: 1.5px solid #e3ddf6; border-radius: 11px; font-size: 16px; font-family: inherit;
}
.auth-error { color: #c02626; font-size: 13.5px; min-height: 18px; margin: 4px 0; }
.terms-check { display: flex !important; gap: 9px; align-items: flex-start; font-weight: 400 !important; }
.terms-check input { margin-top: 3px; }
.terms-body { max-height: 46vh; overflow-y: auto; font-size: 14px; line-height: 1.6; color: #3d365e; padding-right: 4px; }
.terms-body h3 { margin: 14px 0 5px; font-size: 14.5px; color: #221d38; }
.pro-list { margin: 0 0 12px; padding-left: 20px; line-height: 1.9; font-size: 14.5px; }
.settings-rows { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; font-size: 14.5px; }
.settings-rows .row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #f0ecfc; padding-bottom: 8px; }
.settings-rows .row span:first-child { color: #857fb0; }

.site-footer { color: #857fb0; font-size: 13px; text-align: center; padding: 20px 10px 16px; }

/* ---------- điện thoại ---------- */
@media (max-width: 1080px) {
  .create-grid { grid-template-columns: minmax(0, 1fr); }
  .voice-list { max-height: 320px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 14px; gap: 12px; }
  .side-nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .side-item { width: auto; white-space: nowrap; padding: 9px 13px; }
  .pro-card { display: none; }
  .side-user { margin-top: 0; }
  .main { padding: 14px 14px 4px; }
  .hero-inner { padding: 22px 20px; }
  .hero h1 { font-size: 25px; }
  .custom-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; }
  .quota-pill { order: 2; }
  .slider-row { grid-template-columns: 118px 1fr 40px; }
}
