/* iPhone 17 Style Bottom Sheet Modal */
:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --gray-100: #f5f5f7;
    --gray-200: #e5e5e7;
    --gray-300: #d5d5d7;
    --gray-600: #86868b;
    --gray-800: #1d1d1f;
    --white: #ffffff;
    --border-radius: 20px;
    --transition-fast: 0.2s ease-out;
    --transition-normal: 0.3s ease-out;
}

/* Bottom Sheet Overlay */
.booking-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 1040;
    transition: background var(--transition-normal);
    display: none;
}

.booking-sheet-overlay.active {
    display: block;
    background: rgba(0, 0, 0, 0.4);
}

/* Bottom Sheet Container */
.booking-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 92vh;
    background: var(--white);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    z-index: 1050;
    display: none;
    flex-direction: column;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.1);
    animation: slideUp var(--transition-normal);
}

.booking-bottom-sheet.active {
    display: flex;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

.booking-bottom-sheet.closing {
    animation: slideDown var(--transition-normal);
}

@media (min-width: 992px) {
    .booking-bottom-sheet {
        border-radius: var(--border-radius);
        max-width: 700px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

/* Handle Bar */
.sheet-handle {
    display: flex;
    justify-content: center;
    padding: 12px 0 8px 0;
    background: var(--white);
}

.handle-bar {
    width: 36px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
}

/* Sheet Header */
.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.sheet-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
    flex: 1;
    text-align: center;
}

.btn-close-sheet {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    color: var(--gray-600);
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 18px;
}

.btn-close-sheet:hover {
    background: var(--gray-200);
}

/* Sheet Body */
.sheet-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.sheet-body::-webkit-scrollbar {
    width: 4px;
}

.sheet-body::-webkit-scrollbar-track {
    background: transparent;
}

.sheet-body::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

/* Step Indicator */
.booking-steps {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    justify-content: space-between;
    padding: 0 8px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    opacity: 0.4;
    transition: opacity var(--transition-fast);
}

.step-item.active {
    opacity: 1;
}

.step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-600);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.step-item.active .step-number {
    background: var(--primary);
    color: var(--white);
}

.step-item.completed .step-number {
    background: var(--primary);
    color: var(--white);
}

.step-label {
    font-size: 12px;
    color: var(--gray-600);
    text-align: center;
    max-width: 60px;
    word-break: break-word;
    transition: color var(--transition-fast);
}

.step-item.active .step-label {
    color: var(--gray-800);
    font-weight: 500;
}

/* Booking Steps Content */
.booking-step {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.booking-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Info Card */
.info-card {
    background: var(--gray-100);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

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

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 500;
}

.info-value {
    font-size: 16px;
    color: var(--gray-800);
    font-weight: 600;
}

/* Form Controls */
.step-label {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 10px;
}

.form-control {
    border: 1px solid var(--gray-300) !important;
    border-radius: 10px !important;
    padding: 10px 12px !important;
    font-size: 15px !important;
    color: var(--gray-800) !important;
    background: var(--gray-100) !important;
    transition: border-color var(--transition-fast), background var(--transition-fast) !important;
}

.form-control:focus {
    border-color: var(--primary) !important;
    background: var(--white) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.form-control::placeholder {
    color: var(--gray-600) !important;
}

/* Grid Layouts */
.doctors-grid,
.slots-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.doctor-option,
.slot-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--gray-100);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    justify-content: center;
    flex-direction: column;
}

.doctor-option:hover,
.slot-option:hover {
    border-color: var(--primary);
    background: #f0f3ff;
}

.doctor-option.selected,
.slot-option.selected {
    background: #f0f3ff;
    border-color: var(--primary);
    font-weight: 600;
    color: var(--primary);
}

.doctor-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.doctor-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Service Story Carousel */
.service-carousel-shell {
    position: relative;
    padding: 6px 0;
    width: 100%;
}

.service-carousel {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 0;
    scroll-snap-type: x mandatory;
    min-height: 140px;
}

.service-carousel::-webkit-scrollbar {
    height: 8px;
}

.service-carousel::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.4);
    border-radius: 999px;
}

.service-story-tab {
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 220px;
    max-width: 260px;
    padding: 16px;
    border-radius: 1.5rem;
    border: 1px solid transparent;
    background: #ffffff;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    text-align: left;
    flex-shrink: 0;
}

.service-story-tab:hover {
    transform: translateY(-2px);
    border-color: rgba(102, 126, 234, 0.35);
    box-shadow: 0 20px 36px rgba(15, 23, 42, 0.1);
}

.service-story-tab.selected {
    border-color: rgba(102, 126, 234, 0.9);
    background: rgba(102, 126, 234, 0.06);
}

.service-story-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.service-story-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.service-story-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.service-story-meta {
    margin-top: 0.75rem;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.96);
    color: var(--gray-800);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s ease, background 0.2s ease;
}

.carousel-nav-btn:hover {
    transform: translateY(-50%) scale(1.05);
    background: white;
}

#scrollLeft {
    left: -10px;
}

#scrollRight {
    right: -10px;
}

.service-empty {
    color: var(--gray-600);
    padding: 18px 14px;
}

@media (max-width: 768px) {
    .service-carousel {
        grid-auto-columns: minmax(180px, 1fr);
    }

    .carousel-nav-btn {
        display: none;
    }
}

.doctor-info {
    text-align: left;
    flex: 1;
}

.doctor-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

.doctor-role {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 2px;
}

.slot-time {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

/* Form Groups */
.form-group {
    margin-bottom: 16px;
}

.form-check {
    padding-left: 0;
    margin-top: 12px;
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.form-check-input:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    font-size: 14px;
    color: var(--gray-800);
    cursor: pointer;
}

.form-check-label a {
    color: var(--primary);
    text-decoration: none;
}

.form-check-label a:hover {
    text-decoration: underline;
}

/* Patient Details Section */
.patient-details-section {
    padding: 12px 0;
    border-top: 1px solid var(--gray-200);
    margin-top: 12px;
}

/* Sheet Footer */
.sheet-footer {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
}

.btn-action {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-cancel {
    background: var(--gray-100);
    color: var(--gray-800);
    min-width: 100px;
}

.btn-cancel:hover {
    background: var(--gray-200);
}

.btn-cancel:active {
    transform: scale(0.98);
}

.btn-confirm {
    background: #2196F3;
    color: var(--white);
    min-width: 220px;
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.btn-confirm:hover {
    background: #1976D2;
    box-shadow: 0 6px 12px rgba(33, 150, 243, 0.4);
}

.btn-confirm:active {
    transform: scale(0.98);
}

.btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 480px) {
    .booking-bottom-sheet {
        max-height: 100vh;
        border-radius: 16px 16px 0 0;
    }

    .sheet-body {
        padding: 12px;
    }

    .booking-steps {
        gap: 8px;
        margin-bottom: 20px;
    }

    .step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .step-label {
        font-size: 11px;
    }

    .sheet-footer {
        gap: 10px;
        padding: 12px;
        flex-direction: column;
    }

    .btn-action {
        padding: 12px 16px;
        font-size: 16px;
        width: 100%;
    }

    .btn-cancel {
        min-width: unset;
    }

    .btn-confirm {
        min-width: unset;
    }

    .doctors-grid,
    .slots-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .doctor-option {
        flex-direction: row;
        justify-content: flex-start;
    }

    .doctor-info {
        text-align: left;
    }
}

/* Tablet and Desktop */
@media (min-width: 768px) {
    .booking-bottom-sheet {
        margin: 0 auto;
        width: 90%;
        max-width: 500px;
        border-radius: var(--border-radius) var(--border-radius) var(--border-radius) var(--border-radius);
        bottom: 50%;
        left: 50%;
        transform: translate(-50%, 50%);
    }

    .booking-bottom-sheet.active {
        transform: translate(-50%, 50%);
    }

    .booking-bottom-sheet.closing {
        animation: slideDownCenter var(--transition-normal);
    }

    @keyframes slideDownCenter {
        from {
            transform: translate(-50%, 50%);
            opacity: 1;
        }
        to {
            transform: translate(-50%, calc(50% + 100vh));
            opacity: 0;
        }
    }

    .sheet-handle {
        padding: 16px 0 12px 0;
    }

    .doctors-grid,
    .slots-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animation for disabled state */
.shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-4px);
    }
    75% {
        transform: translateX(4px);
    }
}

/* Print Styles */
@media print {
    .booking-sheet-overlay,
    .booking-bottom-sheet {
        display: none !important;
    }
}
