/* ============================================
   Б-Запись SPA — Стили дашборда
   ============================================ */

/* Дашборд — переопределение #app */
#app.dashboard-mode {
    display: block;
    min-height: 100vh;
    padding: 0;
    align-items: stretch;
}

body.dashboard-body {
    background: #f5f5f5;
    /* padding-top не нужен: header — sticky, сам занимает место в потоке.
       padding-bottom — компенсация fixed bottom-nav (mobile-only). */
    padding-bottom: 90px;
}

@media (max-width: 767px) {
    body.dashboard-body {
        padding-bottom: 100px;
    }
}


/* ===== MAIN CONTENT ===== */
.main-content { max-width: 600px; margin: 0 auto; padding: 16px 20px; }

/* ===== CITY SELECTOR ===== */
.city-selector {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-bottom: 16px; cursor: pointer; user-select: none;
}
.city-selector-icon { width: 20px; height: 20px; stroke: var(--red); flex-shrink: 0; }
.city-selector-text { font-size: 16px; font-weight: 500; color: var(--text); transition: color 0.15s; }
.city-selector:hover .city-selector-text { color: var(--red); }

/* ===== SEARCH ===== */
.search-wrapper { position: relative; margin-bottom: 16px; }
.search-wrapper svg {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    stroke: #999; width: 18px; height: 18px;
}
.search-input {
    width: 100%; padding: 12px 12px 12px 40px; border: 1px solid #e0e0e0;
    border-radius: 12px; font-size: 14px; background: #fff; outline: none;
}
.search-input:focus { border-color: var(--red); }

/* ===== SPHERES ===== */
.spheres-carousel-wrapper { position: relative; margin-bottom: 16px; }
.spheres-carousel {
    display: flex; gap: 10px; overflow-x: auto; scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none; padding-bottom: 4px;
}
.spheres-carousel::-webkit-scrollbar { display: none; }
.sphere-chip {
    display: flex; align-items: center; gap: 10px; padding: 14px 22px;
    background: #f8f8f8; border: 1px solid #e0e0e0; border-radius: 14px;
    cursor: pointer; transition: all 0.15s; font-size: 15px; font-weight: 500;
    color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; user-select: none;
}
.sphere-chip:hover, .sphere-chip.active { border-color: var(--red); background: #fdf2f5; color: var(--red); }
.sphere-chip img { width: 24px; height: 24px; filter: brightness(0) saturate(100%); transition: filter 0.15s; }
.sphere-chip:hover img, .sphere-chip.active img { filter: none; }

/* ===== PROJECTS ===== */
.project-list { display: flex; flex-direction: column; gap: 12px; }
.project-card {
    display: flex; align-items: center; gap: 12px; padding: 14px;
    background: #fff; border-radius: 14px; border: 1px solid var(--border);
    box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s;
}
.project-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.project-card-icon {
    width: 44px; height: 44px; border-radius: 10px; background: #f8f8f8;
    display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.project-card-icon img { width: 100%; height: 100%; object-fit: cover; }
.project-card-info { flex: 1; min-width: 0; }
.project-card-name { font-size: 15px; font-weight: 600; }
.project-card-address { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.project-card-btn {
    padding: 8px 14px; background: var(--red); color: #fff;
    border: none; border-radius: 8px; font-size: 12px; font-weight: 600;
    cursor: pointer; white-space: nowrap; transition: opacity 0.15s;
}
.project-card-btn:hover { opacity: 0.9; }

/* ===== BOOKING TABS ===== */
.booking-tabs { display: flex; gap: 0; background: #f5f5f5; border-radius: 15px; padding: 6px; margin-bottom: 16px; }
.booking-tab {
    flex: 1; padding: 14px 32px; border-radius: 12px; font-size: 18px; font-weight: 500;
    border: none; background: transparent; color: var(--text-secondary);
    cursor: pointer; transition: all 0.2s; white-space: nowrap; text-align: center;
}
.booking-tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.booking-tab-content { display: none; }
.booking-tab-content.active { display: block; }

/* ===== BOOKING CARDS ===== */
.booking-card-new {
    background: #fff; border-radius: 20px; margin-bottom: 12px;
    border: 1px solid #edf2f7; overflow: hidden;
}
.booking-collar { background: #f8fafc; padding: 14px 16px; border-bottom: 1px solid #edf2f7; }
.booking-collar-left { display: flex; align-items: center; gap: 12px; }
.booking-collar-avatar {
    width: 48px; height: 48px; border-radius: 14px; background: #fff;
    overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.booking-collar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.booking-collar-company-name { font-size: 28px; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; }
.booking-grid-two-columns { display: flex; width: 100%; padding: 16px; gap: 20px; align-items: flex-start; justify-content: space-between; }
.booking-main-info { flex: 1; min-width: 0; }
.booking-actions-right { display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; width: 140px; }
.booking-action-btn-right {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 12px; background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 40px; font-size: 13px; font-weight: 500; color: #475569;
    cursor: pointer; transition: all 0.2s; white-space: nowrap; width: 100%;
}
.booking-action-btn-right svg { width: 16px; height: 16px; stroke: currentColor; }
.booking-action-btn-right:hover { background: #f1f5f9; border-color: #dd1847; color: #dd1847; }
.booking-cancel-right { background: #fff0f3; border-color: #fecdd3; color: #dd1847; font-weight: 600; }
.booking-cancel-right:hover { background: #ffe4e9; border-color: #dd1847; }
.booking-time-block { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #edf2f7; }
.booking-time-label { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.booking-time-value { font-size: 22px; font-weight: 700; color: #0f172a; }
.booking-date-value { font-size: 14px; font-weight: 500; color: #64748b; margin-top: 4px; }
.booking-service-block { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #edf2f7; }
.booking-service-name { font-size: 16px; font-weight: 600; color: #0f172a; margin-bottom: 8px; }
.booking-service-price { font-size: 16px; font-weight: 700; color: #dd1847; }
.booking-price-duration-wrapper { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.booking-duration-inner { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: #64748b; }
.duration-icon { width: 14px; height: 14px; }
.booking-master-under-service { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.booking-master-avatar-small { width: 36px; height: 36px; border-radius: 12px; background: #f1f5f9; overflow: hidden; }
.booking-master-avatar-small img { width: 100%; height: 100%; object-fit: cover; }
.booking-master-name-small { font-size: 15px; font-weight: 600; color: #1e293b; }

/* ===== PROFILE (клиентский дашборд) ===== */
.profile-card {
    background: #fff; border-radius: 20px; padding: 24px;
    border: 1px solid var(--border); box-shadow: var(--shadow);
}
.profile-input {
    width: 100%; padding: 16px 18px; border: 1px solid #e0e0e0;
    border-radius: 12px; font-size: 15px; background: #f8f8f8;
    transition: all .2s; font-family: inherit; box-sizing: border-box;
}
.profile-input:focus { outline: 0; border-color: #dd1847; background: #fff; }
.profile-input.error { border-color: #f44336; background: #fff5f5; }
.profile-email-error { color: #f44336; font-size: 12px; margin-top: 6px; }
.profile-name-fields { display: flex; gap: 12px; }
.profile-name-fields .profile-input { flex: 1; min-width: 0; }
.profile-field-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: #f8f8f8; border-radius: 12px;
    cursor: pointer; transition: background .2s; border: 1px solid #e0e0e0;
}
.profile-field-row:hover { background: #f0f0f0; }
.profile-field-label { font-size: 14px; font-weight: 500; color: #1a1a1a; }
.profile-field-value { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #888; }
.profile-social-icons { display: flex; gap: 6px; }
.social-icon-placeholder { width: 36px; height: 36px; border-radius: 8px; background: #e8e8e8; }
.profile-logout { color: #f44336; margin-top: 24px; text-align: center; cursor: pointer; font-size: 14px; padding-top: 24px; border-top: 1px solid var(--border); }
.profile-birthday-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: #f8f8f8; border-radius: 12px;
    cursor: pointer; transition: background .2s; border: 1px solid #e0e0e0;
}
.profile-birthday-row:hover { background: #f0f0f0; }
.profile-birthday-label { font-size: 14px; font-weight: 500; color: #1a1a1a; }
.profile-birthday-value { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #888; }
.profile-birthday-hint { font-size: 11px; color: #999; line-height: 1.5; margin-top: 8px; padding: 0 2px; }

.profile-save-bar {
    width: 100%; background: #fff; border-radius: 16px; padding: 10px 12px;
    margin-bottom: 10px; box-shadow: 0 -2px 12px rgba(0,0,0,.08); border: 1px solid var(--border);
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.35s cubic-bezier(.4,0,.2,1), opacity 0.3s, margin-bottom 0.3s, padding 0.3s;
}
.profile-save-bar.visible { max-height: 80px; opacity: 1; padding: 10px 12px; margin-bottom: 10px; }
.profile-save-bar-btn {
    width: 100%; padding: 12px 20px; background: #dd1847; color: #fff;
    border: 0; border-radius: 12px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all .2s; display: flex;
    align-items: center; justify-content: center; gap: 8px;
}
.profile-save-bar-btn:hover:not(:disabled) { background: #c4153e; }
.profile-save-bar-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== TABS ===== */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== ADAPTIVE ===== */
@media (max-width: 767px) {
    #app { padding: 0; }
    .auth-card { padding: 24px 20px; border-radius: 20px; }
    .ozon-title { font-size: 24px; }
    .code-digit { width: 46px; height: 56px; font-size: 22px; }
    
    .city-selector-text { font-size: 15px; }
    .sphere-chip { padding: 12px 14px; font-size: 14px; min-width: calc((100vw - 60px) / 4.5); justify-content: center; }
    .booking-tab { padding: 12px 18px; font-size: 15px; }
    .profile-card { padding: 16px; }
    .profile-name-fields { flex-direction: column; gap: 8px; }
    .booking-collar { padding: 12px 14px; }
    .booking-collar-avatar { width: 40px; height: 40px; border-radius: 12px; }
    .booking-collar-company-name { font-size: 22px; }
    .booking-grid-two-columns { padding: 14px; gap: 16px; }
    .booking-actions-right { width: 130px; }
    .booking-action-btn-right { padding: 8px 6px; font-size: 11px; }
    .booking-action-btn-right svg { width: 14px; height: 14px; }
    .booking-time-value { font-size: 20px; }
    .booking-master-avatar-small { width: 32px; height: 32px; }
    .booking-master-name-small { font-size: 14px; }
}

@media (max-width: 480px) {
    .booking-collar { padding: 10px 12px; }
    .booking-collar-avatar { width: 36px; height: 36px; border-radius: 10px; }
    .booking-collar-company-name { font-size: 18px; }
    .booking-grid-two-columns { padding: 12px; gap: 12px; }
    .booking-actions-right { width: 120px; }
    .booking-action-btn-right { padding: 6px 4px; font-size: 10px; }
    .booking-time-value { font-size: 18px; }
    .booking-master-name-small { font-size: 13px; }
}


/* ============================================================
 * HEADER — mobile-first
 * Без костылей: базовые правила для мобилки, апгрейд через media.
 * ============================================================ */
.header-container {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    transition: box-shadow .2s ease;
}
.header-container.is-sticky {
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.main-header {
    max-width: 1280px;
    margin: 0 auto;
    height: 64px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.header-logo {
    height: 34px;
    width: auto;
    display: block;
}

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

.header-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    transition: background .15s ease;
}
.header-icon-btn:hover { background: #eee; }
.header-icon-btn svg { width: 22px; height: 22px; }

/* ============================================================
 * BOTTOM NAV — mobile-only
 * ============================================================ */
.bottom-nav-wrapper {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: calc(100% - 32px);
    max-width: 600px;
}
.bottom-nav {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
    display: flex;
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.bottom-nav-item {
    flex: 1;
    padding: 10px 6px;
    border: none;
    background: transparent;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    transition: color .15s, background .15s;
}
.bottom-nav-item.active { color: var(--red); background: #fdf2f5; font-weight: 600; }
.bottom-nav-item svg { width: 24px; height: 24px; display: block; margin: 0 auto 4px; }

/* ============================================================
 * Планшет — 768-1023px
 * ============================================================ */
@media (min-width: 768px) {
    .main-header { padding: 0 24px; height: 72px; }
    .header-logo { height: 42px; }
    .header-icon-btn { width: 44px; height: 44px; }
}

/* ============================================================
 * ДЕСКТОП — ≥1024px
 * ============================================================ */
@media (min-width: 1024px) {

    /* ============================================================
     * Layout — широкая сетка, без padding от fixed-header
     * ============================================================ */
    body.dashboard-body {
        padding-bottom: 0;
    }

    .main-content {
        max-width: 1280px;
        padding: 32px 40px;
    }

    /* ============================================================
     * Header — крупнее
     * ============================================================ */
    .main-header {
        padding: 0 40px;
        height: 84px;
    }
    .header-logo { height: 52px; }
    .header-icon-btn { width: 48px; height: 48px; border-radius: 14px; }
    .header-icon-btn svg { width: 24px; height: 24px; }

    .header-right > div:first-child {
        padding: 6px;
        border-radius: 14px;
    }
    .header-right > div:first-child button,
    .header-right > div:first-child a {
        padding: 10px 24px;
        font-size: 14px;
        border-radius: 10px;
    }

    /* ============================================================
     * Bottom-nav — скрыть
     * ============================================================ */
    .bottom-nav-wrapper {
        display: none;
    }

    /* ============================================================
     * City selector — крупнее
     * ============================================================ */
    .city-selector-text {
        font-size: 18px;
    }

    /* ============================================================
     * Search — по центру, шире
     * ============================================================ */
    .search-wrapper {
        max-width: 720px;
        margin: 0 auto 24px;
    }

    /* ============================================================
     * Сферы — сетка 6 колонок вместо карусели
     * ============================================================ */
    .spheres-carousel-wrapper {
        overflow: visible;
    }
    .spheres-carousel {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
        overflow: visible;
    }
    .sphere-chip {
        padding: 16px 12px;
        justify-content: center;
        min-width: 0;
    }

    /* ============================================================
     * Проекты — сетка 3 колонки
     * ============================================================ */
    .project-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    .project-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }
    .project-card-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 12px;
    }
    .project-card-btn {
        width: 100%;
        margin-top: 12px;
        justify-content: center;
    }

    /* ============================================================
     * Booking tabs — по центру, шире
     * ============================================================ */
    .booking-tabs {
        max-width: 520px;
        margin: 0 auto 24px;
        justify-content: center;
    }
    .booking-tab {
        padding: 12px 28px;
        font-size: 15px;
    }

    /* ============================================================
     * Profile — фикс аватара и form (уже было)
     * ============================================================ */
    .profile-card__main > .profile-photo-wrapper {
        position: static;
    }
}

/* ============================================================
 * HEADER: табы Клиент/Бизнес и навигация по разделам
 * Mobile-first: header-tabs скрыты, показываются на десктопе.
 * ============================================================ */

/* Табы Клиент/Бизнес — пилюля с двумя табами */
.client-business-tabs {
    display: inline-flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 4px;
    gap: 0;
}

.client-business-tab {
    flex: 1;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s, background .15s, box-shadow .15s;
}

.client-business-tab.active {
    background: #fff;
    color: var(--red);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    cursor: default;
}

/* Навигация по разделам — скрыта на мобилке, показывается на десктопе */
.header-tabs {
    display: none;
    align-items: center;
    gap: 4px;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 4px;
}

.header-tab {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #888;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
}

.header-tab:hover {
    color: #333;
}

.header-tab.active {
    background: #fff;
    color: var(--red);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.header-tab svg {
    width: 20px;
    height: 20px;
}

/* ============================================================
 * ДЕСКТОП: показать .header-tabs
 * ============================================================ */
@media (min-width: 1024px) {
    .header-tabs {
        display: inline-flex;
    }
    .header-tab {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
    .header-tab svg {
        width: 22px;
        height: 22px;
    }
    .client-business-tab {
        padding: 10px 20px;
        font-size: 14px;
    }
}
