/* Coworking Space Booking Plugin - Frontend Styles */

/* Reset and base styles */
.coworking-booking-form * {
    box-sizing: border-box;
}

#coworking-booking-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Calendar Widget Styles */
.coworking-calendar-widget {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.coworking-calendar-widget h3 {
    margin-top: 0;
    color: #007cba;
    text-align: center;
}

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

.calendar-header h4 {
    margin: 0;
    font-size: 1.2em;
    color: #333;
}

.calendar-nav {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.calendar-nav:hover {
    background: #005a87;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    table-layout: fixed;
}

.calendar-table th,
.calendar-table td {
    width: 14.285714%;
    box-sizing: border-box;
}

.calendar-table th {
    background: #f8f9fa;
    padding: 10px 5px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #dee2e6;
}

.calendar-table td {
    border: 1px solid #dee2e6;
    text-align: center;
    vertical-align: middle;
    height: 40px;
    position: relative;
}

.calendar-day {
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.calendar-day.available:hover {
    background: #c3e6cb;
}

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

.calendar-day.limited:hover {
    background: #ffeaa7;
}

.calendar-day.booked,
.calendar-day.unavailable {
    background: #f8d7da;
    color: #721c24;
    cursor: not-allowed;
}

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

.calendar-day.selected {
    background: #007cba !important;
    color: white !important;
    font-weight: bold;
}

.calendar-day.booking-range {
    background: #ffc107 !important;
    color: #856404 !important;
    font-weight: bold;
    border: 2px solid #fd7e14;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 5px;
}

.legend-color.available {
    background: #d4edda;
}

.legend-color.limited {
    background: #fff3cd;
}

.legend-color.booked {
    background: #f8d7da;
}

.legend-color.blocked {
    background: #6c757d;
}

.legend-color.booking-range {
    background: #ffc107;
    border: 2px solid #fd7e14;
}

/* Form Styles */
.coworking-booking-form {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
}

.form-section h3 {
    color: #007cba;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.4em;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-field {
    flex: 1;
}

.form-field.full-width {
    flex: 1 1 100%;
}

.form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.form-field textarea {
    min-height: 80px;
    resize: vertical;
}

/* Radio Button Styles */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Checkbox Styles */
.checkbox-option {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.checkbox-option:hover {
    border-color: #007cba;
    background: #f8f9fa;
}

.checkbox-option input[type="checkbox"] {
    margin-right: 12px;
    margin-top: 2px;
    width: auto;
    flex-shrink: 0;
    transform: scale(1.2);
}

.checkbox-option input[type="checkbox"]:checked + .checkbox-label {
    color: #007cba;
    font-weight: 600;
}

.checkbox-option:has(input[type="checkbox"]:checked) {
    border-color: #007cba;
    background: #f0f8ff;
}

.checkbox-label {
    display: block;
    flex: 1;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.checkbox-label a {
    color: #007cba;
    text-decoration: underline;
}

.checkbox-label a:hover {
    color: #005a87;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.radio-option:hover {
    border-color: #007cba;
    background: #f8f9fa;
}

.radio-option input[type="radio"] {
    margin-right: 12px;
    margin-top: 2px;
    width: auto;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked + .radio-label {
    color: #007cba;
    font-weight: 600;
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: #007cba;
    background: #f0f8ff;
}

.radio-label {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.price {
    font-size: 1.2em;
    font-weight: 700;
    color: #28a745;
    margin-top: 2px;
}

.duration {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 2px;
}

/* Payment Method Styles */
.payment-methods .radio-option {
    align-items: center;
}

.payment-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.payment-icon.credit-card {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" /></svg>');
}

.payment-icon.paypal {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23003087"><path d="M7.076 21.337H2.47a.641.641 0 0 1-.633-.74L4.944.901C5.026.382 5.474 0 5.998 0h7.46c2.57 0 4.578.543 5.69 1.81 1.01 1.15 1.304 2.42 1.012 4.287-.023.143-.047.288-.077.437-.983 5.05-4.349 6.797-8.647 6.797h-2.19c-.524 0-.968.382-1.05.9l-1.12 7.106zm14.146-14.42a3.35 3.35 0 0 0-.34-.77c-.58-.74-1.59-1.04-3.12-1.04H7.89a.64.64 0 0 0-.633.55l-.97 6.14h2.97c2.58 0 4.61.54 5.72 1.81.58.66.9 1.45.9 2.36 0 .36-.04.72-.12 1.07.36-.02.72-.06 1.07-.12 4.3-.75 6.53-3.32 7.39-8.04z"/></svg>');
}

.payment-description {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 2px;
}

/* Stripe Elements */
#stripe-card-element {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 15px 0;
    background: white;
    min-height: 45px;
}

#card-errors {
    color: #fa755a;
    margin: 5px 0;
    font-size: 14px;
    display: none;
}

/* PayPal Button Container */
#paypal-button-container {
    margin: 15px 0;
    min-height: 45px;
}

/* Availability Results */
.availability-result {
    margin: 20px 0;
    padding: 15px;
    border-radius: 4px;
    font-weight: 600;
}

.availability-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.availability-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1b0b7;
}

.checking-availability {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #b6d7dd;
    display: flex;
    align-items: center;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid #0c5460;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Booking Messages Container - Force Visibility */
#booking-messages,
.booking-messages {
    clear: both !important;
    width: 100% !important;
    margin: 20px 0 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1000 !important;
    height: auto !important;
    min-height: 50px !important;
    overflow: visible !important;
}

/* Booking Summary */
.booking-summary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 20px;
}

.booking-summary h3 {
    color: #007cba;
    border-bottom: 2px solid #007cba;
}

.summary-content {
    margin-top: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

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

.summary-row.total {
    font-size: 1.2em;
    font-weight: 700;
    color: #28a745;
    border-top: 2px solid #dee2e6;
    margin-top: 10px;
    padding-top: 15px;
}

.summary-row .label {
    font-weight: 600;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s ease;
    min-width: 120px;
}

.button.primary {
    background: #007cba;
    color: white;
}

.button.primary:hover:not(:disabled) {
    background: #005a87;
}

.button.secondary {
    background: #6c757d;
    color: white;
}

.button.secondary:hover:not(:disabled) {
    background: #545b62;
}

.button:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* Messages */
.booking-messages {
    margin: 20px 0;
}

.booking-message-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border: 1px solid #f1b0b7;
    border-radius: 4px;
    margin-bottom: 10px;
}

.booking-message-success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    margin-bottom: 10px;
}

.booking-message-info {
    background: #d1ecf1;
    color: #0c5460;
    padding: 12px;
    border: 1px solid #b6d7dd;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* Booking Success */
.booking-success {
    text-align: center !important;
    padding: 40px 20px !important;
    background: #d4edda !important;
    border: 1px solid #c3e6cb !important;
    border-radius: 8px !important;
    color: #155724 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 100px !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1001 !important;
}

.booking-success h3 {
    color: #155724;
    margin-bottom: 15px;
    font-size: 2em;
}

/* Payment Processing Overlay */
.payment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.payment-modal {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.payment-modal h3 {
    color: #007cba;
    margin-bottom: 20px;
}

.payment-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

/* Popup Styles */
.coworking-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.coworking-popup {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
    animation: popupFadeIn 0.3s ease-out;
}

.coworking-popup-content {
    padding: 30px;
    text-align: center;
}

.coworking-popup-content h3 {
    color: #dc3545;
    margin-top: 0;
    margin-bottom: 15px;
}

.coworking-popup-content p {
    margin-bottom: 20px;
    color: #333;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Confirmation Page Styles */
.coworking-confirmation-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.coworking-confirmation-page .booking-success {
    margin: 40px 0;
}

.coworking-error {
    text-align: center;
    padding: 40px 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
}

.calendar-range-info {
    background: #d1ecf1;
    border: 1px solid #b6d7dd;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
    color: #0c5460;
}

.calendar-range-info p {
    margin: 5px 0;
}

.calendar-range-info em {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Mobile Date Picker Alternative */
.mobile-date-selector {
    display: none;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.mobile-date-selector h3 {
    margin-top: 0;
    color: #007cba;
    text-align: center;
    margin-bottom: 20px;
}

.date-picker-field {
    margin-bottom: 15px;
}

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

.date-picker-field input[type="date"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

.mobile-availability-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
    font-size: 14px;
}

.mobile-availability-info.available {
    background: var(--coworking-color-available, #d4edda);
    border-color: var(--coworking-color-available, #c3e6cb);
    color: #155724;
}

.mobile-availability-info.unavailable {
    background: var(--coworking-color-booked, #f8d7da);
    border-color: var(--coworking-color-booked, #f1b0b7);
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 768px) {
    #coworking-booking-container {
        margin: 0;
        padding: 0 10px;
    }
    
    .coworking-booking-form {
        padding: 20px 15px;
    }
    
    /* Hide desktop calendar, show mobile date picker */
    .coworking-calendar-widget {
        display: none !important;
    }
    
    .mobile-date-selector {
        display: block;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }
    
    .button {
        width: 100%;
    }
    
    .summary-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .radio-group {
        gap: 10px;
    }
    
    .radio-option {
        padding: 12px;
    }
    
    .checkbox-option {
        padding: 12px;
        flex-wrap: wrap;
    }
    
    .checkbox-option input[type="checkbox"] {
        margin-right: 8px;
        margin-top: 1px;
    }
    
    .checkbox-label {
        word-break: break-word;
        max-width: calc(100% - 30px);
    }
}

@media (max-width: 480px) {
    .coworking-booking-form {
        padding: 15px 10px;
        margin: 0 5px;
    }
    
    .form-section h3 {
        font-size: 1.2em;
    }
    
    .mobile-date-selector {
        padding: 15px;
        margin: 0 5px 20px 5px;
    }
    
    .date-picker-field input[type="date"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .payment-modal {
        padding: 20px;
        width: 95%;
    }
    
    .checkbox-option {
        padding: 10px;
    }
    
    .checkbox-option input[type="checkbox"] {
        margin-right: 6px;
        transform: scale(1.1);
    }
    
    .checkbox-label {
        font-size: 14px;
        max-width: calc(100% - 25px);
    }
}

/* Membership Title Styles */
.membership-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Info Icon Styles */
.info-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: #007cba;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
    flex-shrink: 0;
}

.info-icon:hover {
    background: #005177;
    transform: scale(1.1);
}

/* Membership Info Modal */
.membership-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.membership-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
    position: relative;
    top: 50px;
    transform: none;
}

.membership-modal-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.membership-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.membership-modal-close {
    color: #666;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.membership-modal-close:hover {
    color: #000;
}

.membership-modal-body {
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

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

/* Ensure modal appears above WordPress admin bar and other elements */
.membership-modal {
    position: fixed !important;
    z-index: 999999 !important;
}

/* Prevent scrolling issues */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

/* Mobile responsive adjustments for modal */
@media (max-width: 768px) {
    .membership-modal-content {
        width: 95%;
        margin: 2% auto;
        top: 20px;
    }
    
    .info-icon {
        width: 20px;
        height: 20px;
        line-height: 20px;
        font-size: 13px;
    }
    
    .membership-modal-header {
        padding: 12px 15px;
    }
    
    .membership-modal-body {
        padding: 15px;
        font-size: 15px;
    }
}