/* Форма добавления / редактирования карточки (общая для сайта и админки).
   Цвета берутся из переменных --cf-* (задаются в style.css и admin.css). */
[hidden] { display: none !important; }
.cf { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
@media (min-width: 1000px) { .cf { grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; } }
.cf-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cf-step { background: var(--cf-card); border: 1px solid var(--cf-line); border-radius: calc(var(--r) + 6px); padding: 18px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 700px) { .cf-step { padding: 24px; } }
.cf-step-h { display: flex; gap: 14px; align-items: flex-start; }
.cf-step-h h2 { font-size: 18px; line-height: 1.25; margin: 0; font-weight: 700; }
.cf-step-h p { margin: 2px 0 0; font-size: 14px; color: var(--cf-muted); }
.cf-num { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--cf-accent); color: var(--cf-on-accent); font-weight: 800; font-size: 15px; }

.cf .f-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cf .f-row > label { font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cf .f-hint { margin: 0; font-size: 13px; color: var(--cf-muted); line-height: 1.45; }
.cf .f-err { margin: 0; font-size: 13px; color: var(--cf-red); }
.f-count { font-size: 12px; color: var(--cf-muted); font-weight: 500; }
.cf input:not([type=checkbox]):not([type=radio]):not([type=file]), .cf select, .cf textarea {
  width: 100%; height: 50px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--cf-line2);
  background: var(--cf-input); color: var(--cf-ink); font-size: 16px; line-height: 1.3; margin: 0;
}
.cf textarea { height: auto; min-height: 150px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.cf select { appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--cf-muted) 50%), linear-gradient(135deg, var(--cf-muted) 50%, transparent 50%);
  background-position: calc(100% - 21px) 22px, calc(100% - 16px) 22px; background-size: 5px 5px; background-repeat: no-repeat; }
.cf input:focus, .cf select:focus, .cf textarea:focus { outline: none; border-color: var(--cf-accent-line); box-shadow: 0 0 0 3px var(--cf-accent-soft); }
.cf input::placeholder, .cf textarea::placeholder { color: var(--cf-muted); opacity: .8; }

/* Переключатели */
.cf-seg { display: grid; gap: 6px; padding: 4px; background: var(--cf-panel); border-radius: calc(var(--r) + 4px); }
.cf-seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cf-seg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cf-opt { display: block; position: relative; cursor: pointer; }
.cf-opt input { position: absolute; opacity: 0; pointer-events: none; }
.cf-opt span { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: var(--r); font-weight: 600; font-size: 15px; color: var(--cf-muted); transition: background .15s, color .15s; white-space: nowrap; }
.cf-opt:hover span { color: var(--cf-ink); }
.cf-opt input:checked + span { background: var(--cf-card); color: var(--cf-ink); box-shadow: 0 1px 3px rgba(0,0,0,.18), inset 0 0 0 1px var(--cf-accent-line); }
.cf-opt input:checked + span .ic { color: var(--cf-accent-text); }
.cf-opt input:focus-visible + span { outline: 2px solid var(--cf-accent); outline-offset: 2px; }

/* Ссылка + кнопка */
.cf-fetch { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 520px) { .cf-fetch { grid-template-columns: minmax(0, 1fr) auto; } }
.cf-fetch .btn { height: 50px; min-height: 50px; }

/* Фото */
.cf-photo { display: flex; gap: 16px; align-items: center; }
.cf-drop { position: relative; width: 104px; height: 104px; flex: none; border-radius: calc(var(--r) + 4px); border: 2px dashed var(--cf-line2); background: var(--cf-panel); display: grid; place-items: center; overflow: hidden; cursor: pointer; transition: border-color .15s; }
.cf-drop:hover { border-color: var(--cf-accent-line); }
.cf-drop img { width: 100%; height: 100%; object-fit: cover; }
.cf-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cf-drop-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--cf-muted); font-size: 13px; font-weight: 600; }
.cf-photo-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cf-photo-info b { font-size: 14px; }

.cf-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 600px) { .cf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cf-span2 { grid-column: 1 / -1; } }

.cf-submit { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 999px) { .cf-submit .f-hint { text-align: center; } }


/* Предпросмотр */
.cf-side { display: none; }
@media (min-width: 1000px) { .cf-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; } }
.cf-side-t { margin: 0; font-size: 13px; color: var(--cf-muted); }
.cf-preview { pointer-events: none; max-width: 300px; }
.cf-tips { list-style: none; margin: 0; padding: 14px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--cf-line); border-radius: calc(var(--r) + 4px); font-size: 14px; color: var(--cf-muted); }
.cf-tips li { display: flex; gap: 8px; align-items: flex-start; }
.cf-tips .ic { color: var(--cf-accent-text); margin-top: 2px; }
.cf .check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.cf .check input { width: 18px; height: 18px; margin: 0; accent-color: var(--cf-accent); }
