/* Swimming Pool Booking System Styles */

.calendar-day.disabled { opacity:.4; cursor:not-allowed; pointer-events:none; }
.calendar-header button[disabled] { opacity:.5; cursor:not-allowed; }

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #4a90e2;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-gray: #f8f9fa;
    --medium-gray: #6c757d;
    --dark-gray: #343a40;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: white;
    color: var(--dark-gray);
    line-height: 1.6;
}

.booking-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 300;
}

.header p {
    color: var(--medium-gray);
    font-size: 1.1rem;
}

.booking-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    gap: 20px;
}

.step {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    font-weight: 500;
    color: var(--medium-gray);
}

.step.active {
    background: var(--primary-color);
    color: white;
}

.step .step-number {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 0.9rem;
}

.booking-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
    margin-bottom: 30px;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.service-card {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.service-card:hover {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.service-card.selected {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.service-card .service-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.service-card .service-details {
    color: var(--medium-gray);
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.service-card .service-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
}

.service-card .service-duration {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--light-gray);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: var(--medium-gray);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-gray);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.calendar-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.calendar {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.calendar-header {
    background: var(--primary-color);
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: 600;
    position: relative;
}

.calendar-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.calendar-header button:hover {
    background: rgba(255,255,255,0.2);
}

.calendar-header button:first-child {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.calendar-header button:last-child {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    padding: 15px 10px;
    text-align: center;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day:hover:not(.disabled) {
    background: var(--light-gray);
}

.calendar-day.disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #fafafa;
}

.calendar-day.selected {
    background: var(--primary-color);
    color: white;
}

.calendar-day.today {
    font-weight: bold;
    background: #fff3cd;
    border-color: var(--warning-color);
}

.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.time-slot {
    padding: 12px;
    text-align: center;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.time-slot:hover:not(.unavailable) {
    border-color: var(--secondary-color);
    background: #f8f9fa;
}

.time-slot.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.time-slot.unavailable {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
    text-decoration: line-through;
}

.booking-summary {
    background: var(--light-gray);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
}

.summary-row.total {
    border-top: 2px solid #dee2e6;
    margin-top: 15px;
    padding-top: 15px;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #1e3f73;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--medium-gray);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
    margin-bottom: 15px;
}

.login-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.login-form, .register-form {
    padding: 25px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
}

.login-form h3, .register-form h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.alert {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.hidden {
    display: none !important;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Booking Item Styles (for my-bookings.php) */
.booking-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

.booking-item:hover {
    border-color: var(--secondary-color);
}

.booking-item h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.booking-item p {
    margin-bottom: 8px;
    color: var(--dark-gray);
}

.booking-item .status-paid {
    color: var(--success-color);
    font-weight: bold;
}

.booking-item .status-pending {
    color: var(--warning-color);
    font-weight: bold;
}

.booking-item .status-cancelled {
    color: var(--danger-color);
    font-weight: bold;
}

/* Stripe Payment Form Styles */
.StripeElement {
    box-sizing: border-box;
    height: 40px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background-color: white;
    box-shadow: 0 1px 3px 0 #e6ebf1;
    -webkit-transition: box-shadow 150ms ease;
    transition: box-shadow 150ms ease;
}

.StripeElement--focus {
    box-shadow: 0 1px 3px 0 #cfd7df;
}

.StripeElement--invalid {
    border-color: #fa755a;
}

.StripeElement--webkit-autofill {
    background-color: #fefde5 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .booking-container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .booking-steps {
        flex-direction: column;
        align-items: center;
    }
    
    .step {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    .calendar-container {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .login-section {
        grid-template-columns: 1fr;
    }

    .service-grid {
        grid-template-columns: 1fr;
    }
    
    .time-slots {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .booking-section {
        padding: 20px;
    }
    
    .btn {
        min-width: auto;
        width: 100%;
    }
    
    .summary-row {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .booking-container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .service-card {
        padding: 20px;
    }
    
    .service-card .service-title {
        font-size: 1.1rem;
    }
    
    .service-card .service-price {
        font-size: 1.3rem;
    }
    
    .calendar-day {
        padding: 10px 5px;
        font-size: 0.9rem;
    }
    
    .time-slots {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .booking-section {
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    .booking-steps,
    .btn,
    .calendar-header button {
        display: none;
    }
    
    .booking-section {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        font-size: 12pt;
    }
}

/* Accessibility Improvements */
.btn:focus,
.service-card:focus,
.calendar-day:focus,
.time-slot:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --secondary-color: #0000ff;
        --success-color: #008000;
        --danger-color: #800000;
        --medium-gray: #000000;
        --light-gray: #ffffff;
    }
    
    .service-card,
    .calendar-day,
    .time-slot {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading {
        animation: none;
    }
}

const confirmationStyles = `
.booking-summary-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.summary-item:last-child,
.total-row {
    border-bottom: none;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #007bff;
}

.summary-label {
    font-weight: 500;
    color: #495057;
}

.summary-value {
    color: #212529;
}

.total-cost-section {
    background: #e7f3ff;
    border: 2px solid #007bff;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.total-cost h3 {
    margin: 0;
    color: #007bff;
    font-size: 1.5rem;
}

.payment-info {
    background: #f8f9fa;
    border-left: 4px solid #28a745;
    padding: 15px;
    margin: 20px 0;
}

.payment-security {
    margin: 0;
    color: #495057;
}
`;

// Inject the styles
const styleSheet = document.createElement('style');
styleSheet.textContent = confirmationStyles;
document.head.appendChild(styleSheet);