/* ==========================================================================
   RMTS Frontend — Rental Date Picker
   ========================================================================== */

.rmts-date-picker-wrap {
    margin: 16px 0 20px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
}

.rmts-date-picker-wrap label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: #1d2327;
}

.rmts-date-picker-wrap input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    box-sizing: border-box;
}

.rmts-date-picker-wrap input[type="text"]:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Hidden state for date picker (shown after unit selection) */
.rmts-date-picker-wrap.rmts-picker-hidden {
    display: none;
}

/* Duration info line */
.rmts-duration-info {
    margin-top: 8px;
    font-size: 13px;
    color: #2271b1;
    font-weight: 500;
}

/* Availability loading / info text */
.rmts-availability-info {
    margin-top: 6px;
    font-size: 12px;
    color: #757575;
    font-style: italic;
    min-height: 18px;
}

/* ==========================================================================
   Unit Selector — Shared
   ========================================================================== */

.rmts-unit-selector-wrap {
    margin: 16px 0 12px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
}

.rmts-unit-selector-wrap > label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
    color: #1d2327;
}

.rmts-unit-info {
    margin-top: 8px;
    font-size: 12px;
    color: #757575;
    font-style: italic;
    min-height: 18px;
}

.rmts-unit-loading {
    color: #757575;
    font-style: italic;
    font-size: 13px;
    padding: 8px 0;
    margin: 0;
}

.rmts-no-units {
    color: #999;
    font-style: italic;
    font-size: 13px;
    padding: 8px 0;
    margin: 0;
}

/* ==========================================================================
   Unit Selector — Dropdown Mode
   ========================================================================== */

.rmts-unit-dropdown {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    box-sizing: border-box;
    appearance: auto;
}

.rmts-unit-dropdown:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

/* ==========================================================================
   Unit Selector — Card Grid Mode
   ========================================================================== */

.rmts-unit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.rmts-unit-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    overflow: hidden;
}

.rmts-unit-card:hover {
    border-color: #b0b0b0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.rmts-unit-card.rmts-unit-selected {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2), 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Card image */
.rmts-unit-image {
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rmts-unit-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rmts-unit-no-image .rmts-unit-placeholder-icon {
    font-size: 36px;
    color: #ccc;
    line-height: 1;
}

/* Card body */
.rmts-unit-card-body {
    padding: 10px 12px;
}

.rmts-unit-label {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    margin-bottom: 4px;
}

.rmts-unit-price {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
}

.rmts-unit-price.rmts-price-up {
    color: #b91c1c;
}

.rmts-unit-price.rmts-price-down {
    color: #15803d;
}

/* Unit attributes */
.rmts-unit-attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.rmts-unit-attr {
    display: inline-block;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1.4;
}

/* Selected checkmark overlay */
.rmts-unit-card.rmts-unit-selected .rmts-unit-label::before {
    content: "\2713 ";
    color: #2271b1;
    font-weight: 700;
}

/* ==========================================================================
   Responsive — Unit Grid
   ========================================================================== */

@media (max-width: 480px) {
    .rmts-unit-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .rmts-unit-image {
        height: 90px;
    }

    .rmts-unit-card-body {
        padding: 8px 10px;
    }

    .rmts-unit-label {
        font-size: 13px;
    }
}

/* ==========================================================================
   Flatpickr Customization
   ========================================================================== */

/* Unavailable / blacked-out dates — prefixed with .rmts- so only our plugin's
   custom classes apply; these classes are added by rmts-frontend.js onDayCreate. */
.flatpickr-day.rmts-unavailable {
    background: #f5e6e6 !important;
    color: #c9302c !important;
    text-decoration: line-through;
    cursor: not-allowed !important;
    pointer-events: none;
}

.flatpickr-day.rmts-unavailable:hover {
    background: #f5e6e6 !important;
}

/* Blackout dates — distinctly marked */
.flatpickr-day.rmts-blackout {
    background: #fef3c7 !important;
    color: #92400e !important;
    text-decoration: line-through;
    cursor: not-allowed !important;
    pointer-events: none;
}

.flatpickr-day.rmts-blackout:hover {
    background: #fef3c7 !important;
}

/* Buffer zone dates — visually softened */
.flatpickr-day.rmts-buffer {
    background: #f3f4f6 !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    pointer-events: none;
    font-style: italic;
}

.flatpickr-day.rmts-buffer:hover {
    background: #f3f4f6 !important;
}

/* Selected range styling — scoped to RMTS picker instances */
.rmts-date-picker-wrap ~ .flatpickr-calendar .flatpickr-day.selected,
.rmts-date-picker-wrap ~ .flatpickr-calendar .flatpickr-day.startRange,
.rmts-date-picker-wrap ~ .flatpickr-calendar .flatpickr-day.endRange,
.flatpickr-calendar.rmts-picker .flatpickr-day.selected,
.flatpickr-calendar.rmts-picker .flatpickr-day.startRange,
.flatpickr-calendar.rmts-picker .flatpickr-day.endRange {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #fff !important;
}

.rmts-date-picker-wrap ~ .flatpickr-calendar .flatpickr-day.inRange,
.flatpickr-calendar.rmts-picker .flatpickr-day.inRange {
    background: #e8f0fe !important;
    border-color: #e8f0fe !important;
    color: #1d2327 !important;
}
