/**
 * Hello Middleton - Events Component
 * Styles for Events Strip, Events List, and The Events Calendar integration
 * Mobile-optimized with touch-friendly interactions
 *
 * @requires tokens.css
 * @since 2.1.4
 */

/* ==========================================================================
   EVENTS STRIP (Horizontal Scroll)
   ========================================================================== */

.events-strip {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--hm-border);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Strip Header */
.events-strip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--hm-primary) 0%, var(--hm-primary-dark) 100%);
    color: #fff;
}

.events-strip-icon {
    font-size: 20px;
}

.events-strip-title {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.events-strip-view-all {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: #fff !important;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.events-strip-view-all:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Events container - horizontal scroll */
.events-strip-items {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--hm-primary) #f1f5f9;
}

.events-strip-items::-webkit-scrollbar {
    height: 6px;
}

.events-strip-items::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.events-strip-items::-webkit-scrollbar-thumb {
    background: var(--hm-primary);
    border-radius: 3px;
}

/* Individual event item */
.events-strip-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    min-width: 280px;
    max-width: 320px;
    border-right: 1px solid var(--hm-border);
    text-decoration: none !important;
    color: inherit !important;
    scroll-snap-align: start;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.events-strip-item:last-child {
    border-right: none;
}

.events-strip-item:hover {
    background: var(--hm-primary-light);
}

/* Date badge */
.events-strip-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--hm-accent) 0%, var(--hm-accent-dark) 100%);
    color: #fff;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(15, 118, 110, 0.25);
}

.events-strip-month {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.9;
}

.events-strip-day {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    margin-top: 2px;
}

/* Event info */
.events-strip-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.events-strip-item-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--hm-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.events-strip-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: var(--hm-text-muted);
}

.events-strip-time,
.events-strip-venue {
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.events-strip-venue {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Empty state */
.events-strip--empty {
    text-align: center;
}

.events-strip--empty .events-strip-header {
    justify-content: center;
}

.events-strip-message {
    padding: 30px 20px;
    color: var(--hm-text-muted);
    font-size: 14px;
}

/* ==========================================================================
   EVENTS LIST (Sidebar Widget - Vertical)
   ========================================================================== */

.events-list {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.events-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--hm-bg-subtle);
    border-bottom: 1px solid var(--hm-border);
}

.events-list-icon {
    font-size: 1.25rem;
}

.events-list-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--hm-text);
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.events-list-view-all {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--hm-primary) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    transition: gap var(--duration-fast) var(--ease-out);
    position: relative;
}

.events-list-view-all:hover {
    gap: var(--space-2);
    color: var(--hm-primary-hover) !important;
}

.events-list-view-all::after {
    content: '\2192';
    transition: transform var(--duration-fast) var(--ease-out);
}

.events-list-view-all:hover::after {
    transform: translateX(2px);
}

/* Animated underline effect */
.events-list-view-all::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s var(--ease-out);
}

.events-list-view-all:hover::before {
    width: 100%;
}

.events-list-items {
    display: flex;
    flex-direction: column;
}

.events-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--hm-border);
    text-decoration: none !important;
    color: inherit !important;
    transition:
        background var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
    animation: slideInRight 0.4s var(--ease-out) both;
}

.events-list-item:last-child {
    border-bottom: none;
}

.events-list-item:hover {
    background: var(--hm-primary-light);
}

/* Staggered animation delays */
.events-list-item:nth-child(1) { animation-delay: 0.05s; }
.events-list-item:nth-child(2) { animation-delay: 0.1s; }
.events-list-item:nth-child(3) { animation-delay: 0.15s; }
.events-list-item:nth-child(4) { animation-delay: 0.2s; }
.events-list-item:nth-child(5) { animation-delay: 0.25s; }

.events-list-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--hm-primary);
    color: var(--hm-text-inverse);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.events-list-month {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.85;
}

.events-list-day {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}

/* Time badge for today's events */
.events-list-time-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: var(--space-2) var(--space-3);
    background: var(--hm-accent);
    color: var(--hm-text-inverse);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.events-list-time-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.events-list-venue-text {
    font-size: 12px;
    color: var(--hm-text-muted);
}

.events-list-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.events-list-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--hm-text);
    line-height: 1.3;
}

.events-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--hm-text-muted);
}

.events-list-time,
.events-list-venue {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Empty state */
.events-list--empty .events-list-header {
    justify-content: center;
}

.events-list-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-7) var(--space-5);
    text-align: center;
    color: var(--hm-text-muted);
}

.events-list-message::before {
    content: '\1F4ED';
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
    opacity: 0.5;
}

.events-list-message a {
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--hm-primary);
    color: var(--hm-text-inverse) !important;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition:
        background var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
}

.events-list-message a:hover {
    background: var(--hm-primary-hover);
    transform: translateY(-2px);
}

/* ==========================================================================
   SIDEBAR EVENTS WIDGET
   ========================================================================== */

.sidebar-events {
    background: var(--hm-bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--hm-border);
    overflow: hidden;
}

/* Sidebar Events Header */
.se-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    background: var(--hm-bg-subtle);
    border-bottom: 1px solid var(--hm-border);
    position: relative;
}

/* Accent line */
.se-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--hm-primary) 0%, var(--hm-accent) 100%);
}

.se-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--hm-text);
    letter-spacing: -0.01em;
}

.se-title span:first-child {
    font-size: 1.1rem;
    opacity: 0.85;
}

.se-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hm-primary);
    text-decoration: none;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-out);
}

.se-link:hover {
    background: rgba(180, 83, 9, 0.08);
    color: var(--hm-primary-hover);
}

.se-link::after {
    content: '\2192';
    font-size: 0.7rem;
    transition: transform var(--duration-fast) var(--ease-out);
}

.se-link:hover::after {
    transform: translateX(2px);
}

/* ==========================================================================
   EVENTS + CLASSIFIEDS SIDE BY SIDE LAYOUT
   ========================================================================== */

.hm-events-classifieds-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 20px;
    align-items: stretch !important;
    animation: fadeInUp 0.5s var(--ease-out) 0.2s both;
}

/* Force Elementor inner containers to be 50% width */
.hm-events-classifieds-row > .elementor-element,
.hm-events-classifieds-row > .e-con {
    flex: 1 1 50% !important;
    max-width: 50% !important;
    width: 50% !important;
}

/* Make both panels match height */
.hm-events-classifieds-row .events-list {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hm-events-classifieds-row .events-list-items {
    flex: 1;
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
}

/* ==========================================================================
   THE EVENTS CALENDAR OVERRIDES
   ========================================================================== */

/* Top bar datepicker */
.tribe-events-c-top-bar__datepicker-button {
    font-family: var(--font-body);
}

/* Navigation buttons */
.tribe-events-c-nav__list-item a {
    transition: all var(--duration-fast) var(--ease-out);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* ==========================================================================
   RESPONSIVE - TABLET (max-width: 900px)
   ========================================================================== */

@media (max-width: 900px) {
    .hm-events-classifieds-row {
        flex-direction: column !important;
        flex-wrap: wrap !important;
    }

    .hm-events-classifieds-row > .elementor-element,
    .hm-events-classifieds-row > .e-con {
        flex: 1 1 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* ==========================================================================
   RESPONSIVE - MOBILE (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .events-strip-item {
        min-width: 250px;
        padding: 14px 16px;
    }

    .events-strip-date {
        width: 50px;
        height: 50px;
    }

    .events-strip-day {
        font-size: 20px;
    }

    .events-strip-header {
        padding: 12px 16px;
    }

    /* Tribe Events Calendar mobile */
    .tribe-events-c-top-bar__datepicker-button,
    [class*="datepicker"] button {
        min-height: 44px !important;
        padding: 10px 16px !important;
        font-size: 0.9rem !important;
        border-radius: 10px !important;
    }

    .tribe-events-c-view-selector button,
    button[aria-label*="List"],
    button[aria-label*="Grid"] {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    .tribe-events-calendar-list__event,
    .events-strip-item {
        padding: 14px !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
    }

    .events-strip-date {
        min-width: 50px !important;
        padding: 8px !important;
    }

    .events-strip-day {
        font-size: 1.25rem !important;
        font-weight: 700 !important;
    }

    .tribe-events-calendar-list__event-title,
    .events-strip-item-title {
        font-size: 1rem !important;
        line-height: 1.35 !important;
    }

    .events-strip-time,
    .events-strip-venue {
        font-size: 0.8rem !important;
        color: var(--hm-text-secondary) !important;
    }

    .tribe-events-c-nav__list-item a {
        min-height: 44px !important;
        padding: 10px 16px !important;
        border-radius: 10px !important;
    }

    /* Events list mobile */
    .events-list-item {
        padding: var(--space-3) !important;
    }
}

/* ==========================================================================
   RESPONSIVE - SMALL MOBILE (max-width: 480px)
   ========================================================================== */

@media (max-width: 480px) {
    .events-strip-view-all {
        display: none;
    }
}

/* ==========================================================================
   ACCESSIBILITY - REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .events-list-item,
    .hm-events-classifieds-row {
        animation: none !important;
    }

    .events-strip-item,
    .events-list-item {
        transition: none !important;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

/* ==========================================================================
   SIDEBAR EVENTS WIDGET (se-* classes)
   ========================================================================== */

.se-list {
    display: flex;
    flex-direction: column;
}

.se-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    text-decoration: none;
    border-bottom: 1px solid var(--hm-border);
    transition: background var(--duration-fast) var(--ease-out);
}

.se-item:last-child {
    border-bottom: none;
}

.se-item:hover {
    background: var(--hm-bg-subtle);
}

.se-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--hm-primary, #B45309) 0%, var(--hm-primary-hover, #92400E) 100%);
    border-radius: var(--radius-md);
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.25);
    transition: all var(--duration-fast) var(--ease-out);
}

.se-item:hover .se-date {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.3);
}

.se-month {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.9;
}

.se-day {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.se-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 0;
}

.se-name {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.se-details {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--hm-text-muted);
}

.se-empty {
    padding: var(--space-4);
    text-align: center;
    font-size: 0.85rem;
    color: var(--hm-text-muted);
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .events-strip,
    .events-list,
    .sidebar-events {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }

    .events-strip-items {
        overflow: visible;
        flex-wrap: wrap;
    }

    .events-strip-item,
    .events-list-item,
    .se-item {
        break-inside: avoid;
    }
}
