/**
 * WC Product Rentals - Frontend Styles
 */

/* =============================================================================
   RENTAL PRODUCTS LIST (Shortcode)
   ============================================================================= */

.wcr-rental-products {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.wcr-rental-product {
    display: flex;
    gap: 30px;
    padding: 25px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.wcr-rental-product:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wcr-product-image {
    flex: 0 0 250px;
}

.wcr-product-image img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    object-fit: cover;
}

.wcr-product-details {
    flex: 1;
}

.wcr-product-title {
    margin: 0 0 15px 0;
    font-size: 1.5em;
    color: #333;
}

.wcr-product-description {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

.wcr-product-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

/* =============================================================================
   PRICING TIERS
   ============================================================================= */

.wcr-pricing-tiers h4 {
    margin: 0 0 10px 0;
    font-size: 1em;
    color: #333;
}

.wcr-pricing-tiers ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wcr-pricing-tiers li {
    background: #f5f5f5;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 0.9em;
}

.wcr-tier-label {
    color: #666;
}

.wcr-tier-price {
    font-weight: 600;
    color: #2e7d32;
    margin-left: 5px;
}

.wcr-book-button {
    padding: 6px 32px;
    font-size: 1.1rem;
    font-weight: 400;
}

.wcr-book-button .ct-icon {
    transform: rotate(90deg);
    fill: white;
    margin-left: 16px;
}

/* =============================================================================
   AVAILABILITY CALENDAR
   ============================================================================= */

.wcr-availability {
    margin-bottom: 20px;
}

.wcr-availability h4 {
    margin: 0 0 10px 0;
    font-size: 1em;
    color: #333;
}

.wcr-calendar-container {
    margin-bottom: 10px;
}

.wcr-availability-calendar {
    width: 100%;
    max-width: 300px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
}

.wcr-availability-calendar:focus {
    outline: none;
    border-color: #2271b1;
}

.wcr-calendar-legend {
    font-size: 0.85em;
    color: #666;
    margin: 10px 0 0 0;
}

.wcr-legend-available {
    color: #4caf50;
    margin-right: 5px;
}

.wcr-legend-booked {
    color: #f44336;
    margin-left: 15px;
    margin-right: 5px;
}

/* Selected price display in list view */
.wcr-selected-price {
    margin-top: 15px;
    padding: 12px 15px;
    background: #e8f5e9;
    border-radius: 6px;
    color: #2e7d32;
    font-size: 1em;
}

/* Flatpickr customization for booked dates */
.flatpickr-day.booked-date {
    background: #ffcdd2 !important;
    border-color: #f44336 !important;
    color: #c62828 !important;
    cursor: not-allowed !important;
}

.flatpickr-day.booked-date:hover {
    background: #ef9a9a !important;
}

/* Available dates styling (future dates that aren't booked) */
.flatpickr-day:not(.flatpickr-disabled):not(.booked-date):not(.prevMonthDay):not(.nextMonthDay) {
    background: #e8f5e9;
    border-color: #c8e6c9;
}

.flatpickr-day:not(.flatpickr-disabled):not(.booked-date):not(.prevMonthDay):not(.nextMonthDay):hover {
    background: #c8e6c9;
    border-color: #a5d6a7;
}

/* Selected dates styling */
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange {
    background: #4caf50 !important;
    border-color: #4caf50 !important;
    color: #fff !important;
}

.flatpickr-day.inRange {
    background: #c8e6c9 !important;
    border-color: #c8e6c9 !important;
}

/* =============================================================================
   BOOKING MODAL
   ============================================================================= */

.wcr-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    overflow-y: auto;
}

.wcr-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: visible;
}

/* Ensure Flatpickr calendar appears above modal content */
.wcr-modal-content .flatpickr-calendar {
    z-index: 1000000 !important;
}

/* Position modal calendar properly */
.wcr-form-row .flatpickr-calendar {
    left: 0 !important;
    right: auto !important;
}

.flatpickr-calendar {
    z-index: 1000000 !important;
}

.wcr-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.wcr-modal-close:hover {
    color: #333;
}

.wcr-modal-content h2 {
    margin: 0 0 5px 0;
    color: #333;
}

.wcr-modal-content h3 {
    margin: 0 0 25px 0;
    color: #666;
    font-weight: normal;
    font-size: 1.1em;
}

/* =============================================================================
   BOOKING FORM
   ============================================================================= */

#wcr-booking-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wcr-form-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wcr-form-row label {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

.wcr-form-row input,
.wcr-form-row textarea {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.2s;
}

.wcr-form-row input:focus,
.wcr-form-row textarea:focus {
    outline: none;
    border-color: #2271b1;
}

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

.wcr-price-display {
    background: #e8eef5;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    font-size: 1.1em;
}

.wcr-price-display #wcr-calculated-price {
    color: #5D9CEC;
    font-weight: 700;
    font-size: 1.2em;
}

.wcr-submit-booking {
    padding: 8px 32px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.wcr-submit-booking:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* =============================================================================
   SINGLE PRODUCT PAGE
   ============================================================================= */

.wcr-single-product-rental {
    margin: 30px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.wcr-single-product-rental h3 {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #2271b1;
    color: #333;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 768px) {
    .wcr-rental-product {
        flex-direction: column;
    }
    
    .wcr-product-image {
        flex: none;
        max-width: 100%;
    }
    
    .wcr-pricing-tiers ul {
        flex-direction: column;
    }
    
    .wcr-modal-content {
        margin: 10px;
        width: calc(100% - 20px);
        padding: 20px;
    }
}

/* =============================================================================
   NOTIFICATIONS / ALERTS
   ============================================================================= */

.wcr-message {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

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

.wcr-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* =============================================================================
   LOADING STATE
   ============================================================================= */

.wcr-loading {
    position: relative;
    pointer-events: none;
}

.wcr-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcr-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: wcr-spin 1s linear infinite;
    margin-right: 10px;
}

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