:root {
    --bg: #FBFBFB;
    --dark: #1A1A1A;
    --accent: #FF5C00;
    --light: #F6F6F6;
    --gray: #767676;
    --border: #DBDCDE;
    --white: #FFFFFF;
    --font: 'Wix Madefor Display', system-ui, sans-serif;
    --radius: 30px;
    --radius-sm: 20px;
    --radius-xs: 12px;
    --max-w: 1200px;
    --transition: all 0.3s ease-in-out;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: 16px;
    color: var(--dark);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* === LAYOUT === */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 40px;
}

.container--narrow {
    max-width: 800px;
}

/* === HEADER === */
.header {
    padding: 24px 0;
    border-bottom: 2px solid var(--light);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header__logo {
    height: 32px;
}

.header__nav {
    display: flex;
    gap: 12px;
}

.header__link {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 100px;
    transition: var(--transition);
}

.header__link:hover {
    color: var(--dark);
    background: var(--light);
}

.header__link--active {
    color: var(--dark);
    font-weight: 600;
}

/* === TYPOGRAPHY === */
h1 {
    font-size: clamp(36px, 4.5vw, 56px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1px;
}

h2 {
    font-size: clamp(28px, 3.5vw, 40px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

h3 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--dark);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    background: var(--dark);
    color: var(--white);
}

.btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.btn--outline {
    background: transparent;
    color: var(--dark);
}

.btn--outline:hover {
    background: var(--dark);
    color: var(--white);
    border-color: var(--dark);
}

.btn--small {
    font-size: 13px;
    padding: 10px 20px;
    border-radius: var(--radius-xs);
}

.btn--danger {
    border-color: #E53E3E;
    color: #E53E3E;
    background: transparent;
}

.btn--danger:hover {
    background: #E53E3E;
    color: var(--white);
    border-color: #E53E3E;
}

/* === FORM ELEMENTS === */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.form-hint {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    font-family: var(--font);
    font-size: 15px;
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--white);
    color: var(--dark);
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
}

.form-input::placeholder {
    color: var(--border);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

/* === CARDS === */
.card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--dark);
}

.card--dark {
    background: var(--dark);
    border-color: var(--dark);
    color: var(--white);
}

/* === SECTION BLOCK (editor) === */
.section-block {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.section-block:hover {
    border-color: var(--dark);
}

.section-block__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--light);
}

.section-block__title {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-block__num {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--dark);
    color: var(--white);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* === MODULE & WORKSHOP === */
.module-card {
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 28px;
    margin-bottom: 16px;
}

.module-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.module-card__label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
}

.workshop-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 20px;
    margin-bottom: 12px;
}

.workshop-card__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray);
    margin-bottom: 4px;
}

.workshop-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* === ADD BUTTONS (bottom-sticky) === */
.add-btn-bottom {
    margin-top: 8px;
    text-align: center;
}

/* === TRAINER SELECTOR === */
.trainer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.trainer-card {
    padding: 24px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.trainer-card__info {
    flex: 1;
}

.trainer-card:hover {
    border-color: var(--dark);
}

.trainer-card.selected {
    border-color: var(--accent);
    background: rgba(255, 92, 0, 0.04);
}

.trainer-card__check {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.trainer-card.selected .trainer-card__check {
    background: var(--accent);
    border-color: var(--accent);
}

.trainer-card__photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
    border: 2px solid var(--border);
}

.trainer-card__name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.trainer-card__grade {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    padding: 4px 12px;
    border: 1.5px solid var(--accent);
    border-radius: 100px;
    margin-bottom: 8px;
}

.trainer-card__role {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 8px;
}

.trainer-card__price-input {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* === FORMAT TOGGLE === */
.format-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--light);
    border-radius: var(--radius-xs);
    margin-bottom: 24px;
}

.format-toggle__btn {
    flex: 1;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--gray);
    cursor: pointer;
    transition: var(--transition);
}

.format-toggle__btn:hover {
    color: var(--dark);
}

.format-toggle__btn--active {
    background: var(--white);
    color: var(--dark);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.workshop-card--standalone {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    margin-bottom: 16px;
    border-left: 4px solid var(--accent);
}

/* === BLOCK CARDS (product format) === */
.blocks-section {
    margin-bottom: 8px;
}

.block-card {
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 8px;
}

.block-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.block-card__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

/* === TEMPLATE PICKER DROPDOWN === */
.tpl-picker-wrap {
    position: relative;
}

.tpl-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    background: var(--white);
    border: 2px solid var(--dark);
    border-radius: var(--radius-xs);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 50;
    padding: 6px;
    animation: tplIn 0.15s ease-out;
}

@keyframes tplIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tpl-dropdown__item {
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.tpl-dropdown__item:hover {
    background: var(--light);
}

.tpl-dropdown__item + .tpl-dropdown__item {
    border-top: 1px solid var(--light);
}

.tpl-dropdown__name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

.tpl-dropdown__meta {
    font-size: 12px;
    color: var(--gray);
    line-height: 1.4;
}

/* === TEMPLATE PICKER DROPDOWN === */
.tpl-picker-wrap {
    position: relative;
}

.tpl-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--white);
    border: 2px solid var(--dark);
    border-radius: var(--radius-xs);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 50;
    padding: 6px;
    animation: tplIn 0.15s ease-out;
}

@keyframes tplIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tpl-dropdown__section {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray);
    padding: 10px 14px 6px;
}

.tpl-dropdown__divider {
    height: 1px;
    background: var(--border);
    margin: 6px 10px;
}

.tpl-dropdown__item {
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.tpl-dropdown__item:hover {
    background: var(--light);
}

.tpl-dropdown__item-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.tpl-dropdown__item-content {
    flex: 1;
    min-width: 0;
}

.tpl-dropdown__name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.3;
}

.tpl-dropdown__meta {
    font-size: 12px;
    color: var(--gray);
    line-height: 1.4;
}

.tpl-dropdown__delete {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--border);
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.tpl-dropdown__delete:hover {
    background: #E53E3E;
    color: var(--white);
}

/* === ICON BUTTONS === */
.btn--icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    position: relative;
}

.btn--icon::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: var(--white);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.btn--icon:hover::after {
    opacity: 1;
}

/* === SAVE STATUS === */
.save-status {
    font-size: 13px;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 6px;
}

.save-status--saving { color: var(--accent); }
.save-status--saved { color: #38A169; }
.save-status--error { color: #E53E3E; }

/* === HOME PAGE === */
.home {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home__card {
    text-align: center;
    max-width: 480px;
    width: 100%;
}

.home__card h1 {
    margin-bottom: 12px;
}

.home__card p {
    color: var(--gray);
    margin-bottom: 32px;
}

.home__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.home__slug-preview {
    font-size: 13px;
    color: var(--gray);
    margin-top: 4px;
}

.home__slug-preview span {
    color: var(--accent);
    font-weight: 600;
}

.home__links {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 24px;
}

.home__nav-link {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.home__nav-link:hover {
    text-decoration: underline;
}

.home__error {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    padding: 16px 20px;
    background: rgba(255, 92, 0, 0.08);
    border: 2px solid var(--accent);
    border-radius: var(--radius-xs);
    display: none;
}

/* === EDITOR LAYOUT === */
.editor {
    padding: 40px 0 100px;
}

.editor__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.editor__top-left h2 {
    margin-bottom: 4px;
}

.editor__link {
    font-size: 14px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.editor__link:hover {
    text-decoration: underline;
}

.editor__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* === TEMPLATE MANAGEMENT PAGE === */
.tpl-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.tpl-empty h3 {
    color: var(--dark);
    margin-bottom: 8px;
}

.tpl-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    transition: var(--transition);
}

.tpl-card:hover {
    border-color: var(--dark);
}

.tpl-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    gap: 16px;
}

.tpl-card__header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tpl-card__title {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tpl-card__duration {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(255, 92, 0, 0.08);
    padding: 3px 10px;
    border-radius: 100px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tpl-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.tpl-card__status {
    font-size: 12px;
    min-width: 80px;
    text-align: right;
}

.tpl-card__status--saving { color: var(--accent); }
.tpl-card__status--saved { color: #38A169; }
.tpl-card__status--error { color: #E53E3E; }

.tpl-card__body {
    padding: 0 24px 24px;
}

.tpl-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

/* === BURGER MENU === */
.burger {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: none;
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.burger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--dark);
    position: relative;
    transition: var(--transition);
}

.burger span::before,
.burger span::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: var(--dark);
    left: 0;
    transition: var(--transition);
}

.burger span::before { top: -6px; }
.burger span::after { top: 6px; }

.burger.open span { background: transparent; }
.burger.open span::before { top: 0; transform: rotate(45deg); }
.burger.open span::after { top: 0; transform: rotate(-45deg); }

/* === RESPONSIVE — TABLET (768px) === */
@media (max-width: 768px) {
    .container { padding: 0 20px; }
    .section-block { padding: 24px; }
    .trainer-grid { grid-template-columns: 1fr; }
    .editor__top { flex-direction: column; align-items: flex-start; gap: 16px; }
    .tpl-dropdown { width: 300px; }
}

/* === RESPONSIVE — MOBILE (480px) === */
@media (max-width: 480px) {
    .container { padding: 0 16px; }

    /* Burger menu */
    .burger { display: flex; }
    .header__nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        border-bottom: 2px solid var(--light);
        padding: 12px 16px;
        flex-direction: column;
        gap: 4px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    }
    .header__nav.open { display: flex; }
    .header { position: sticky; top: 0; z-index: 100; }
    .header__inner { position: relative; }
    .header__link {
        padding: 12px 16px;
        font-size: 15px;
        border-radius: var(--radius-xs);
    }
    .header__link:hover,
    .header__link--active {
        background: var(--light);
    }

    /* Section blocks */
    .section-block { padding: 20px; margin-bottom: 16px; }
    .section-block__header { margin-bottom: 16px; padding-bottom: 12px; }
    .section-block__title { font-size: 17px; gap: 10px; }

    /* Module & workshop cards */
    .module-card { padding: 20px; }
    .module-card__header { flex-wrap: wrap; gap: 10px; }
    .workshop-card { padding: 16px; }
    .workshop-card__header { flex-wrap: wrap; gap: 8px; }
    .workshop-card--standalone { padding: 20px; }

    /* Block cards */
    .block-card { padding: 12px; }
    .block-card__header { flex-wrap: wrap; gap: 6px; }

    /* Buttons */
    .btn { padding: 12px 20px; font-size: 14px; }
    .btn--small { padding: 10px 16px; font-size: 13px; }

    /* Editor header */
    .editor__actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .editor { padding: 24px 0 80px; }
    .editor__top { margin-bottom: 20px; }

    /* Trainer grid */
    .trainer-grid { grid-template-columns: 1fr; gap: 12px; }
    .trainer-card { padding: 20px; }

    /* Forms */
    .form-input { padding: 12px 16px; font-size: 14px; }
    .form-group { margin-bottom: 16px; }

    /* Format toggle */
    .format-toggle { flex-direction: column; }
    .format-toggle__btn { padding: 10px 12px; font-size: 12px; }

    /* Template picker */
    .tpl-dropdown { width: calc(100vw - 32px); right: -16px; }

    /* Card */
    .card { padding: 24px; }

    /* Template card */
    .tpl-card__header { padding: 16px; flex-wrap: wrap; }
    .tpl-card__body { padding: 0 16px 16px; }
    .tpl-card__actions { flex-wrap: wrap; }

    /* Home page */
    .home { padding: 0 16px; }
    .home__card { max-width: 100%; }
    .home__links { flex-direction: column; gap: 12px; }
    .home__nav-link { font-size: 14px; }

    /* Template section headers */
    .tpl-section-header { flex-wrap: wrap; }

    /* Editor: hide secondary buttons on mobile */
    .editor__btn-desktop { display: none; }
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--dark);
    color: var(--white);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 10000;
    pointer-events: none;
}
.toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === COMPLETION SECTION === */
.section-block--completion { border-left: 4px solid #22c55e; }
.completion-checklist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.completion-check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--gray); }
.completion-check--done { color: var(--dark); }
.completion-check__icon { width: 20px; text-align: center; }
.completion-check--done .completion-check__icon { color: #22c55e; font-weight: 700; }
.completion-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* === EDITOR TITLE GENITIVE INPUT === */
.editor__top-right {
    flex: 1;
    max-width: 360px;
    margin-left: 24px;
}
.form-input--inline {
    font-size: 13px;
    padding: 8px 14px;
}
