/* =============================================================================
   CCM Booking Widget
   ============================================================================= */

.ccm-booking-widget {
    font-family: inherit;
    max-width: 820px;
    margin: 0 auto;
    color: #1a1a1a;
}

/* ---- Navigation ----------------------------------------------------------- */

.ccm-cal-nav {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ccm-cal-prev,
.ccm-cal-next {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    color: #333;
    padding: 0;
    margin-top: 6px;
}
.ccm-cal-prev:disabled { opacity: .35; cursor: default; }
.ccm-cal-prev:hover:not(:disabled),
.ccm-cal-next:hover { background: #f0f0f0; }

/* ---- Two-month grid ------------------------------------------------------- */

.ccm-cal-months {
    display: flex;
    gap: 2rem;
    flex: 1;
}

.ccm-cal-month {
    flex: 1;
    min-width: 260px;
}

@media (max-width: 640px) {
    .ccm-cal-months { flex-direction: column; gap: 1.25rem; }
    .ccm-cal-nav    { align-items: center; }
    .ccm-cal-prev,
    .ccm-cal-next   { margin-top: 0; }
}

/* ---- Month inner ---------------------------------------------------------- */

.ccm-cal-title {
    font-weight: 600;
    font-size: .95rem;
    text-align: center;
    margin-bottom: .5rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid #e5e7eb;
}

.ccm-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: .75rem;
    color: #6b7280;
    margin-bottom: 2px;
}

.ccm-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}

/* ---- Day cells ------------------------------------------------------------ */

.ccm-day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    user-select: none;
    border-radius: 3px;
    overflow: hidden;
}

.ccm-day span {
    position: relative;
    z-index: 1;
}

.ccm-day.ccm-empty { background: transparent; }

/* Past */
.ccm-day.ccm-past {
    color: #c0c0c0;
    background: transparent;
}

/* Today */
.ccm-day.ccm-today span {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Status: free */
.ccm-day.ccm-free { background: #f0fdf4; color: #166534; }

/* Status: blocked */
.ccm-day.ccm-blocked {
    background: #fee2e2;
    color: #991b1b;
    cursor: default;
}

/* Status: checkin — top-left free (green), bottom-right blocked (red) */
.ccm-day.ccm-checkin {
    background: #f0fdf4;
    color: #166534;
}
.ccm-day.ccm-checkin::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #fee2e2;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* Status: checkout — top-left blocked (red), bottom-right free (green) */
.ccm-day.ccm-checkout {
    background: #f0fdf4;
    color: #991b1b;
}
.ccm-day.ccm-checkout::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #fee2e2;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

/* Status: checkin_checkout */
.ccm-day.ccm-checkin_checkout {
    background: #fee2e2;
    color: #991b1b;
}

/* Cursor */
.ccm-day.ccm-clickable { cursor: pointer; }
.ccm-day.ccm-clickable:hover {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
    z-index: 2;
}

/* Selection */
.ccm-day.ccm-sel-start,
.ccm-day.ccm-sel-end {
    background: #2271b1 !important;
    color: #fff !important;
    border-radius: 50%;
    z-index: 2;
}
.ccm-day.ccm-sel-start::before,
.ccm-day.ccm-sel-end::before { display: none; }

.ccm-day.ccm-range {
    background: #dbeafe !important;
    color: #1e40af !important;
    border-radius: 0;
}
.ccm-day.ccm-range::before { display: none; }

.ccm-day.ccm-range-hover {
    background: #e0f0ff !important;
    color: #1e40af !important;
    border-radius: 0;
}
.ccm-day.ccm-range-hover::before { display: none; }

/* ---- Legend --------------------------------------------------------------- */

.ccm-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin: .75rem 0 1.25rem;
    font-size: .78rem;
}

.ccm-cal-legend span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.ccm-cal-legend span::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
}

.ccm-legend-free::before     { background: #f0fdf4; border: 1px solid #86efac; }
.ccm-legend-blocked::before  { background: #fee2e2; border: 1px solid #fca5a5; }
.ccm-legend-checkin::before  {
    background: linear-gradient(to bottom right, #f0fdf4 50%, #fee2e2 50%);
    border: 1px solid #d1d5db;
}
.ccm-legend-checkout::before {
    background: linear-gradient(to bottom right, #fee2e2 50%, #f0fdf4 50%);
    border: 1px solid #d1d5db;
}
.ccm-legend-selected::before { background: #2271b1; border-radius: 50%; }

/* ---- Booking form wrap ---------------------------------------------------- */

.ccm-booking-form-wrap {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1.25rem;
    background: #fafafa;
    margin-top: 1rem;
}

/* ---- Booking summary ------------------------------------------------------ */

.ccm-bk-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1.5rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.ccm-bk-dates {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.ccm-bk-dates span {
    display: flex;
    flex-direction: column;
    font-size: .85rem;
}

.ccm-bk-dates strong {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    margin-bottom: 1px;
}

.ccm-bk-arrow { color: #9ca3af; font-size: 1.1rem; align-self: center; }

.ccm-bk-price {
    font-size: .9rem;
    color: #374151;
    margin-left: auto;
}

.ccm-bk-price strong { color: #1a1a1a; font-size: 1rem; }

.ccm-booking-reset {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: .25rem .65rem;
    font-size: .8rem;
    cursor: pointer;
    color: #374151;
    margin-left: auto;
}
.ccm-booking-reset:hover { background: #f3f4f6; }

/* ---- Form fields ---------------------------------------------------------- */

.ccm-form-row {
    display: flex;
    gap: .75rem;
    margin-bottom: .75rem;
}

/* Single-column rows */
.ccm-form-row:not(.ccm-form-row-2) {
    flex-direction: column;
}

.ccm-form-row-2 > div {
    flex: 1;
}

.ccm-form-row label,
.ccm-form-row > div > label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .25rem;
}

.ccm-input {
    display: block;
    width: 100%;
    padding: .45rem .65rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: .9rem;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s;
}
.ccm-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,.15);
}

.ccm-booking-form.ccm-validated .ccm-input:invalid {
    border-color: #ef4444;
    background-color: #fef2f2;
}
.ccm-booking-form.ccm-validated .ccm-input:invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239,68,68,.15);
}
select.ccm-input { appearance: auto; }

/* ---- Notices -------------------------------------------------------------- */

.ccm-form-notice {
    padding: .65rem 1rem;
    border-radius: 4px;
    font-size: .875rem;
    margin-bottom: .75rem;
}
.ccm-notice-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}
.ccm-notice-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* ---- Submit button -------------------------------------------------------- */

.ccm-submit-btn {
    display: inline-block;
    padding: .6rem 1.4rem;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.ccm-submit-btn:hover:not(:disabled) { background: #135e96; }
.ccm-submit-btn:disabled { opacity: .6; cursor: default; }
