/**
 * SmartRec Blocks Styles
 * Styling for Activity Grid, Sessions List, and Activity Calendar blocks.
 */

/* Activity Grid */
.smartrec-activity-grid {
    display: grid;
    gap: 24px;
}

/* SmartRec Upcoming Block Grid Images */
.smartrec_activity_grid .wp-block-post-featured-image {
    margin-bottom: 10px;
}

.smartrec_activity_grid .wp-block-post-featured-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.smartrec-activity-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    transition: box-shadow 0.2s ease,
        transform 0.2s ease;
}

.smartrec-activity-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.smartrec-activity-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.smartrec-activity-title {
    margin: 16px 16px 8px;
    font-size: 1.1em;
    line-height: 1.3;
}

.smartrec-activity-title a {
    color: inherit;
    text-decoration: none;
}

.smartrec-activity-title a:hover {
    color: #0073aa;
}

.smartrec-activity-date,
.smartrec-activity-price {
    margin: 0 16px 8px;
    font-size: 0.9em;
    color: #666;
}

.smartrec-activity-price {
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 16px;
}

/* Sessions List */
.smartrec-sessions-list {
    max-width: 800px;
}

.smartrec-sessions-date-header {
    background: #f5f5f5;
    padding: 10px 16px;
    margin: 16px 0 8px;
    font-size: 1em;
    font-weight: 600;
    border-left: 4px solid #0073aa;
}

.smartrec-sessions-date-header:first-child {
    margin-top: 0;
}

.smartrec-session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    gap: 16px;
}

.smartrec-session-item:last-child {
    border-bottom: none;
}

.smartrec-session-info {
    flex: 1;
    min-width: 0;
}

.smartrec-session-activity {
    display: block;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smartrec-session-activity:hover {
    color: #0073aa;
}

.smartrec-session-time,
.smartrec-session-date {
    font-size: 0.85em;
    color: #666;
}

.smartrec-session-price {
    font-weight: 600;
    color: #2e7d32;
    white-space: nowrap;
}

.smartrec-session-register {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.smartrec-session-register:hover {
    background: #005a87;
    color: #fff;
}

/* Activity Calendar */
.smartrec-calendar {
    max-width: 100%;
    font-family: inherit;
}

.smartrec-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 8px 8px 0 0;
}

.smartrec-calendar-title {
    font-size: 1.2em;
    font-weight: 600;
}

.smartrec-calendar-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 1.2em;
    transition: background 0.2s ease;
}

.smartrec-calendar-nav:hover {
    background: #e9e9e9;
}

.smartrec-calendar-grid {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e0e0e0;
}

.smartrec-calendar-grid th {
    background: #f9f9f9;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85em;
    color: #666;
    border: 1px solid #e0e0e0;
}

.smartrec-calendar-grid td {
    border: 1px solid #e0e0e0;
    vertical-align: top;
    padding: 8px;
    min-height: 100px;
    width: 14.28%;
}

.smartrec-calendar-empty {
    background: #fafafa;
}

.smartrec-calendar-day-number {
    display: block;
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 6px;
    color: #333;
}

.smartrec-past-activity {
    /* Grayscale effect for past activities */
}

/* Apply filter specifically to images inside the card/container */
/* Apply filter specifically to images inside the card/container */
.smartrec-related-card.smartrec-past-activity .smartrec-related-image {
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.smartrec-related-card.smartrec-past-activity:hover .smartrec-related-image {
    filter: grayscale(0%);
}

.smartrec-past-activity::after {
    /* Removed PAST pill overlay */
    content: none;
}

.smartrec-calendar-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.smartrec-calendar-event {
    display: block;
    background: #0073aa;
    color: #fff;
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smartrec-calendar-event:hover {
    background: #005a87;
    color: #fff;
}

.smartrec-calendar-legend {
    padding: 12px 16px;
    background: #f9f9f9;
    border-radius: 0 0 8px 8px;
    border: 1px solid #e0e0e0;
    border-top: none;
}

.smartrec-calendar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    color: #666;
}

.smartrec-calendar-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: #0073aa;
    border-radius: 2px;
}

/* No content messages */
.smartrec-no-activities,
.smartrec-no-sessions {
    padding: 24px;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .smartrec-activity-grid {
        grid-template-columns: 1fr !important;
    }

    .smartrec-session-item {
        flex-wrap: wrap;
    }

    .smartrec-calendar-grid td {
        padding: 4px;
        min-height: 60px;
    }

    .smartrec-calendar-event {
        font-size: 0.65em;
        padding: 2px 4px;
    }
}

/* WordPress Alignment Classes */
.smartrec-activity-grid.alignwide,
.smartrec-calendar.alignwide,
.smartrec-sessions-list.alignwide {
    width: 100%;
    max-width: var(--wp--style--global--wide-size, 1200px);
    margin-left: auto;
    margin-right: auto;
}

.smartrec-activity-grid.alignfull,
.smartrec-calendar.alignfull,
.smartrec-sessions-list.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Full width calendar table fix */
.smartrec-calendar.alignfull .smartrec-calendar-grid,
.smartrec-calendar.alignwide .smartrec-calendar-grid {
    width: 100%;
    table-layout: fixed;
}

/* Related Activities Carousel */
.smartrec-related-activities-container {
    margin: 40px 0;
    width: 100%;
}

.smartrec-related-title {
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 700;
}

.smartrec-related-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.smartrec-related-carousel::-webkit-scrollbar {
    display: none;
}

.smartrec-related-card {
    flex: 0 0 85%;
    /* Slightly less than 100% to show next card */
    scroll-snap-align: start;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    /* Removed large shadow and border */
    border: 1px solid #eee;
    transition: border-color 0.2s ease;
}

.smartrec-related-card:hover {
    /* Removed hover transform and shadow */
    border-color: #ddd;
}

.smartrec-related-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.smartrec-related-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%;
    /* 4:3 Aspect ratio for taller images */
    overflow: hidden;
    background: #f5f5f5;
}

.smartrec-related-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Removed scale transition */
}

/* Simple overlay effect on hover */
.smartrec-related-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease;
    pointer-events: none;
}

.smartrec-related-card:hover .smartrec-related-image-wrapper::after {
    background: rgba(0, 0, 0, 0.2);
}

/* Date Badge - REMOVED */

.smartrec-related-content {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.smartrec-related-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tablet */
@media (min-width: 600px) {
    .smartrec-related-card {
        flex: 0 0 calc(50% - 10px);
    }
}

/* Desktop */
@media (min-width: 1024px) {

    /* Switch to Grid Layout on Desktop */
    .smartrec-related-carousel {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
        overflow: visible;
        padding-bottom: 0;
    }

    .smartrec-related-card {
        flex: unset;
        scroll-snap-align: unset;
        width: 100%;
        height: 100%;
    }
}