:root {
    --bg: var(--tg-theme-bg-color, #ffffff);
    --text: var(--tg-theme-text-color, #1a1a2e);
    --hint: var(--tg-theme-hint-color, #8e8e93);
    --link: var(--tg-theme-link-color, #6c5ce7);
    --btn: var(--tg-theme-button-color, #6c5ce7);
    --btn-text: var(--tg-theme-button-text-color, #ffffff);
    --secondary-bg: var(--tg-theme-secondary-bg-color, #f2f2f7);
    --radius: 14px;
    --shadow: 0 2px 12px rgba(0,0,0,.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding: 16px;
    padding-bottom: 80px;
    min-height: 100vh;
}

h1, h2, h3 {
    font-weight: 700;
    margin-bottom: 12px;
}

h1 { font-size: 22px; }
h2 { font-size: 18px; }

.card {
    background: var(--secondary-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    transition: transform .15s ease;
}

.card:active { transform: scale(.98); }

.card-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.card-sub {
    font-size: 13px;
    color: var(--hint);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--btn);
    color: var(--btn-text);
    border: none;
    border-radius: var(--radius);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: opacity .15s ease;
}

.btn:active { opacity: .8; }

.btn-outline {
    background: transparent;
    color: var(--btn);
    border: 2px solid var(--btn);
}

/* Step indicators */
.steps {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.step {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--secondary-bg);
    transition: background .3s ease;
}

.step.active { background: var(--btn); }

/* Service list */
.service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--secondary-bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: background .15s;
}

.service-item:hover { background: color-mix(in srgb, var(--btn) 10%, var(--secondary-bg)); }
.service-item.selected { background: color-mix(in srgb, var(--btn) 20%, var(--secondary-bg)); outline: 2px solid var(--btn); }

.service-item.multi-selected {
    outline: 2px solid var(--btn);
    background: color-mix(in srgb, var(--btn) 15%, var(--secondary-bg));
    position: relative;
}

.service-item.multi-selected::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 12px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: var(--btn-text);
    background: var(--btn);
    border-radius: 999px;
}

.service-name { font-weight: 600; }
.service-meta { font-size: 13px; color: var(--hint); text-align: right; }

/* Calendar grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.cal-header {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: var(--hint);
    padding: 4px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s ease;
}

.cal-day.empty { cursor: default; }
.cal-day.disabled { color: var(--hint); opacity: .4; cursor: not-allowed; }
.cal-day.today { font-weight: 700; }
.cal-day.selected { background: var(--btn); color: var(--btn-text); font-weight: 700; }
.cal-day:not(.empty):not(.disabled):hover { background: color-mix(in srgb, var(--btn) 15%, transparent); }

/* Time slots */
.time-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.time-slot {
    padding: 10px;
    text-align: center;
    border-radius: var(--radius);
    background: var(--secondary-bg);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
}

.time-slot:hover { background: color-mix(in srgb, var(--btn) 15%, var(--secondary-bg)); }
.time-slot.selected { background: var(--btn); color: var(--btn-text); }

/* Confirmation */
.confirm-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--hint) 20%, transparent);
}

.confirm-label { color: var(--hint); font-size: 14px; }
.confirm-value { font-weight: 600; font-size: 14px; }

/* Sticky summary (services multi-select) */
.sticky-summary {
    position: sticky;
    bottom: 74px; /* above bottom bar */
    z-index: 120;
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--secondary-bg) 85%, var(--bg));
    border: 1px solid color-mix(in srgb, var(--hint) 18%, transparent);
    box-shadow: 0 6px 24px rgba(0,0,0,.10);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sticky-summary.hidden { display: none !important; }

.sticky-summary-text {
    flex: 1;
    font-size: 13px;
    color: var(--hint);
    line-height: 1.3;
}

.sticky-summary-btn {
    width: auto;
    padding: 12px 16px;
    white-space: nowrap;
}

/* Price list */
.price-category-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--hint);
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid color-mix(in srgb, var(--btn) 30%, transparent);
}
.price-category-title:first-child { margin-top: 0; }

.price-card-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}
.price-card-meta {
    font-size: 14px;
    color: var(--hint);
}

/* My bookings cards */
.booking-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.booking-card-date {
    font-size: 15px;
}
.booking-card-date strong {
    font-weight: 700;
}
.booking-card-service {
    font-size: 14px;
    color: var(--hint);
}

.booking-card-actions {
    margin-top: 6px;
    display: flex;
    gap: 10px;
}

.btn-cancel {
    width: auto;
    padding: 10px 14px;
    font-size: 14px;
    background: transparent;
    color: #ff3b30;
    border: 2px solid color-mix(in srgb, #ff3b30 70%, transparent);
}

.btn-cancel:active { opacity: .8; }

/* Cancel modal */
.cancel-modal {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.cancel-modal.hidden {
    display: none !important;
    pointer-events: none;
}

.cancel-modal-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    animation: modalFadeIn 0.2s ease-out;
}

.cancel-textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 2px solid var(--secondary-bg);
    background: var(--secondary-bg);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    margin-bottom: 12px;
}

.cancel-textarea:focus {
    border-color: var(--btn);
    background: var(--bg);
}

/* Service modal (add/edit) */
.service-modal {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.service-modal.hidden {
    display: none !important;
    pointer-events: none;
}

.service-modal-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    animation: modalFadeIn 0.2s ease-out;
}

.admin-services-btn {
    margin-bottom: 16px;
    width: 100%;
}

.admin-add-service-btn {
    margin-bottom: 16px;
}

.admin-service-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-service-info {
    flex: 1;
}

.admin-service-actions {
    display: flex;
    gap: 8px;
}

.admin-service-actions .btn {
    width: auto;
    padding: 8px 12px;
    font-size: 13px;
}

.btn-icon-delete {
    background: transparent;
    color: var(--hint);
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 18px;
}

.btn-icon-delete:hover,
.btn-icon-delete:active {
    color: #ff3b30;
}

.admin-schedule-btn {
    margin-bottom: 16px;
    width: 100%;
}

.schedule-block-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}

.schedule-weekly-block {
    margin-bottom: 24px;
}

.schedule-weekly-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.schedule-weekly-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--secondary-bg);
    border-radius: var(--radius);
    font-size: 14px;
}

.schedule-weekly-row .schedule-weekly-day {
    flex: 1;
    min-width: 90px;
}

.schedule-weekly-check {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.schedule-weekly-check input {
    width: 18px;
    height: 18px;
}

.schedule-weekly-day {
    font-weight: 500;
}

.schedule-time-select {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--hint) 30%, transparent);
    background: var(--bg);
    font-size: 13px;
    min-width: 70px;
}

.schedule-time-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.schedule-weekly-sep {
    color: var(--hint);
    font-size: 12px;
}

.schedule-save-btn {
    width: 100%;
}

.schedule-calendar-block {
    margin-top: 20px;
}

.schedule-off-hint {
    font-size: 13px;
    color: var(--hint);
    margin-bottom: 12px;
}

.schedule-cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

/* Admin calendar grid 7x6 */
.admin-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.admin-cal-header {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: var(--hint);
    padding: 4px;
}

.admin-cal-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    min-height: 36px;
}

.admin-cal-cell.empty {
    visibility: hidden;
}

.admin-cal-day {
    border: none;
    background: var(--secondary-bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.admin-cal-day:not(.disabled):hover {
    background: color-mix(in srgb, var(--btn) 20%, var(--secondary-bg));
}

.admin-cal-day.disabled {
    color: var(--hint);
    opacity: 0.4;
    cursor: not-allowed;
}

.admin-cal-day.today {
    font-weight: 700;
    border: 2px solid var(--btn);
}

.admin-cal-day.off-day {
    background: #ff3b30;
    color: #fff;
}

.admin-cal-day.off-day:hover {
    background: #ff6b63;
}

.admin-cal-day.off-day.today {
    border-color: #fff;
}

/* Portfolio grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.portfolio-item {
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    aspect-ratio: 1;
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Fullscreen photo modal */
.photo-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    animation: modalFadeIn 0.2s ease-out;
}

.photo-modal.hidden {
    display: none !important;
    pointer-events: none;
}

.photo-modal img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.portfolio-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    color: #fff;
    font-size: 12px;
}

/* Loader */
.loader {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--secondary-bg);
    border-top-color: var(--btn);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Input fields */
.input-group {
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--hint);
    margin-bottom: 6px;
}

.input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    border: 2px solid var(--secondary-bg);
    border-radius: var(--radius);
    background: var(--secondary-bg);
    color: var(--text);
    outline: none;
    transition: border-color .2s ease;
    -webkit-appearance: none;
}

.input:focus {
    border-color: var(--btn);
    background: var(--bg);
}

.input::placeholder { color: var(--hint); opacity: .6; }

.btn-disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* Success screen */
.success-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    animation: successPop .4s ease-out;
}

.success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #34c759;
    color: #fff;
    font-size: 36px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.success-sub {
    color: var(--hint);
    font-size: 14px;
    margin-top: 8px;
    line-height: 1.6;
}

@keyframes successPop {
    0%   { opacity: 0; transform: scale(.8); }
    60%  { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

.hidden { display: none !important; }

/* Main menu (SPA home) */
.main-menu {
    padding: 24px 0;
    text-align: center;
}

.main-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--btn), var(--link));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-subtitle {
    color: var(--hint);
    font-size: 15px;
    margin-bottom: 32px;
}

.main-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.main-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease;
    text-align: left;
}

.main-btn:active {
    transform: scale(.98);
    opacity: .9;
}

.main-btn-primary {
    background: var(--btn);
    color: var(--btn-text);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--btn) 40%, transparent);
}

.main-btn-secondary {
    background: var(--secondary-bg);
    color: var(--text);
    border: 2px solid color-mix(in srgb, var(--hint) 25%, transparent);
}

.main-btn-secondary:hover {
    border-color: var(--btn);
    background: color-mix(in srgb, var(--btn) 8%, var(--secondary-bg));
}

.main-btn-icon {
    font-size: 24px;
}

.placeholder-text {
    color: var(--hint);
    font-size: 15px;
    line-height: 1.6;
    margin-top: 12px;
}

/* Admin page styling */
.admin-page .admin-heading {
    color: var(--btn);
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-page .card {
    border-left: 3px solid var(--btn);
}

.admin-appointment-actions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.admin-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--link);
    text-decoration: none;
}

.admin-contact-link::before {
    content: "✉️";
}

/* Bottom bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    background: var(--secondary-bg);
    border-top: 1px solid color-mix(in srgb, var(--hint) 15%, transparent);
    z-index: 100;
}

.bottom-bar.hidden {
    display: none !important;
}

.bottom-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 20px;
    background: none;
    border: none;
    color: var(--hint);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    transition: color .2s, background .2s;
}

.bottom-bar-item:active {
    opacity: .8;
}

.bottom-bar-item.active {
    color: var(--btn);
    background: color-mix(in srgb, var(--btn) 12%, transparent);
}

.bottom-bar-icon {
    font-size: 22px;
}

.bottom-bar-label {
    font-size: 11px;
}

/* Page container */
.page {
    animation: fadeIn .25s ease-out;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cal-btn {
    width: auto;
    padding: 8px 16px;
}

.confirm-block {
    margin-bottom: 20px;
}

.fade-in {
    animation: fadeIn .25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Admin portfolio */
.admin-portfolio-btn,
.admin-reviews-btn {
    margin-bottom: 12px;
    width: 100%;
}

.admin-upload-label {
    display: inline-block;
    margin-bottom: 16px;
    cursor: pointer;
}

.admin-portfolio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.admin-portfolio-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--secondary-bg);
}

.admin-portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-portfolio-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-portfolio-delete:hover {
    background: #ff3b30;
}

/* Reviews */
.reviews-list {
    margin-bottom: 24px;
}

.review-card {
    margin-bottom: 12px;
}

.review-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.review-stars {
    color: #ffc107;
    font-size: 18px;
    letter-spacing: 2px;
}

.review-date {
    font-size: 12px;
    color: var(--hint);
}

.review-comment-text {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.review-reply {
    background: color-mix(in srgb, var(--hint) 12%, var(--bg));
    border-left: 3px solid var(--btn);
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    margin-top: 8px;
}

.review-form-block {
    padding-top: 16px;
    border-top: 1px solid color-mix(in srgb, var(--hint) 20%, transparent);
}

.review-form-block h3 {
    font-size: 15px;
    margin-bottom: 10px;
}

.rating-stars {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.star-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--hint);
    cursor: pointer;
    padding: 0 2px;
}

.star-btn.active,
.star-btn:hover {
    color: #ffc107;
}

.review-comment.input {
    width: 100%;
    margin-bottom: 12px;
    resize: vertical;
}

.admin-review-card .admin-review-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.review-reply-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--hint) 30%, transparent);
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
}

.review-reply-btn,
.review-delete-btn {
    width: auto;
}
