/* ============================================
   OMGPOP NETWORK - Events & Schedule Styles
   Optimized Layout & Responsive Design
   ============================================ */

/* ============================================
   PAGE LAYOUT
   ============================================ */

.events-container {
    max-width: 100%;
    padding: 1rem;
    padding-top: 2rem;
    padding-bottom: 3rem;
    margin: 0 auto;
}

.events-header {
    text-align: center;
    margin: 0 0 2rem 0;
    animation: fadeInScale 0.8s ease-out;
}

.page-title {
    font-size: clamp(1.5rem, 6vw, 3rem);
    color: var(--text-color);
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.page-subtitle {
    font-size: clamp(0.65rem, 2vw, 0.95rem);
    color: var(--text-color);
    opacity: 0.85;
    letter-spacing: 0.1em;
    margin: 0;
}

/* ============================================
   FILTERS & CONTROLS - OPTIMIZED LAYOUT
   ============================================ */

.filters-section {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid var(--text-color);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-start;
}

.filter-btn {
    padding: 0.5rem 0.9rem;
    font-size: clamp(0.55rem, 1.2vw, 0.75rem);
    font-family: 'Press Start 2P', cursive;
    border: 2px solid var(--text-color);
    background: white;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.filter-btn:hover {
    background: var(--primary-light);
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.15);
}

.filter-btn.active {
    background: var(--primary-dark);
    color: white;
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
}

.sort-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.sort-select {
    padding: 0.5rem 0.8rem;
    font-size: clamp(0.55rem, 1.2vw, 0.75rem);
    font-family: 'Press Start 2P', cursive;
    border: 2px solid var(--text-color);
    background: white;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-select:hover,
.sort-select:focus {
    background: var(--primary-light);
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.15);
}

.timezone-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.timezone-label {
    font-size: clamp(0.55rem, 1.2vw, 0.75rem);
    font-family: 'Press Start 2P', cursive;
    color: var(--text-color);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.timezone-select {
    padding: 0.5rem 0.8rem;
    font-size: clamp(0.55rem, 1.2vw, 0.75rem);
    font-family: 'Press Start 2P', cursive;
    border: 2px solid var(--accent-color);
    background: white;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.timezone-select:hover,
.timezone-select:focus {
    background: rgba(135, 206, 235, 0.1);
    border-color: var(--primary-dark);
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.15);
}

/* ============================================
   VIEW TOGGLE
   ============================================ */

.view-toggle {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
    margin: 1rem 0;
}

.view-btn {
    padding: 0.5rem 1rem;
    font-size: clamp(0.55rem, 1.2vw, 0.75rem);
    font-family: 'Press Start 2P', cursive;
    border: 2px solid var(--text-color);
    background: white;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    white-space: nowrap;
}

.view-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.15);
}

.view-btn.active {
    background: var(--accent-color);
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
}

/* ============================================
   EVENTS WRAPPER & VIEWS
   ============================================ */

.events-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
    min-height: 200px;
}

.events-wrapper.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.2rem;
}

/* ============================================
   EVENT CARD - LIST VIEW
   ============================================ */

.event-card {
    background: white;
    border: 2px solid var(--text-color);
    padding: 1.2rem;
    cursor: pointer;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
    position: relative;
    animation: slideInUp 0.4s ease-out;
    overflow: hidden;
    will-change: box-shadow, background-color;
}

.event-card::before {
    content: '';
    position: absolute;
    inset: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
    transition: left 0.45s ease;
    z-index: 1;
    pointer-events: none;
}

.event-card:hover::before {
    left: 100%;
}

.event-card:hover {
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.25);
    border-color: var(--primary-dark);
    background: linear-gradient(135deg, #FFFFFF, #F0F8FF);
}

.events-wrapper.grid-view .event-card {
    display: flex;
    flex-direction: column;
}

/* Event Card Header */
.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
    position: relative;
    z-index: 2;
    gap: 0.8rem;
}

.event-title {
    font-size: clamp(0.65rem, 1.8vw, 1rem);
    font-family: 'Press Start 2P', cursive;
    color: var(--text-color);
    letter-spacing: 0.03em;
    margin: 0;
    flex: 1;
    line-height: 1.2;
}

.event-category {
    padding: 0.3rem 0.6rem;
    font-size: 0.55rem;
    font-family: 'Press Start 2P', cursive;
    background: var(--accent-color);
    color: var(--text-color);
    border: 1px solid var(--text-color);
    text-transform: uppercase;
    white-space: nowrap;
    font-weight: bold;
    flex-shrink: 0;
}

/* Category Colors */
.event-card[data-category="tournament"] .event-category {
    background: #FF6B6B;
    color: white;
}

.event-card[data-category="special"] .event-category {
    background: #F4B942;
    color: #222;
}

.event-card[data-category="streaming"] .event-category {
    background: #4ECDC4;
    color: white;
}

.event-card[data-category="maintenance"] .event-category {
    background: #95A5A6;
    color: white;
}

.event-card[data-category="update"] .event-category {
    background: #9B59B6;
    color: white;
}

/* Event Details */
.event-details {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.event-date,
.event-time,
.event-location {
    font-size: clamp(0.6rem, 1.3vw, 0.8rem);
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.detail-icon {
    font-weight: bold;
    min-width: 15px;
}

.event-description {
    font-size: clamp(0.6rem, 1.1vw, 0.8rem);
    color: #444;
    line-height: 1.3;
    margin: 0.6rem 0 0 0;
    font-family: Arial, sans-serif;
}

/* Event Footer */
.event-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid #ddd;
    position: relative;
    z-index: 2;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.participant-count {
    font-size: 0.6rem;
    color: var(--text-color);
    font-family: 'Press Start 2P', cursive;
    letter-spacing: 0.03em;
}

.event-status {
    font-size: 0.55rem;
    font-family: 'Press Start 2P', cursive;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--text-color);
    background: #B8E6F0;
    color: var(--text-color);
    text-transform: uppercase;
    white-space: nowrap;
}

.event-status.live {
    background: #FF6B6B;
    color: white;
    animation: pulse 1.5s ease-in-out infinite;
}

.event-status.upcoming {
    background: #FFD700;
    color: #333;
}

.event-status.completed {
    background: #95A5A6;
    color: white;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease-out;
    overflow-y: auto;
    padding: 1rem;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border: 3px solid var(--text-color);
    padding: 1.5rem;
    max-width: 450px;
    width: 100%;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    right: 1rem;
    top: 0.8rem;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    color: var(--text-color);
}

.close-btn:hover {
    transform: rotate(90deg) scale(1.2);
    color: var(--primary-dark);
}

#modalBody h2 {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-family: 'Press Start 2P', cursive;
    margin: 0 0 1rem 0;
    color: var(--text-color);
    word-break: break-word;
}

#modalBody p {
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.8rem;
    font-family: Arial, sans-serif;
}

.modal-details {
    margin: 1rem 0;
    padding: 0.8rem;
    background: #F5F5F5;
    border-left: 3px solid var(--primary-dark);
    font-size: 0.85rem;
    line-height: 1.5;
}

.modal-details strong {
    color: var(--primary-dark);
    font-family: 'Press Start 2P', cursive;
}

/* ============================================
   NO EVENTS MESSAGE
   ============================================ */

.no-events {
    text-align: center;
    padding: 3rem 1rem;
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    font-family: 'Press Start 2P', cursive;
    color: var(--text-color);
    opacity: 0.5;
}

/* ============================================
   BACK BUTTON
   ============================================ */

.back-section {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--text-color);
}

.back-btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    font-size: clamp(0.65rem, 1.8vw, 0.9rem);
    font-family: 'Press Start 2P', cursive;
    border: 2px solid var(--text-color);
    background: var(--primary-light);
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.05em;
}

.back-btn:hover {
    background: var(--accent-color);
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablets */
@media (max-width: 768px) {
    .events-container {
        padding: 0.8rem;
    }

    .events-header {
        margin: 0 0 1.5rem 0;
    }

    .filters-section {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        padding: 0.8rem;
    }

    .filter-group {
        justify-content: center;
    }

    .sort-group {
        justify-content: center;
        width: 100%;
    }

    .sort-select {
        width: 100%;
    }

    .timezone-group {
        justify-content: center;
        width: 100%;
    }

    .timezone-select {
        width: 100%;
    }

    .view-toggle {
        justify-content: center;
        margin: 0.8rem 0;
    }

    .events-wrapper.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .event-card {
        padding: 1rem;
    }

    .event-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .event-title {
        font-size: 0.8rem;
    }

    .event-category {
        align-self: flex-start;
    }

    .modal-content {
        padding: 1.2rem;
        max-width: 90%;
    }
}

/* Mobile Devices */
@media (max-width: 480px) {
    .events-container {
        padding: 0.6rem;
    }

    .page-title {
        font-size: 1.2rem;
        margin-bottom: 0.3rem;
    }

    .page-subtitle {
        font-size: 0.6rem;
    }

    .filters-section {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        padding: 0.6rem;
        margin: 1rem 0;
    }

    .filter-group {
        justify-content: center;
        gap: 0.3rem;
    }

    .filter-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.5rem;
    }

    .sort-group {
        width: 100%;
        justify-content: center;
    }

    .sort-select {
        width: auto;
        padding: 0.4rem 0.6rem;
        font-size: 0.5rem;
    }

    .timezone-group {
        width: 100%;
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
    }

    .timezone-label {
        font-size: 0.5rem;
    }

    .timezone-select {
        width: 100%;
        padding: 0.4rem 0.6rem;
        font-size: 0.5rem;
    }

    .view-toggle {
        gap: 0.3rem;
    }

    .view-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.5rem;
    }

    .events-wrapper {
        gap: 0.8rem;
        margin: 1.5rem 0;
    }

    .events-wrapper.grid-view {
        grid-template-columns: 1fr;
    }

    .event-card {
        padding: 0.8rem;
    }

    .event-title {
        font-size: 0.7rem;
    }

    .event-category {
        padding: 0.2rem 0.4rem;
        font-size: 0.5rem;
    }

    .event-date,
    .event-time,
    .event-location {
        font-size: 0.6rem;
    }

    .event-description {
        font-size: 0.6rem;
        margin-top: 0.4rem;
    }

    .event-footer {
        margin-top: 0.6rem;
        padding-top: 0.6rem;
    }

    .participant-count,
    .event-status {
        font-size: 0.55rem;
    }

    .back-btn {
        padding: 0.5rem 1rem;
        font-size: 0.6rem;
    }

    .modal-content {
        padding: 1rem;
    }

    #modalBody h2 {
        font-size: 0.9rem;
    }

    #modalBody p,
    .modal-details {
        font-size: 0.75rem;
    }

    .close-btn {
        font-size: 1.5rem;
        right: 0.8rem;
        top: 0.6rem;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .event-card,
    .filter-btn,
    .modal,
    * {
        animation: none !important;
    }

    .event-card:hover,
    .filter-btn:hover {
        transform: none !important;
    }
}

/* ============================================
   CALENDAR VIEW
   ============================================ */

.events-wrapper.calendar-view {
    display: block !important;
    flex-direction: unset;
    gap: unset;
    margin: 2rem 0;
}

.calendar-wrapper {
    width: 100%;
    max-width: 100%;
    background: white;
    border: 2px solid var(--text-color);
    padding: 1.5rem;
    animation: slideInUp 0.4s ease-out;
    box-sizing: border-box;
    overflow-x: auto;
}

.calendar-month-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.calendar-month-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.85rem, 2.5vw, 1.2rem);
    color: var(--text-color);
    margin: 0;
    text-align: center;
    flex: 1;
    white-space: nowrap;
}

.calendar-nav-btn {
    padding: 0.5rem 1rem;
    font-size: clamp(0.55rem, 1.2vw, 0.75rem);
    font-family: 'Press Start 2P', cursive;
    border: 2px solid var(--text-color);
    background: var(--primary-light);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.calendar-nav-btn:hover {
    background: var(--accent-color);
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.15);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 0.8rem;
    width: 100%;
    min-width: 100%;
    height: auto;
}

.calendar-day-header {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.55rem, 1.2vw, 0.7rem);
    color: var(--text-color);
    text-align: center;
    padding: 0.8rem 0.4rem;
    background: rgba(135, 206, 235, 0.15);
    border: 2px solid var(--text-color);
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

.calendar-day {
    border: 2px solid #ddd;
    padding: 0.8rem 0.6rem;
    min-height: 120px;
    background: white;
    position: relative;
    cursor: default;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    align-items: flex-start;
}

.calendar-day:hover {
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}

.calendar-day.other-month {
    background: #f5f5f5;
    opacity: 0.5;
}

.calendar-day.today {
    border: 3px solid var(--primary-dark);
    background: rgba(135, 206, 235, 0.1);
}

.calendar-day-number {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    color: var(--text-color);
    font-weight: bold;
    margin-bottom: 0.6rem;
    line-height: 1;
}

.calendar-events-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
    width: 100%;
    overflow-y: auto;
    max-height: 80px;
}

.calendar-event-badge {
    font-size: 0.6rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--text-color);
    border-radius: 0;
    font-family: Arial, sans-serif;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
    transition: all 0.2s ease;
    text-align: left;
    line-height: 1.2;
    background-color: white;
}

.calendar-event-badge:hover {
    transform: scale(1.02);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.calendar-event-badge.event-upcoming {
    background: #FFD700;
    color: #333;
    border-color: #DAA500;
}

.calendar-event-badge.event-live {
    background: #FF6B6B;
    color: white;
    border-color: #E63946;
    animation: pulse 1.5s ease-in-out infinite;
}

.calendar-event-badge.event-completed {
    background: #95A5A6;
    color: white;
    border-color: #7F8C8D;
}

/* Category-based colors for calendar badges */
.calendar-event-badge.category-tournament {
    background: #FF6B6B;
    color: black;
    border-color: #E63946;
}

.calendar-event-badge.category-streaming {
    background: #4ECDC4;
    color: black;
    border-color: #45B7AA;
}

.calendar-event-badge.category-maintenance {
    background: #95A5A6;
    color: black;
    border-color: #7F8C8D;
}

.calendar-event-badge.category-update {
    background: #9B59B6;
    color: black;
    border-color: #8E44AD;
}

.calendar-day-event-item {
    transition: all 0.2s ease;
    border: 1px solid #ddd;
}

.calendar-day-event-item:hover {
    background: rgba(135, 206, 235, 0.2) !important;
    transform: translate(-2px, -2px);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Calendar responsive */
@media (max-width: 1024px) {
    .calendar-grid {
        grid-template-columns: repeat(7, minmax(100px, 1fr));
        gap: 0.6rem;
    }

    .calendar-day {
        min-height: 100px;
        padding: 0.6rem 0.4rem;
    }

    .calendar-day-number {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
    }

    .calendar-event-badge {
        font-size: 0.55rem;
        padding: 0.3rem 0.4rem;
    }

    .calendar-events-list {
        gap: 0.3rem;
        max-height: 70px;
    }
}

@media (max-width: 768px) {
    .calendar-wrapper {
        padding: 1rem;
    }

    .calendar-month-nav {
        margin-bottom: 1.5rem;
        gap: 0.5rem;
    }

    .calendar-nav-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.5rem;
    }

    .calendar-month-title {
        font-size: 0.75rem;
    }

    .calendar-grid {
        grid-template-columns: repeat(7, minmax(80px, 1fr));
        gap: 0.4rem;
    }

    .calendar-day {
        min-height: 80px;
        padding: 0.4rem 0.3rem;
    }

    .calendar-day-header {
        font-size: 0.5rem;
        padding: 0.4rem 0.2rem;
        min-height: 35px;
    }

    .calendar-day-number {
        font-size: 0.6rem;
        margin-bottom: 0.3rem;
    }

    .calendar-event-badge {
        font-size: 0.5rem;
        padding: 0.2rem 0.3rem;
    }

    .calendar-events-list {
        gap: 0.2rem;
        max-height: 60px;
    }

    /* Hide calendar view button on mobile */
    #calendarViewBtn {
        display: none;
    }
}
