/* ============ TELEGRAM THEME VARIABLES ============ */
:root {
    --tg-bg: var(--tg-theme-bg-color, #ffffff);
    --tg-text: var(--tg-theme-text-color, #000000);
    --tg-hint: var(--tg-theme-hint-color, #999999);
    --tg-link: var(--tg-theme-link-color, #2481cc);
    --tg-btn: var(--tg-theme-button-color, #2481cc);
    --tg-btn-text: var(--tg-theme-button-text-color, #ffffff);
    --tg-secondary-bg: var(--tg-theme-secondary-bg-color, #f0f0f0);

    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

/* ============ RESET ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--tg-bg);
    color: var(--tg-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ============ SCREENS ============ */
.screen {
    display: none;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ LOADING ============ */
#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.loader {
    width: 36px;
    height: 36px;
    border: 3px solid var(--tg-secondary-bg);
    border-top-color: var(--tg-btn);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading p {
    margin-top: 12px;
    color: var(--tg-hint);
    font-size: 14px;
}

/* ============ BUSINESS HEADER ============ */
.business-header {
    text-align: center;
    padding: 20px 0;
}

.business-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--tg-secondary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 12px;
}

.business-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--tg-hint);
    font-size: 14px;
}

/* ============ TABS ============ */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--tg-secondary-bg);
    border-radius: var(--radius);
    padding: 3px;
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    color: var(--tg-hint);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.tab.active {
    background: var(--tg-bg);
    color: var(--tg-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============ CARDS / LIST ============ */
.list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card {
    background: var(--tg-secondary-bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.card:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 13px;
    color: var(--tg-hint);
}

.card-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--tg-link);
    margin-top: 6px;
}

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

/* ============ SPECIALIST CARD ============ */
.specialist-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.specialist-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--tg-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.specialist-info {
    flex: 1;
}

/* ============ SCREEN HEADER ============ */
.screen-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.screen-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.back-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--tg-secondary-bg);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.back-btn:active {
    transform: scale(0.9);
}

.step-info {
    color: var(--tg-hint);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ============ CALENDAR ============ */
.calendar {
    background: var(--tg-secondary-bg);
    border-radius: var(--radius);
    padding: 16px;
}

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

.calendar-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.calendar-nav {
    border: none;
    background: var(--tg-bg);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.calendar-day-name {
    font-size: 11px;
    color: var(--tg-hint);
    font-weight: 600;
    padding: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: transparent;
    color: var(--tg-text);
}

.calendar-day:hover:not(.disabled):not(.empty) {
    background: var(--tg-bg);
}

.calendar-day.selected {
    background: var(--tg-btn);
    color: var(--tg-btn-text);
}

.calendar-day.today {
    font-weight: 700;
    border: 2px solid var(--tg-btn);
}

.calendar-day.disabled {
    color: var(--tg-hint);
    opacity: 0.4;
    cursor: default;
}

.calendar-day.empty {
    cursor: default;
}

/* ============ TIME SLOTS ============ */
.time-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.time-slot {
    padding: 12px 8px;
    border: none;
    background: var(--tg-secondary-bg);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--tg-text);
}

.time-slot:active {
    transform: scale(0.95);
}

.time-slot.selected {
    background: var(--tg-btn);
    color: var(--tg-btn-text);
}

/* ============ INFO CARD ============ */
.info-card {
    background: var(--tg-secondary-bg);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}

.info-card .label {
    color: var(--tg-hint);
    font-size: 12px;
    margin-bottom: 2px;
}

.info-card .value {
    font-weight: 600;
}

/* ============ CONFIRM ============ */
.confirm-card {
    background: var(--tg-secondary-bg);
    border-radius: var(--radius);
    padding: 20px;
}

.confirm-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(128,128,128,0.1);
    font-size: 14px;
}

.confirm-row:last-child {
    border-bottom: none;
}

.confirm-label {
    color: var(--tg-hint);
}

.confirm-value {
    font-weight: 600;
    text-align: right;
}

.confirm-total {
    font-size: 18px;
    color: var(--tg-link);
}

/* ============ SUCCESS ============ */
.success-content {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
}

.success-content h2 {
    font-size: 24px;
    margin-bottom: 16px;
}

#success-details {
    text-align: left;
    background: var(--tg-secondary-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
    font-size: 14px;
}

#success-details p {
    padding: 6px 0;
}

/* ============ BUTTONS ============ */
.btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--tg-btn);
    color: var(--tg-btn-text);
}

.btn-primary:active {
    opacity: 0.85;
    transform: scale(0.98);
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--tg-hint);
}

.empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

/* ============ BOOKING CARD (My Appointments) ============ */
.booking-card {
    position: relative;
}

.booking-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 6px;
}

.booking-status.active {
    background: #e8f5e9;
    color: #2e7d32;
}

.booking-status.cancelled {
    background: #ffebee;
    color: #c62828;
}

.cancel-link {
    color: #c62828;
    font-size: 12px;
    cursor: pointer;
    margin-top: 4px;
    display: inline-block;
}

/* ============ SPECIALIST PHOTO ============ */
.specialist-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* ============ CALENDAR EXTRAS ============ */
.calendar-nav.disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.calendar-day.day-off {
    color: var(--tg-hint);
    opacity: 0.35;
    text-decoration: line-through;
    cursor: default;
}

/* ============ PAST BOOKING STATUS ============ */
.booking-status.past {
    background: #e3e8ed;
    color: #607d8b;
}

/* ============ INFO ROW (date/time screen) ============ */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
}

.info-row .label {
    color: var(--tg-hint);
    font-size: 13px;
}

/* ============ HINT TEXT ============ */
.hint {
    color: var(--tg-hint);
    font-size: 12px;
    font-weight: 400;
}

/* ============ BUSINESS EXTRA INFO ============ */
.business-rating {
    font-size: 14px;
    margin-top: 4px;
    display: none;
}

.business-description {
    font-size: 13px;
    color: var(--tg-hint);
    margin-top: 8px;
    line-height: 1.4;
    display: none;
}

/* ============ STEP SERVICE NAME ============ */
.step-service-name {
    font-size: 13px;
    color: var(--tg-link);
    font-weight: 600;
    margin-top: -8px;
    margin-bottom: 12px;
}

/* ============ LOADING INLINE ============ */
.loading-inline {
    text-align: center;
    padding: 20px;
    color: var(--tg-hint);
    font-size: 14px;
}

/* ============ SAFE AREA ============ */
.screen {
    padding-bottom: 80px;
}

/* ============ FAVORITE BUTTON ============ */
.fav-container {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.business-header {
    position: relative;
}

.fav-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--tg-secondary-bg);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.fav-btn:active {
    transform: scale(1.2);
}

/* ============ SPECIALIST RATING ============ */
.specialist-rating {
    font-size: 12px;
    margin-top: 2px;
    color: var(--tg-hint);
}

/* ============ SPECIALIST PROFILE ============ */
.specialist-profile-header {
    text-align: center;
    padding: 20px 0;
}

.specialist-profile-header h2 {
    font-size: 20px;
    margin-top: 12px;
}

.specialist-profile-header .specialist-avatar {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    font-size: 36px;
}

.specialist-profile-header .specialist-avatar-img {
    width: 72px;
    height: 72px;
}

/* ============ PORTFOLIO GRID ============ */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 12px;
    border-radius: var(--radius);
    overflow: hidden;
}

.portfolio-item {
    aspect-ratio: 1;
    cursor: pointer;
    overflow: hidden;
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.portfolio-item:active img {
    transform: scale(1.05);
}

/* ============ PHOTO OVERLAY ============ */
.photo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.photo-overlay img {
    max-width: 95%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

/* ============ REVIEWS ============ */
.review-card {
    background: var(--tg-secondary-bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-top: 8px;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.review-stars {
    font-size: 12px;
}

.review-text {
    font-size: 14px;
    line-height: 1.4;
    margin-top: 4px;
}

.owner-response {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(128,128,128,0.15);
    font-size: 13px;
    color: var(--tg-hint);
}

/* ============ RESCHEDULE LINK ============ */
.reschedule-link {
    color: var(--tg-link);
    font-size: 12px;
    cursor: pointer;
    margin-top: 4px;
    margin-right: 8px;
    display: inline-block;
}
