/* Main Wrapper */
.ably_calendar_wrapper {
    max-width: 900px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
    padding: 20px;
    /* background: #fff; */
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.ably_hidden {
    display: none !important;
}

/* Controls */
.ably_controls_row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.ably_nav_wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ably_nav_btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
    padding: 0;
}

.ably_nav_btn:hover {
    background: #eff6ff;
    color: #3b82f6;
    border-color: #3b82f6;
    transform: translateY(-1px);
}

.ably_nav_btn svg {
    width: 20px;
    height: 20px;
}

.ably_input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background-color: #f9fafb;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ably_input:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Grid Layout */
.ably_day_names {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    color: #4b5563;
}

.ably_calendar_grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    position: relative;
    min-height: 300px;
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 1;
    transform: translateY(0);
}

.ably_calendar_grid.ably_grid_loading {
    opacity: 0;
    transform: translateY(6px);
}

/* Day Cells */
.ably_day_cell {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 90px;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #fff;
}

.ably_day_link,
.ably_day_link:hover {
    text-decoration: none !important;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ably_day_cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ably_cell_header {
    background: #e5e7eb;
    /* Standard Gray Header */
    padding: 6px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid #d1d5db;
    color: #374151;
}

.ably_cell_header svg {
    width: 14px;
    height: 14px;
}

.ably_cell_body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    gap: 4px;
}

.ably_day_number_val {
    font-size: 18px;
    font-weight: 700;
}

.ably_status_text {
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

/* Status Variants */
/* Available */
.ably_day_cell.ably_status_available .ably_day_number_val {
    color: #10b981;
}

.ably_day_cell.ably_status_available .ably_status_text {
    color: #1f2937;
    font-weight: 700;
    text-align: center;
}

/* Low Availability / Urgency */
.ably_day_cell.ably_status_low {
    border-color: #fed7aa;
    background-color: #fff7ed;
}

.ably_day_cell.ably_status_low .ably_cell_header {
    background-color: #ffedd5;
    border-bottom-color: #fed7aa;
    color: #c2410c;
}

.ably_day_cell.ably_status_low .ably_day_number_val {
    color: #ea580c;
}

.ably_day_cell.ably_status_low .ably_status_text {
    color: #ea580c;
    font-weight: 700;
}

/* Sold Out / Zero */
.ably_day_cell.ably_status_soldout {
    border-color: #fecaca;
}

.ably_day_cell.ably_status_soldout .ably_cell_header {
    background-color: #fecaca;
    /* Reddish Header */
    border-bottom-color: #fca5a5;
    color: #b91c1c;
}

.ably_day_cell.ably_status_soldout .ably_day_number_val {
    color: #ef4444;
}

.ably_day_cell.ably_status_soldout .ably_status_text {
    color: #ef4444;
}

/* Blocked / Past Dates */
.ably_day_cell.ably_status_blocked {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.8;
}

.ably_day_cell.ably_status_blocked .ably_cell_header {
    background-color: #d1d5db;
    color: #6b7280;
    border-bottom-color: #9ca3af;
}

.ably_day_cell.ably_status_blocked .ably_day_number_val {
    color: #9ca3af;
}

.ably_day_cell.ably_status_blocked .ably_status_text {
    color: #9ca3af;
}

.ably_day_cell.ably_status_blocked:hover {
    transform: none;
    box-shadow: none;
}

/* Highlight / Today (Optional, as green in design) */
.ably_day_cell.ably_status_accent {
    border-color: #34d399;
    background-color: #ecfdf5;
}

.ably_day_cell.ably_status_accent .ably_cell_header {
    background-color: #34d399;
    color: #fff;
    border-bottom-color: #10b981;
}

/* Empty days */
.ably_day_empty {
    border: none;
    background: transparent;
}

.ably_day_status_row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.ably_status_icon {
    width: 14px;
    height: 14px;
}

/* Loader */
.ably_loader_overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 8px;
}

.ably_spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: ably_spin 1s linear infinite;
}

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

/* Skeleton Loading Animation */
@keyframes ably_shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.ably_skeleton_cell {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 90px;
    position: relative;
    overflow: hidden;
}

.ably_skeleton_cell::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0) 0, 
        rgba(255, 255, 255, 0.4) 50%, 
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: ably_shimmer 1.5s infinite;
}

.ably_skeleton_header {
    height: 30px;
    background: #e2e8f0;
    width: 100%;
    margin-bottom: 10px;
}

.ably_skeleton_body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
}

.ably_skeleton_circle {
    width: 24px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 50%;
}

.ably_skeleton_line {
    height: 12px;
    background: #e2e8f0;
    width: 60%;
    border-radius: 4px;
}

/* Summary Note */
.ably_month_summary {
    text-align: center;
    margin-bottom: 20px;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 13px;
    color: #475569;
    border: 1px dashed #cbd5e1;
    display: none;
}

.ably_month_summary strong {
    color: #1e293b;
}

.ably_spaces_legend {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
    color: #475569;
}

.ably_spaces_legend_items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
}

.ably_spaces_legend_item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.ably_spaces_legend_swatch {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    flex: 0 0 13px;
    border: 2px solid transparent;
}

.ably_spaces_legend_available {
    background: #10b981;
}

.ably_spaces_legend_low {
    background: #ea580c;
}

.ably_spaces_legend_soldout {
    background: #ef4444;
}

.ably_spaces_legend_blocked {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Responsive */
@media (max-width: 600px) {
    .ably_calendar_wrapper {
        padding: 10px;
    }

    .ably_calendar_grid {
        gap: 4px;
    }

    .ably_day_cell {
        min-height: 65px;
    }

    .ably_cell_body {
        padding: 5px;
    }

    .ably_day_number_val {
        font-size: 13px;
    }

    .ably_status_text {
        font-size: 9px;
    }

    .ably_status_icon {
        display: none !important;
    }

    .ably_day_names {
        font-size: 11px;
    }

    .ably_cell_header {
        padding: 4px;
        font-size: 11px;
    }

    .ably_spaces_legend {
        margin-top: 14px;
        padding-top: 12px;
    }

    .ably_spaces_legend_items {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 10px;
    }

    .ably_spaces_legend_item {
        font-size: 11px;
        align-items: flex-start;
    }
}
