/* ==========================================================================
   Events & Rides Feed Styles - Refined UI
   ========================================================================== */

/* Variables */
:root {
    --erf-primary: #0f172a;
    --erf-primary-light: #1e293b;
    --erf-accent: #3b82f6;
    --erf-secondary: #f8fafc;
    --erf-text: #1e293b;
    --erf-text-light: #64748b;
    --erf-border: #e2e8f0;
    --erf-bg: #ffffff;
    --erf-border-radius: 12px;
    --erf-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --erf-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --erf-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --erf-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desktop Margin Reset for Theme Container */
@media (min-width: 992px) {
    .container-wrap {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

/* Container */
.erf-container {
    max-width: 1200px;
    margin: 0 auto 100px auto; /* Added bottom margin */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--erf-text);
    padding: 0 20px;
}

.erf-main-title {
    font-size: 42px;
    font-weight: 800;
    color: var(--erf-primary);
    margin: 40px 0 10px 0;
    letter-spacing: -1px;
    line-height: 1.2;
}

.erf-light-and {
    font-weight: 300;
    font-style: italic;
    opacity: 0.8;
    padding: 0 5px;
}

/* Title Crusher: Hide the generic block editor title if it's right above our feed */
.wp-block-heading + .erf-container,
.entry-title + .erf-container {
    margin-top: 0;
}

/* If the heading is a direct predecessor, we hide it to let our premium title shine */
h1.wp-block-heading, h2.wp-block-heading, h3.wp-block-heading {
    display: none !important;
}

/* But we MUST make sure our own title stays visible */
.erf-container .erf-main-title {
    display: block !important;
}

/* Tabs - Premium Segmented Control */
.erf-tabs {
    display: inline-flex; /* Use inline-flex to fit content or stay left */
    align-items: center;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 14px;
    margin: 30px 0 30px 0; /* Consistent vertical spacing, left aligned */
    width: 100%;
    max-width: 500px;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

.erf-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 0 20px;
    font-size: 15px;
    font-weight: 700;
    color: var(--erf-text-light);
    cursor: pointer;
    border-radius: 10px;
    transition: var(--erf-transition);
    height: 40px; /* Precise height */
    line-height: 1;
    margin: 0;
}

.erf-tab-btn:hover {
    color: var(--erf-primary);
}

.erf-tab-btn.active {
    color: var(--erf-primary);
    background: var(--erf-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.erf-tab-btn span.dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    margin: 0; /* Remove any default margins */
}

.erf-tab-btn.active span.dashicons {
    color: var(--erf-accent);
}

/* Tab Content */
.erf-tab-content {
    display: none;
}

.erf-tab-content.active {
    display: block;
    animation: erfFadeInUp 0.4s ease-out;
}

@keyframes erfFadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Grid */
.erf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
}

/* Cards */
.erf-card {
    background: var(--erf-bg);
    border: 1px solid var(--erf-border);
    border-radius: var(--erf-border-radius);
    overflow: hidden;
    text-decoration: none !important;
    color: inherit !important;
    transition: var(--erf-transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--erf-shadow-sm);
}

.erf-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--erf-shadow-lg);
    border-color: var(--erf-accent);
}

.erf-card-image {
    position: relative;
    width: 100%;
    padding-top: 60%; /* Slightly taller than 16:9 */
    background: var(--erf-secondary);
    overflow: hidden;
}

.erf-card-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.5s ease;
}

.erf-card:hover .erf-card-image img {
    transform: scale(1.05);
}

.erf-no-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.erf-no-image::after {
    content: '\f128';
    font-family: 'dashicons';
    font-size: 40px;
    color: #cbd5e1;
}

.erf-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: var(--erf-accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px; /* Architectural corners */
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.erf-badge.ride {
    background: #FF4500; /* Vibrant Racing Orange */
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
}

.erf-badge.event {
    background: #0047AB; /* Jewel Royal Blue */
    box-shadow: 0 4px 12px rgba(0, 71, 171, 0.3);
}

.erf-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.erf-card-title {
    font-size: 19px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.3;
    color: var(--erf-primary);
    transition: color 0.2s ease;
    /* Ensure descriptions align by standardizing title height */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em; 
}

.erf-card:hover .erf-card-title {
    color: var(--erf-accent);
}

.erf-card-date {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--erf-text-light);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.erf-card-date span.dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: var(--erf-accent);
}

.erf-card-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: var(--erf-text-light);
    margin-top: 0; /* Remove auto margin to align from top */
}

/* Empty State */
.erf-no-items {
    text-align: center;
    padding: 80px 40px;
    color: var(--erf-text-light);
    background: var(--erf-secondary);
    border: 2px dashed var(--erf-border);
    border-radius: var(--erf-border-radius);
    font-size: 16px;
    font-weight: 500;
}

.erf-no-items span.dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    color: #cbd5e1;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.erf-no-items strong {
    display: block;
    font-size: 18px;
    color: var(--erf-primary);
}

.erf-no-items p {
    margin: 10px 0 0 0;
    font-size: 15px;
    font-weight: 400;
    opacity: 0.7;
}

/* ==========================================================================
   Single View Styles
   ========================================================================== */
.erf-single-wrapper {
    max-width: 800px;
    margin: 40px auto 100px auto;
}

.erf-single-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 24px;
    background: #f8fafc;
    border: 1px solid var(--erf-border);
    border-radius: var(--erf-border-radius);
    margin-bottom: 40px;
}

.erf-meta-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--erf-text);
}

.erf-meta-item span.dashicons {
    color: var(--erf-accent);
}

.erf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--erf-primary);
    color: #fff !important;
    padding: 14px 28px;
    border-radius: 10px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 15px;
    transition: var(--erf-transition);
    border: none;
    cursor: pointer;
}

.erf-btn:hover {
    background: var(--erf-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Layout with Sidebar */
.erf-tab-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.erf-main-content {
    flex: 1;
    min-width: 0; /* Prevent flex blowout */
}

.erf-sidebar {
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 150px;
    z-index: 10;
}

.erf-widget {
    background: var(--erf-bg);
    border: 1px solid var(--erf-border);
    border-radius: var(--erf-border-radius);
    padding: 24px;
    box-shadow: var(--erf-shadow-sm);
}

.erf-widget-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: var(--erf-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Calendar Styles */
.erf-calendar {
    width: 100%;
    border-collapse: collapse;
}

.erf-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.erf-calendar-month {
    font-weight: 700;
    font-size: 15px;
}

.erf-calendar-container-wrapper {
    width: 100%;
    min-height: 280px;
}

.erf-calendar-nav {
    display: flex;
    gap: 10px;
}

.erf-calendar-nav-btn {
    background: #f1f5f9;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--erf-text);
    transition: var(--erf-transition);
}

.erf-calendar-nav-btn:hover {
    background: var(--erf-border);
}

/* Universal CSS Arrows */
.erf-arrow-left, .erf-arrow-right {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}

.erf-arrow-left { 
    transform: rotate(45deg); 
    margin-left: 2px;
}

.erf-arrow-right { 
    transform: rotate(-135deg); 
    margin-right: 2px;
}

.erf-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.erf-calendar-day-head {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-align: center;
    padding-bottom: 8px;
}

.erf-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: default;
    color: #cbd5e1;
}

.erf-calendar-day.current-month {
    color: var(--erf-text);
}

.erf-calendar-day.has-event {
    background: #3b82f6; /* Vibrant Blue */
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.erf-calendar-day.has-event:hover {
    background: #2563eb;
    color: #fff;
    transform: scale(1.1);
    z-index: 2;
}

.erf-calendar-day.selected,
.erf-calendar-day.selected:hover {
    background: var(--erf-primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    transform: scale(1.1) !important;
    z-index: 3;
}

.erf-btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .erf-container {
        padding: 0 15px; /* Tighter padding for mobile */
    }

    .erf-tabs {
        display: flex; /* Force flex to ensure it respects left alignment */
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }

    .erf-main-title {
        font-size: 32px;
        margin: 20px 0 10px 0;
        letter-spacing: -0.5px;
    }

    .erf-tab-layout {
        flex-direction: column;
        gap: 30px;
    }
    
    .erf-sidebar {
        order: -1; 
        width: 100%;
        position: static;
        margin-bottom: 15px; /* Minimal margin */
    }

    .erf-widget {
        padding: 10px; /* Minimal padding */
    }

    .erf-widget-title {
        display: none; /* Hide title to save space */
    }

    .erf-calendar-header {
        margin-bottom: 8px;
    }

    .erf-calendar-month {
        font-size: 13px;
    }

    .erf-calendar-grid {
        gap: 1px; /* Absolute minimum gap */
    }

    .erf-calendar-day-head {
        padding-bottom: 4px;
        font-size: 10px;
    }

    .erf-calendar-day {
        font-size: 11px;
        border-radius: 4px;
        height: 30px; /* Compact height */
    }
}

/* Pagination */
.erf-pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
}

.erf-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--erf-bg);
    border: 1px solid var(--erf-border);
    border-radius: 8px;
    color: var(--erf-text);
    text-decoration: none !important;
    font-weight: 700;
    font-size: 14px;
    transition: var(--erf-transition);
}

.erf-pagination .page-numbers:hover {
    border-color: var(--erf-accent);
    color: var(--erf-accent);
    transform: translateY(-2px);
    box-shadow: var(--erf-shadow-sm);
}

.erf-pagination .page-numbers.current {
    background: var(--erf-primary);
    border-color: var(--erf-primary);
    color: #fff;
    cursor: default;
}

.erf-pagination .page-numbers.dots {
    border: none;
    background: transparent;
    cursor: default;
}

.erf-pagination .page-numbers .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Filter Status Bar */
.erf-filter-status {
    display: flex;
    align-items: center;
    padding: 0 5px 15px 5px;
    border-bottom: 1px solid var(--erf-border);
    margin-bottom: 30px;
    font-size: 14px;
    color: var(--erf-text);
}

.erf-filter-status strong {
    color: var(--erf-primary);
    font-weight: 700;
    margin-left: 5px;
}

.erf-clear-link {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    transition: var(--erf-transition);
}

.erf-clear-link:hover {
    color: #ef4444;
}

.erf-clear-link .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* AJAX Loading State */
.erf-ajax-container {
    position: relative;
    min-height: 400px;
    transition: opacity 0.3s ease;
}

.erf-ajax-container.erf-loading {
    opacity: 0.4;
    pointer-events: none;
}

.erf-ajax-container.erf-loading::after {
    content: "";
    position: absolute;
    top: 150px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--erf-border);
    border-top-color: var(--erf-primary);
    border-radius: 50%;
    animation: erf-spin 0.8s linear infinite;
    z-index: 100;
}

@keyframes erf-spin {
    to { transform: translateX(-50%) rotate(360deg); }
}
