/* Сайт v3 — базовые элементы (brandbook 10.1). */
/* Атрибут hidden всегда прячет элемент, даже если у класса свой display (кнопки .v3-btn и т. п.) */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--text); font: 400 var(--fs-body)/1.5 var(--ui); }
a { color: var(--purple-deep); }
::selection { background: color-mix(in srgb, var(--purple) 32%, transparent); }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 3px; }

/* Переключатель темы — копия ce-switch из lesson_notes_editorial.css */
.ce-switch { border: 0; background: none; padding: 4px; width: 76px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 25px; cursor: pointer; }
.ce-switch__track { width: 66px; height: 35px; border-radius: 30px; display: flex; align-items: center; padding: 4px; background: #e9dfea; border: 1px solid #dfd1e1; transition: background var(--t-panel), border-color var(--t-panel); }
.ce-switch__thumb { width: 27px; height: 27px; display: grid; place-items: center; position: relative; border-radius: 50%; background: #fffdf9; color: #c79b52; box-shadow: 0 3px 9px rgba(88, 64, 84, .09); transition: transform var(--t-panel) cubic-bezier(.25, .8, .2, 1), background var(--t-panel), color var(--t-panel); }
.ce-switch__thumb svg { position: absolute; transition: transform var(--t-panel), opacity .18s; }
.ce-switch__moon { opacity: 0; transform: rotate(-40deg); }
html[data-theme="dark"] .ce-switch__track { background: #423748; border-color: #53465a; }
html[data-theme="dark"] .ce-switch__thumb { background: #76647e; color: #f0d195; transform: translateX(30px); box-shadow: 0 2px 8px rgba(18, 11, 29, .29); }
html[data-theme="dark"] .ce-switch__sun { opacity: 0; transform: rotate(40deg); }
html[data-theme="dark"] .ce-switch__moon { opacity: 1; transform: rotate(0); }

/* Поля */
.v3-field { display: block; margin-bottom: 16px; }
.v3-field__label { display: block; font-size: var(--fs-label); font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.v3-field__hint { display: block; font-size: var(--fs-secondary); color: var(--muted); margin-top: 8px; }
.v3-input { display: flex; align-items: center; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-m); height: 44px; padding: 0 4px 0 12px; transition: border-color var(--t-hover); }
.v3-input input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: var(--text); outline: none; height: 100%; }
.v3-input:focus-within { outline: 3px solid var(--honey); outline-offset: 3px; border-color: var(--purple); }
.v3-input.is-invalid { border-color: var(--error-line); }

/* Глазик пароля: клик показывает, второй клик скрывает */
.v3-eye { width: 36px; height: 36px; flex: none; border: 0; background: none; color: var(--subtle); border-radius: var(--radius-s); cursor: pointer; display: grid; place-items: center; transition: color var(--t-hover); }
.v3-eye:hover { color: var(--text); }
.v3-eye[aria-pressed="true"] { color: var(--purple-deep); }
.v3-eye svg { width: 20px; height: 20px; }
.v3-eye__off, .v3-eye[aria-pressed="true"] .v3-eye__on { display: none; }
.v3-eye[aria-pressed="true"] .v3-eye__off { display: block; }

/* Кнопки */
.v3-btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px; border-radius: var(--radius-m); font: 600 var(--fs-body) var(--ui); cursor: pointer; text-decoration: none; transition: background var(--t-hover), color var(--t-hover); }
.v3-btn--primary { border: 0; background: var(--purple-deep); color: var(--on-accent); }
.v3-btn--primary:hover { background: var(--purple); }
.v3-btn--secondary { border: 1px solid var(--line); background: none; color: var(--muted); }
.v3-btn--secondary:hover { background: var(--surface-soft); color: var(--text); }

/* Плашки сообщений */
.v3-msg { border-radius: var(--radius-m); padding: 12px 16px; font-size: 14px; margin-bottom: 16px; }
.v3-msg--error { background: var(--error-bg); color: var(--error-text); }
.v3-msg--warn { background: var(--honey-soft); color: var(--honey-text); }
.v3-msg--ok { background: var(--ok-bg); color: var(--ok-text); }

/* Автозаполнение браузера: Chrome красит поле своим голубым фоном.
   Перекрашиваем в фон поля, чтобы заполненное поле выглядело как обычное. */
.v3-input input:-webkit-autofill,
.v3-input input:-webkit-autofill:hover,
.v3-input input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--paper-2) inset;
  box-shadow: 0 0 0 1000px var(--paper-2) inset;
  transition: background-color 9999s ease-out 0s;
}

/* Окна подтверждения v3 (dialog.js) */
.v3-dialog { width: min(460px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); color: var(--text); box-shadow: var(--shadow-raise); padding: 24px; }
.v3-dialog::backdrop { background: rgba(34, 31, 39, .45); }
.v3-dialog__title { font: 700 var(--fs-block)/1.3 var(--ui); margin: 0 0 8px; }
.v3-dialog__text { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.v3-dialog__check { margin-bottom: 16px; }
.v3-dialog__rows { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-m); background: var(--paper-2); display: grid; gap: 8px; }
.v3-dialog__rows[hidden] { display: none; }
.v3-dialog__rows > div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; font-size: var(--fs-secondary); }
.v3-dialog__rows dt { color: var(--muted); }
.v3-dialog__rows dd { margin: 0; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.v3-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }
.v3-btn--danger { background: var(--error-text); color: #fff; border: 0; }
.v3-btn--danger:hover { background: var(--error-line); }
.v3-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Свой выпадающий список (cheese_select) в оформлении v3 */
[data-ui="v3"] .cs__head { min-height: 44px; padding: 0 12px; background: var(--paper-2); border-radius: var(--radius-m); font: inherit; }
[data-ui="v3"] .cs__list { background: var(--surface); border-radius: var(--radius-m); }
[data-ui="v3"] .cs__item { font: inherit; padding: 9px 12px; }
.v3-input .cs { flex: 1; align-self: stretch; min-width: 0; }
.v3-input .cs__head { height: 100%; min-height: 0; padding: 0 8px 0 0; border: 0; background: none; }
.v3-input .cs__head:focus-visible { outline: none; }
.v3-input:has(.cs.is-open) { border-color: var(--purple); }
.v3-input:has(.cs.is-invalid) { border-color: var(--error-line); }
.v3-input .cs__list { left: -13px; top: calc(100% + 6px); min-width: calc(100% + 17px); }
.v3-dialog__answer { width: 100%; box-sizing: border-box; margin: 4px 0 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper-2); color: var(--text); font: inherit; resize: vertical; min-height: 96px; }
.v3-dialog__answer:focus { outline: 3px solid var(--honey); outline-offset: 3px; border-color: var(--purple); }
.v3-dialog__answer[hidden] { display: none; }
