/* KOL portal UI-kit styles. Extends the same phone-shell pattern as producer
   but with KOL-specific density and the calendar grid. */
@import url("../../colors_and_type.css");
@import url("https://unpkg.com/@tabler/icons-webfont@latest/dist/tabler-icons.min.css");

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #1B1B1F; font-family: var(--font-sans); height: 100%; }

:root { --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes fade-up { 0% { opacity: 0; transform: translateY(6px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes pulse-ring { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(2.4); opacity: 0; } }
.scroll > * { animation: fade-up 360ms var(--ease-out-quint) both; flex-shrink: 0; }
.scroll > *:nth-child(1) { animation-delay: 0ms; }
.scroll > *:nth-child(2) { animation-delay: 40ms; }
.scroll > *:nth-child(3) { animation-delay: 80ms; }
.scroll > *:nth-child(4) { animation-delay: 120ms; }
.scroll > *:nth-child(5) { animation-delay: 160ms; }
.scroll > *:nth-child(6) { animation-delay: 200ms; }
@media (prefers-reduced-motion: reduce) { .scroll > * { animation: none; } }

.live-dot {
  position: relative;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--thaihao-primary);
  display: inline-block; flex-shrink: 0;
}
.live-dot::after {
  content: ""; position: absolute; inset: 0;
  border-radius: 50%; background: var(--thaihao-primary);
  animation: pulse-ring 1.6s ease-out infinite;
}

.stage {
  min-height: 100vh;
  padding: 32px 0;
  display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-start; justify-content: center;
  background: linear-gradient(180deg, #1B1B1F 0%, #131316 100%);
}
.phone {
  width: 380px; height: 800px;
  background: var(--surface); border-radius: 36px;
  border: 8px solid #2A2A30; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.5);
  overflow: hidden; position: relative; display: flex; flex-direction: column;
}
.phone .status {
  height: 32px; padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--on-surface);
}
.phone .notch { position: absolute; left: 50%; top: 6px; width: 100px; height: 20px; background: #2A2A30; border-radius: 999px; transform: translateX(-50%); z-index: 5; }
.status .right { display: flex; gap: 6px; align-items: center; }

.viewport { flex: 1; min-height: 0; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }

.kol-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: var(--border-thin) solid var(--outline-variant);
}
.kol-topbar .me { display: flex; align-items: center; gap: 8px; }
.kol-topbar .me .pic { width: 32px; height: 32px; border-radius: 50%; background: var(--thaihao-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 13px; font-weight: 500; }
.kol-topbar .me .name { font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--on-surface); }
.kol-topbar .me .agency { font-family: var(--font-sans); font-size: 11px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.kol-topbar .spacer { flex: 1; }
.topbar-action { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.topbar-action:hover { background: var(--surface-container-low); }
.topbar-action i { font-size: 20px; color: var(--on-surface); }
.flag { font-size: 18px; }

.scroll { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.page-title { font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 500; color: var(--on-surface); margin: 0; }
.page-sub { font-family: var(--font-sans); font-size: 13px; color: var(--on-surface-variant); }

/* Earnings buckets */
.buckets { display: grid; grid-template-columns: 1fr; gap: 8px; }
.bucket {
  background: var(--surface-container-lowest);
  border: var(--border-thin) solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline;
  transition: transform 240ms var(--ease-out-quint), border-color 240ms var(--ease-out-quint), box-shadow 240ms var(--ease-out-quint);
  position: relative; overflow: hidden;
}
.bucket::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--gradient-primary); opacity: 0.7;
}
.bucket::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -30%; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(172, 0, 34, 0.08), transparent);
  pointer-events: none;
}
.bucket:hover { transform: translateY(-1px); border-color: var(--outline); box-shadow: 0 6px 18px -8px rgba(172, 0, 34, 0.2); }
.bucket:hover::after { animation: ec-sheen 1000ms var(--ease-out-quint) both; }
.bucket .lbl { font-family: var(--font-sans); font-size: 11px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--on-surface-variant); grid-column: 1 / 2; }
.bucket .val { font-family: var(--font-mono); font-size: 22px; font-weight: 500; color: var(--on-surface); grid-column: 1 / 2; }
.bucket .iso { font-family: var(--font-mono); font-size: 12px; color: var(--on-surface-variant); margin-left: 4px; }
.bucket .pill-area { grid-row: 1 / 3; grid-column: 2 / 3; align-self: center; }
.bucket .fx { grid-column: 1 / 3; font-family: var(--font-mono); font-size: 11px; color: var(--on-surface-variant); }
.bucket .audit-link { color: var(--thaihao-primary); font-size: 11px; font-family: var(--font-sans); display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: var(--radius-full); font-family: var(--font-sans); font-size: 12px; font-weight: 500; border: var(--border-thin) solid; white-space: nowrap; }
.pill.success { background: var(--color-background-success); color: var(--color-text-on-success); border-color: var(--color-border-success); }
.pill.warning { background: var(--color-background-warning); color: var(--color-text-on-warning); border-color: var(--color-border-warning); }
.pill.info    { background: var(--color-background-info);    color: var(--color-text-on-info);    border-color: var(--color-border-info); }
.pill.danger  { background: var(--color-background-danger);  color: var(--color-text-on-danger);  border-color: var(--color-border-danger); }
.pill.primary { background: var(--thaihao-primary-tint); color: var(--thaihao-primary); border-color: var(--thaihao-primary); }
.pill.sm { height: 18px; padding: 0 7px; font-size: 11px; }

/* Performance grid */
.perf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.perf { background: var(--surface-container-lowest); border: var(--border-thin) solid var(--outline-variant); border-radius: var(--radius-lg); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; transition: transform 200ms var(--ease-out-quint), border-color 200ms var(--ease-out-quint), box-shadow 200ms var(--ease-out-quint); }
.perf:hover { transform: translateY(-1px); border-color: var(--outline); box-shadow: 0 6px 16px -8px rgba(0,0,0,0.1); }
.perf:active { transform: scale(0.98); }
.perf .lbl { font-family: var(--font-sans); font-size: 11px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--on-surface-variant); }
.perf .val { font-family: var(--font-mono); font-size: 18px; font-weight: 500; }
.perf .delta { font-family: var(--font-sans); font-size: 11px; color: var(--color-text-on-success); display: inline-flex; align-items: center; gap: 2px; }
.perf .delta.down { color: var(--color-text-on-danger); }

/* Section */
.section { display: flex; flex-direction: column; gap: 8px; }
.section-head { display: flex; align-items: baseline; gap: 8px; }
.section-head h2 { font-family: var(--font-sans); font-size: 14px; font-weight: 500; margin: 0; }
.section-head .more { margin-left: auto; color: var(--thaihao-primary); font-family: var(--font-sans); font-size: 12px; }

.list { background: var(--surface-container-lowest); border: var(--border-thin) solid var(--outline-variant); border-radius: var(--radius-lg); overflow: hidden; }
.list-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; padding: 12px 14px; border-bottom: var(--border-thin) solid var(--outline-variant); align-items: center; cursor: pointer; transition: background 150ms var(--ease-out-quint); }
.list-row:active { background: var(--surface-container-low); }
.list-row:last-child { border-bottom: none; }
.list-row .ic { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-container-low); display: flex; align-items: center; justify-content: center; color: var(--on-surface); }
.list-row .ic i { font-size: 18px; }
.list-row .title { font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--on-surface); }
.list-row .sub { font-family: var(--font-sans); font-size: 12px; color: var(--on-surface-variant); }
.list-row .right { text-align: right; }
.list-row .num { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--on-surface); }

/* Calendar week view */
.cal-head {
  display: grid; grid-template-columns: 40px repeat(7, 1fr); gap: 0;
  padding: 8px 0; border-bottom: var(--border-thin) solid var(--outline-variant);
  background: var(--surface);
  position: sticky; top: 0;
}
.cal-head .col { font-family: var(--font-sans); font-size: 11px; color: var(--on-surface-variant); text-align: center; }
.cal-head .col .d { font-family: var(--font-display); font-size: 16px; font-weight: 500; color: var(--on-surface); }
.cal-head .col.today .d { color: var(--thaihao-primary); }

.cal-grid { display: grid; grid-template-columns: 40px repeat(7, 1fr); }
.cal-grid .hr { font-family: var(--font-mono); font-size: 10px; color: var(--on-surface-variant); text-align: right; padding: 6px 6px 0 0; border-right: var(--border-thin) solid var(--outline-variant); }
.cal-grid .cell { height: 36px; border-right: var(--border-thin) solid var(--outline-variant); border-bottom: var(--border-thin) solid var(--outline-variant); position: relative; }
.cal-grid .cell:nth-last-child(-n+7) { border-bottom: none; }
.cal-grid .booking {
  position: absolute; left: 2px; right: 2px;
  border-radius: 4px;
  font-family: var(--font-sans); font-size: 10px; font-weight: 500;
  padding: 4px 6px;
  cursor: pointer;
  overflow: hidden;
  border: 0.5px solid;
}
.cal-grid .booking.confirmed { background: var(--thaihao-primary-tint); color: var(--thaihao-primary); border-color: var(--thaihao-primary); }
.cal-grid .booking.pending   { background: var(--color-background-info);    color: var(--color-text-on-info);    border-color: var(--color-border-info); }
.cal-grid .booking.unavail   { background: var(--surface-container);        color: var(--on-surface-variant);    border-color: var(--outline-variant); }

/* Bottom tab nav */
.bottombar { height: 64px; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface-container-lowest); border-top: var(--border-thin) solid var(--outline-variant); padding-bottom: 4px; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--on-surface-variant); cursor: pointer; transition: color 160ms var(--ease-out-quint), transform 160ms var(--ease-out-quint); }
.tab:active { transform: scale(0.94); }
.tab i { font-size: 22px; }
.tab span { font-family: var(--font-sans); font-size: 10px; }
.tab.active { color: var(--thaihao-primary); }

/* Bottom sheet */
.sheet-scrim { position: absolute; inset: 0; background: rgba(0,0,0,0.40); z-index: 8; opacity: 0; pointer-events: none; transition: opacity var(--motion-default); }
.sheet-scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 9; background: var(--surface-container-lowest); border-top-left-radius: var(--radius-xl); border-top-right-radius: var(--radius-xl); transform: translateY(100%); transition: transform var(--motion-slow); padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 12px; max-height: 520px; overflow: auto; }
.sheet.open { transform: translateY(0); }
.sheet .handle { width: 36px; height: 4px; border-radius: 2px; background: var(--outline-variant); margin: -6px auto 8px; }
.sheet h3 { font-family: var(--font-sans); font-size: 15px; font-weight: 500; margin: 0; }

.line { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 8px 0; border-bottom: var(--border-thin) solid var(--outline-variant); }
.line:last-child { border-bottom: none; }
.line .k { font-family: var(--font-sans); font-size: 12px; color: var(--on-surface-variant); }
.line .v { font-family: var(--font-sans); font-size: 13px; color: var(--on-surface); }
.line .v.mono { font-family: var(--font-mono); }

.btn-primary { height: 44px; padding: 0 16px; background: var(--gradient-primary); color: #fff; border-radius: var(--radius); font-family: var(--font-sans); font-size: 14px; font-weight: 500; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 12px -4px rgba(172, 0, 34, 0.35); transition: transform 180ms var(--ease-out-quint), box-shadow 180ms var(--ease-out-quint); }
.btn-primary:active { background: var(--thaihao-primary-pressed); transform: translateY(1px); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -6px rgba(172, 0, 34, 0.45); }
.btn-secondary { height: 44px; padding: 0 16px; background: var(--surface-container-lowest); color: var(--on-surface); border-radius: var(--radius); border: var(--border-default) solid var(--outline-variant); font-family: var(--font-sans); font-size: 14px; font-weight: 500; cursor: pointer; }

.stage-label { font-family: var(--font-sans); font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.7); text-align: center; margin-bottom: 8px; letter-spacing: 0.05em; text-transform: uppercase; }
.phone-wrap { display: flex; flex-direction: column; align-items: center; }
.kit-header { width: 100%; text-align: center; padding-top: 6px; }
.kit-header h1 { color: #fff; font-family: var(--font-display); font-weight: 500; font-size: 18px; margin: 0; }
.kit-header p { color: rgba(255,255,255,0.5); font-family: var(--font-sans); font-size: 12px; margin: 4px 0 16px; }
