/* ============================================================
   StarBoi Barbers — Booking System Styles
   Uses CSS custom properties from main.css (:root vars)
   ============================================================ */

/* ---------- Progress Bar ---------- */
.booking-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

.progress-step span {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
    background: rgba(0, 0, 0, 0.6);
    transition: all 0.3s ease;
}

.progress-step label {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.progress-step.active span,
.progress-step.completed span {
    border-color: var(--gold);
    color: var(--black);
    background: var(--gold);
}

.progress-step.active label,
.progress-step.completed label {
    color: var(--gold);
}

.progress-step.completed span::after {
    content: '\2713';
    font-size: 1rem;
}

.progress-line {
    flex: 1;
    height: 2px;
    background: #555;
    margin: 0 0.25rem;
    margin-bottom: 1.5rem;
    transition: background 0.3s ease;
    max-width: 80px;
}

.progress-line.active {
    background: var(--gold);
}

/* ---------- Step Container ---------- */
.booking-steps-wrapper {
    position: relative;
    min-height: 400px;
    overflow: hidden;
}

.booking-step {
    display: none;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.booking-step.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.booking-step h3 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--gold);
    font-weight: 300;
    letter-spacing: 1px;
}

/* ---------- Navigation Buttons ---------- */
.booking-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.booking-back {
    background: transparent;
    color: var(--white);
    padding: 0.8rem 2rem;
    border: 2px solid #555;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.booking-back:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.booking-next {
    background: var(--gold);
    color: var(--black);
    padding: 0.8rem 2rem;
    border: 2px solid var(--gold);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.booking-next:hover {
    background: var(--gold-hover);
    border-color: var(--gold-hover);
}

.booking-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---------- Step 1: Service Cards ---------- */
.service-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin: 0 auto 1rem;
    max-width: 1100px;
}

.service-card {
    flex: 0 0 calc((100% - 4.5rem) / 4); /* 4 per row (gap: 1.5rem × 3) */
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.service-card:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
    transform: translateY(-3px);
}

.service-card.selected {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.15);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.service-card .service-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.5rem;
}

.service-card .service-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.service-card .service-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.service-card .service-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
}

.service-card .service-duration {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    padding: 0.25rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
}

/* Service grid responsive steps (4 -> 3 -> 2 cols; 1 col handled in main mobile breakpoint) */
@media (max-width: 1000px) {
    .service-card { flex: 0 0 calc((100% - 3rem) / 3); } /* 3 cols */
}
@media (max-width: 760px) {
    .service-card { flex: 0 0 calc((100% - 1.5rem) / 2); } /* 2 cols */
}

/* ---------- Step 2: Calendar Widget ---------- */
.calendar-widget {
    max-width: 420px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.calendar-header h4 {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--white);
    letter-spacing: 1px;
}

.calendar-nav {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--white);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s;
}

.calendar-nav:hover {
    border-color: var(--gold);
    color: var(--gold);
}

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

.calendar-grid .day-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.5rem 0;
}

.calendar-grid .day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--white);
    min-width: 40px;
    min-height: 40px;
}

.calendar-grid .day-cell:hover:not(.disabled):not(.empty) {
    background: rgba(212, 175, 55, 0.2);
    color: var(--gold);
}

.calendar-grid .day-cell.selected {
    background: var(--gold);
    color: var(--black);
    font-weight: 600;
}

.calendar-grid .day-cell.today {
    border: 1px solid var(--gold);
}

.calendar-grid .day-cell.disabled {
    color: rgba(255, 255, 255, 0.15);
    cursor: not-allowed;
}

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

/* ---------- Step 3: Time Slots ---------- */
.time-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    max-width: 500px;
    margin: 0 auto;
}

.time-slot {
    padding: 0.9rem 0.5rem;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    color: var(--white);
    background: rgba(255, 255, 255, 0.03);
}

.time-slot:hover:not(.unavailable) {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
}

.time-slot.selected {
    border-color: var(--gold);
    background: var(--gold);
    color: var(--black);
    font-weight: 600;
}

.time-slot.unavailable {
    opacity: 0.25;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* ---------- Step 4: Customer Form ---------- */
#step-details .booking-form {
    max-width: 450px;
    margin: 0 auto;
}

#step-details .booking-form input {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

#step-details .booking-form input:focus {
    outline: none;
    border-color: var(--gold);
}

#step-details .booking-form input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-error {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-top: -0.75rem;
    margin-bottom: 0.75rem;
    display: none;
}

.form-error.visible {
    display: block;
}

/* ---------- Step 5: Review / Summary ---------- */
.booking-summary {
    max-width: 450px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 2rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.summary-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.summary-value {
    color: var(--white);
    font-weight: 500;
    font-size: 1rem;
    text-align: right;
}

.summary-row.total {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--gold);
    border-bottom: none;
}

.summary-row.total .summary-label {
    color: var(--gold);
    font-weight: 600;
    font-size: 1rem;
}

.summary-row.total .summary-value {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.3rem;
}

.deposit-note {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.remaining-note {
    text-align: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

#pay-btn {
    background: var(--gold);
    color: var(--black);
    padding: 1rem 2.5rem;
    border: 2px solid var(--gold);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    border-radius: 4px;
}

#pay-btn:hover {
    background: var(--gold-hover);
    border-color: var(--gold-hover);
}

#pay-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- Loading & Error States ---------- */
.booking-loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.booking-loading p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.booking-error {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 8px;
    color: #ff6b6b;
    margin-top: 1rem;
}

.booking-error button {
    margin-top: 1rem;
    background: transparent;
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.booking-error button:hover {
    background: rgba(255, 59, 48, 0.15);
}

/* ---------- Responsive — Tablet ---------- */
@media (max-width: 1024px) {
    .service-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

/* ---------- Responsive — Mobile ---------- */
@media (max-width: 767px) {
    .booking-progress {
        gap: 0;
    }

    .progress-step span {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .progress-step label {
        font-size: 0.6rem;
    }

    .progress-line {
        max-width: 40px;
    }

    .booking-step h3 {
        font-size: 1.2rem;
    }

    .service-grid {
        gap: 1rem;
    }

    .service-card {
        flex: 0 0 100%;
        padding: 1.5rem 1rem;
    }

    .calendar-widget {
        padding: 1rem;
    }

    .calendar-grid .day-cell {
        min-width: 36px;
        min-height: 36px;
        font-size: 0.8rem;
    }

    .time-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .time-slot {
        padding: 0.75rem 0.25rem;
        font-size: 0.85rem;
    }

    .booking-summary {
        padding: 1.25rem;
    }

    .booking-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .booking-back,
    .booking-next,
    #pay-btn {
        width: 100%;
        text-align: center;
    }
}
