/**
 * RadioMonster Event Search - Frontend Styles
 * 
 * Styles for [rm_events_list], [rm_events_grid], [rm_events_calendar] shortcodes.
 * 
 * @package RadioMonster
 * @since 1.1.0
 */

/* ==========================================================================
   Common
   ========================================================================== */

.rm-events-wrapper {
    margin: 20px 0;
}

.rm-events-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   Filter Bar
   ========================================================================== */

.rm-events-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.rm-events-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.rm-events-filter-row--search {
    flex-wrap: nowrap;
}

.rm-events-filter-row--search .rm-events-filter {
    width: 100%;
    min-width: 0;
}

.rm-events-filter-row:not(.rm-events-filter-row--search) .rm-events-filter {
    flex: 1 1 0;
    min-width: 120px;
}

.rm-events-filter-date-pair {
    display: flex;
    gap: 10px;
    flex: 1 1 0;
    min-width: 120px;
}

.rm-events-filter-date-pair .rm-events-filter {
    flex: 1 1 0;
    min-width: 0;
}

.rm-events-filter-bar .rm-events-filter,
.rm-events-filter-bar input[type="search"].rm-events-filter,
.rm-events-filter-bar input[type="date"].rm-events-filter,
.rm-events-filter-bar select.rm-events-filter {
    padding: 8px 12px;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    font-family: inherit;
    background: #fff !important;
    color: #333 !important;
    height: 38px !important;
    box-sizing: border-box;
    margin: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none;
    transition: border-color 0.2s ease;
}

.rm-events-filter-bar select.rm-events-filter {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='6'%3E%3Cpath d='M0 0l6 6 6-6z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}



.rm-events-filter-bar .rm-events-filter:hover,
.rm-events-filter-bar .rm-events-filter:focus {
    border-color: #5cb13e;
    outline: none;
    box-shadow: none;
}

.rm-events-content {
    transition: opacity 0.2s ease;
    position: relative;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.rm-events-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    padding: 10px 0;
    flex-wrap: wrap;
}

.rm-events-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    line-height: 1;
}

.rm-events-page-link:hover {
    background: #f0f0f0;
    border-color: #5cb13e;
    color: #5cb13e;
    text-decoration: none;
}

.rm-events-page-link.is-active {
    background: #5cb13e;
    border-color: #5cb13e;
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.rm-events-page-link.is-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.rm-events-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 36px;
    font-size: 14px;
    color: #999;
    pointer-events: none;
}

/* Loading overlay */
.rm-events-content.is-loading {
    opacity: 0.4;
    pointer-events: none;
    min-height: 80px;
}

.rm-events-loading-spinner {
    display: none;
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.rm-events-loading-spinner.is-visible {
    display: block;
}

.rm-events-loading-spinner::after {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #5cb13e;
    border-radius: 50%;
    animation: rm-spin 0.7s linear infinite;
}

@keyframes rm-spin {
    to { transform: rotate(360deg); }
}

.rm-event-ticket-link {
    display: inline-block;
    padding: 4px 12px;
    background: #5cb13e;
    color: #fff !important;
    border: 1px solid #5cb13e;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    box-sizing: border-box;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.rm-event-ticket-link:hover {
    background: #4a9632;
    border-color: #4a9632;
    color: #fff !important;
}

.rm-event-info-link {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    color: #333 !important;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.rm-event-info-link:hover {
    border-color: #5cb13e;
    color: #5cb13e !important;
}

/* ==========================================================================
   List View (card rows)
   ========================================================================== */

.rm-events-list-wrapper {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.rm-events-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    transition: background 0.15s ease;
}

.rm-events-row:first-child {
    border-top: 1px solid #eee;
}

.rm-events-row:hover {
    background: #f8f9fa;
}

.rm-events-row-date {
    flex: 0 0 56px;
    text-align: center;
    background: #5cb13e;
    color: #fff;
    border-radius: 6px;
    padding: 8px 4px 6px;
    line-height: 1.1;
}

.rm-events-row-day {
    display: block;
    font-size: 22px;
    font-weight: 700;
}

.rm-events-row-month {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rm-events-row-weekday {
    display: block;
    font-size: 10px;
    opacity: 0.75;
    margin-top: 2px;
}

.rm-events-row-info {
    flex: 1;
    min-width: 0;
}

.rm-events-row-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 2px;
}

.rm-events-row-artist {
    font-size: 13px;
    color: #666;
    margin-bottom: 2px;
}

.rm-events-row-meta {
    font-size: 12px;
    color: #888;
    font-weight: 400 !important;
}

.rm-events-row-time {
    white-space: nowrap;
}

/* Description (expandable, shared across list + grid) */
.rm-events-description-wrap {
    margin-top: 4px;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    font-weight: 400 !important;
}

.rm-events-description-wrap.is-clamped .rm-events-description {
    display: -webkit-box;
    -webkit-line-clamp: var(--rm-desc-lines, 1);
    line-clamp: var(--rm-desc-lines, 1);
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rm-events-description-toggle {
    display: none;
    color: #5cb13e;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.rm-events-description-toggle.is-visible {
    display: inline;
}

.rm-events-description-toggle:hover {
    color: #4a9632;
    text-decoration: underline;
}

.rm-events-row-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ==========================================================================
   Grid View
   ========================================================================== */

.rm-events-grid {
    display: grid;
    grid-template-columns: repeat(var(--rm-grid-columns, 3), 1fr);
    gap: 20px;
    margin: 20px 0;
}

.rm-events-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.rm-events-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.rm-events-card-content {
    padding: 16px;
    position: relative;
}

.rm-events-card-date {
    display: inline-block;
    background: #5cb13e;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    text-align: center;
    line-height: 1.1;
    margin-bottom: 10px;
}

.rm-events-card-day {
    display: block;
    font-size: 20px;
    font-weight: 700;
}

.rm-events-card-month {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rm-events-card-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.rm-events-card-artist {
    font-size: 14px;
    color: #666;
    margin: 0 0 6px 0;
}

.rm-events-card-location {
    font-size: 13px;
    color: #888;
    margin: 0 0 6px 0;
}

.rm-events-card-location small {
    color: #aaa;
}

.rm-events-card-time {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px 0;
}

.rm-events-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ==========================================================================
   Calendar View
   ========================================================================== */

.rm-events-calendar {
    margin: 20px 0;
}

.rm-events-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 8px;
}

.rm-events-cal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.rm-events-cal-nav {
    padding: 6px 12px;
    text-decoration: none;
    font-size: 18px;
    color: #5cb13e !important;
}

.rm-events-cal-nav:hover {
    color: #4a9632 !important;
}

.rm-events-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e0e0e0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.rm-events-cal-weekday {
    background: #f5f5f5;
    padding: 8px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    color: #666;
}

.rm-events-cal-day {
    background: #fff;
    min-height: 90px;
    padding: 6px;
    position: relative;
    vertical-align: top;
}

.rm-events-cal-empty {
    background: #fafafa;
}

.rm-events-cal-today {
    background: #f2f9f0;
}

.rm-events-cal-today .rm-events-cal-daynum {
    background: #5cb13e;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rm-events-cal-has-events {
    background: #fefff0;
}

.rm-events-cal-daynum {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.rm-events-cal-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rm-events-cal-event {
    display: block;
    font-size: 11px;
    padding: 2px 4px;
    background: #eef8eb;
    color: #5cb13e !important;
    border-radius: 3px;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s;
}

a.rm-events-cal-event:hover {
    background: #d4eece;
}

.rm-events-cal-more {
    font-size: 10px;
    color: #888;
    padding: 1px 4px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .rm-events-grid {
        grid-template-columns: 1fr;
    }

    .rm-events-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .rm-events-row-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .rm-events-filter-bar {
        padding: 10px 12px;
    }

    .rm-events-filter-row:not(.rm-events-filter-row--search) {
        flex-direction: column;
    }

    .rm-events-filter-row:not(.rm-events-filter-row--search) > .rm-events-filter {
        width: 100%;
        min-width: 0;
    }

    .rm-events-filter-date-pair {
        width: 100%;
    }

    .rm-events-cal-grid {
        font-size: 12px;
    }

    .rm-events-cal-day {
        min-height: 60px;
        padding: 4px;
    }

    .rm-events-cal-event {
        font-size: 9px;
    }

    .rm-events-description-wrap {
        --rm-desc-lines: 2;
    }
}

@media (max-width: 480px) {
    .rm-events-grid {
        gap: 12px;
    }

    .rm-events-row-date {
        flex: 0 0 48px;
    }

    .rm-events-row-day {
        font-size: 18px;
    }

    .rm-events-cal-day {
        min-height: 40px;
    }

    .rm-events-cal-events {
        display: none;
    }

    .rm-events-cal-has-events .rm-events-cal-daynum::after {
        content: '';
        display: block;
        width: 6px;
        height: 6px;
        background: #5cb13e;
        border-radius: 50%;
        margin: 3px auto 0;
    }
}
