/**
 * Frontend CSS for Coworking Bookings
 */

/* ==========================================================================
   Booking Form Styles
   ========================================================================== */

.coworking-booking-form {
    background: #f9f9f9;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.coworking-booking-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4em;
    font-weight: 600;
}

.booking-field {
    margin-bottom: 20px;
}

.booking-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.booking-field input,
.booking-field select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.booking-field input:focus,
.booking-field select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.booking-field input:invalid { border-color: #d63638;}

/* ==== Price Display ==== */

.booking-price-display {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #c3e6cb;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.price-calculation {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #155724;
}

.price-amount {
    color: #0d5513;
    font-size: 24px;
}

.price-breakdown {
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}

.price-breakdown small {
    display: block;
    margin-top: 5px;
}

/* ==========================================================================
   Availability Status
   ========================================================================== */

.booking-actions button{ border-radius: 0 !important;}

.booking-availability-status {
    margin: 15px 0;
    font-weight: 600;
    min-height: 20px;
}

.availability-available {
    color: #28a745;
    font-weight: 600;
}

.availability-available::before { font-weight: bold;}

.availability-unavailable {
    color: #dc3545;
    font-weight: 600;
}

.availability-unavailable::before { font-weight: bold;}

.availability-error {
    color: #fd7e14;
    font-weight: 600;
}

.loading {
    color: #6c757d;
    font-style: italic;
}

.loading::before { content: "⏳";}

/* ==== Calendar Styles ==== */

.coworking-calendar {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.calendar-header {
    background: #2271b1;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-nav {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.calendar-nav:hover { background-color: rgba(255, 255, 255, 0.2);}

.calendar-month-year {
    font-size: 18px;
    font-weight: 600;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
}

.calendar-table th {
    background: #f8f9fa;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
}

.calendar-day {
    padding: 0;
    text-align: center;
    vertical-align: top;
    height: 60px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.calendar-day:hover { background-color: #f8f9fa;}

.day-number {
    display: block;
    padding: 8px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.calendar-day.available {
    background-color: #d4edda;
    color: #155724;
}

.calendar-day.partially-booked {
    background-color: #fff3cd;
    color: #856404;
}

.calendar-day.mostly-booked {
    background-color: #f8d7da;
    color: #721c24;
}

.calendar-day.fully-booked {
    background-color: #f5c6cb;
    color: #721c24;
    cursor: not-allowed;
}

.calendar-day.closed {
    background-color: #e2e3e5;
    color: #6c757d;
    cursor: not-allowed;
}

.calendar-day.past {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.other-month {
    background-color: #f8f9fa;
    color: #adb5bd;
}

/* ==========================================================================
   jQuery UI Datepicker Customization
   ========================================================================== */

.ui-datepicker {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    padding: 10px;
}

.ui-datepicker-header {
    background: #2271b1;
    color: white;
    border-radius: 6px 6px 0 0;
    margin: -10px -10px 10px -10px;
    padding: 10px;
}

.ui-datepicker-title {
    color: white;
    font-weight: 600;
}

.ui-datepicker-prev,
.ui-datepicker-next {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    border-radius: 4px !important;
}

.ui-datepicker-prev:hover,
.ui-datepicker-next:hover { background: rgba(255, 255, 255, 0.3) !important;}

.ui-datepicker th {
    color: #6c757d;
    font-weight: 600;
}

.ui-datepicker td { padding: 2px;}

.ui-datepicker .ui-state-default {
    background: none;
    border: none;
    color: #333;
    text-align: center;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.ui-datepicker .ui-state-default:hover {
    background: #e9ecef;
    color: #333;
}

.ui-datepicker .ui-state-active {
    background: #2271b1 !important;
    color: white !important;
}

.ui-datepicker .ui-state-disabled {
    background: #f8f9fa !important;
    color: #adb5bd !important;
    cursor: not-allowed;
}

/* ==========================================================================
   Form Validation Styles
   ========================================================================== */

.field-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.field-success {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .coworking-booking-form {
        padding: 15px;
        margin: 15px 0;
        border-radius: 6px;
    }
    
    .booking-field input,
    .booking-field select {
        padding: 15px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
	.price-calculation { font-size: 18px;}
    
    .price-amount { font-size: 20px;}
    
    .calendar-day { height: 45px;}
    
    .calendar-table.mobile-calendar th,
    .calendar-table.mobile-calendar .day-number {
        font-size: 12px;
        padding: 4px;
    }
    
    .calendar-header { padding: 10px 15px;}
    .calendar-month-year { font-size: 16px;}
}

@media (max-width: 480px) {
    .coworking-booking-form {
        padding: 12px;
        margin: 10px 0;
    }
    
    .coworking-booking-form h3 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .booking-field { margin-bottom: 15px;}
    
    .booking-price-display { padding: 15px;}
    .calendar-day { height: 40px;}
	
	.space-layout{
		display: flex !important;
		flex-direction: column;
	}
	.pricing-note{ font-size: 12px;}
	.booking-actions{ flex-direction: column;}
	.booking-actions button{ margin: 0 auto;}
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Focus indicators for keyboard navigation */
.booking-field input:focus,
.booking-field select:focus,
.calendar-nav:focus,
.calendar-day:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .coworking-booking-form {
        border: 2px solid #000;
    }
    
    .booking-field input,
    .booking-field select {
        border: 2px solid #000;
    }
    
    .availability-available {
        color: #000;
        background: #fff;
        padding: 2px 4px;
        border: 1px solid #000;
    }
    
    .availability-unavailable {
        color: #fff;
        background: #000;
        padding: 2px 4px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .booking-price-display {
        animation: none;
    }
    
    .booking-field input,
    .booking-field select,
    .calendar-nav,
    .calendar-day {
        transition: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .coworking-booking-form {
        background: white;
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .calendar-nav {
        display: none;
    }
    
    .booking-availability-status,
    .price-breakdown {
        font-size: 12px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .coworking-booking-form {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .coworking-booking-form h3 {
        color: #f7fafc;
    }
    
    .booking-field label {
        color: #e2e8f0;
    }
    
    .booking-field input,
    .booking-field select {
        background: #4a5568;
        border-color: #718096;
        color: #f7fafc;
    }
    
    .booking-field input:focus,
    .booking-field select:focus {
        border-color: #63b3ed;
        box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
    }
    
    .booking-price-display {
        background: linear-gradient(135deg, #2f855a 0%, #38a169 100%);
        border-color: #48bb78;
    }
    
    .price-calculation {
        color: #c6f6d5;
    }
    
    .calendar-table th {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    .calendar-day {
        border-color: #718096;
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .calendar-day:hover {
        background: #4a5568;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.booking-field.loading {
    position: relative;
}

.booking-field.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 15px;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Tooltips
   ========================================================================== */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

[data-tooltip]:hover:before {
    opacity: 1;
}