/* --- Event Grid System --- */
.event-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.event-grid::-webkit-scrollbar {
    height: 6px;
}

.event-grid::-webkit-scrollbar-track {
    background: transparent;
}

.event-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.event-grid:hover::-webkit-scrollbar-thumb {
    background: var(--glass-border);
}

.event-grid.archive-grid {
    display: none !important;
}

.event-grid.archive-grid.shown-archive {
    display: grid !important;
}

/* --- Event Card Component --- */
.event-card {
    background: #252531 !important;
    border: 1px solid #334155 !important;
    border-radius: 20px !important;
    color: var(--text-primary) !important;
    cursor: default !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    justify-content: space-between;
    max-width: 100% !important;
    overflow: hidden;
    padding: 1.5rem !important;
    position: relative !important;
    scroll-snap-align: start;
    text-decoration: none !important;
    transition: var(--transition) !important;
}

.event-card-header {
    align-items: center;
    display: flex;
    gap: 1rem;
}

.event-card-emoji-box {
    align-items: center;
    background: #252531;
    border: 1px solid #334155;
    border-radius: 12px;
    display: flex;
    flex-shrink: 0;
    font-size: 1.8rem;
    height: 54px;
    justify-content: center;
    width: 54px;
}

.event-card-title-box {
    flex-grow: 1;
    min-width: 0;
}

.event-card-title-box h3 {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: #ffffff !important;
    display: -webkit-box !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    line-clamp: 2;
    line-height: 1.3;
    margin: 0 !important;
    max-height: 2.6em;
    overflow: hidden;
}

/* Fallback for line-clamp if needed */
.event-card h3 {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--text-primary);
    display: -webkit-box;
    font-size: 17px;
    font-weight: 500;
    height: 2.8em;
    line-clamp: 2;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    max-width: 100%;
    overflow: hidden;
}

.event-card-body {
    width: 100%;
}

.event-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
}

.event-meta div {
    align-items: center;
    display: flex;
    gap: 0.4rem;
}

.event-status-text {
    color: #000000;
    font-size: 0.8rem;
    font-style: normal;
    font-weight: 500;
    margin-top: 0.25rem;
    opacity: 0.8;
}

/* --- Badges & Tags --- */
.event-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.event-grid .event-card-badges {
    display: none;
}

.badge-tag {
    align-items: center;
    background: #2d2d3f;
    border: 1px solid #334155;
    border-radius: 10px;
    color: #94a3b8;
    display: inline-flex;
    font-size: 16px;
    font-weight: 600;
    gap: 6px;
    line-height: 1;
    padding: 6px 14px;
}

.badge-tag.admin-tag {
    background: rgba(139, 116, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.2);
    color: #a786ff;
}

.badge-tag.closed-tag {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-tag.expired-tag {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-tag.update-tag {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-tag.ordered-tag {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.badge-tag.not-ordered-tag {
    background: rgba(142, 142, 147, 0.1) !important;
    color: #94a3b8 !important;
    border-color: rgba(142, 142, 147, 0.2) !important;
}

.badge-tag.person-tag {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .event-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .event-grid .event-card {
        flex: none !important;
        width: 100% !important;
    }

    .event-card {
        padding: 12px !important;
    }

    .event-card h3 {
        font-size: 1.313rem !important;
        font-weight: 600 !important;
    }

    .event-meta {
        font-size: 0.75rem !important;
        margin-top: 0.15rem !important;
        margin-bottom: 0.4rem !important;
    }

    .event-grid.archive-grid.shown-archive {
        display: flex !important;
        flex-direction: column !important;
    }
}

/* --- iOS & Overlay Event Card Styles --- */
.event-card.selected {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 0.5px var(--accent) !important;
}

.event-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 12, 18, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
    border-radius: 18px;
}

.event-card.selected .event-card-overlay {
    opacity: 1;
    visibility: visible;
}

.btn-overlay {
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 10px 25px rgba(225, 254, 19, 0.4);
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.event-card.selected .btn-overlay {
    transform: translateY(0);
}

.event-card-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.event-card-description {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: #94a3b8;
    display: -webkit-box;
    font-size: 0.9rem;
    line-clamp: 2;
    line-height: 1.5;
    margin: 0 !important;
    min-height: 2.7rem;
    overflow: hidden;
}

.event-card-meta-row {
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    font-size: var(--font-size-base);
    gap: 1rem;
}

.event-card-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: auto;
}

/* --- iOS Event Card Layout --- */
.event-card-ios {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 1.25rem !important;
    gap: 1.5rem !important;
    background: #202437 !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.event-card-main-ios {
    display: flex !important;
    align-items: center !important;
    gap: 1.25rem !important;
    flex: 1;
    min-width: 0;
}

.event-card-emoji-box-ios {
    width: 64px !important;
    height: 64px !important;
    border-radius: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 3rem !important;
    flex-shrink: 0 !important;
}

.event-card-info-ios {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    min-width: 0;
}

.event-card-title-ios {
    font-size: 23px !important;
    font-weight: 600 !important;
    color: #FFFFFF !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.5px;
}

.event-card-date-ios {
    font-size: 17px !important;
    color: #9c9fad !important;
    font-weight: 500;
}

.event-card-tag-ios {
    align-self: flex-start;
    background: rgba(0, 122, 255, 0.15) !important;
    color: #007aff !important;
    padding: 4px 12px !important;
    border-radius: 15px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    margin-top: 4px;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.event-card-tag-ios.tag-ordered {
    background: rgba(48, 209, 88, 0.15) !important;
    color: #30d158 !important;
}

.event-card-tag-ios.tag-not-ordered {
    background: rgba(142, 142, 147, 0.15) !important;
    color: #8e8e93 !important;
}

.event-card-tag-ios.tag-admin {
    background: rgba(139, 116, 246, 0.15) !important;
    color: #a786ff !important;
}

.event-card-tag-ios.tag-mod {
    background: rgba(139, 116, 246, 0.1) !important;
    color: #a786ff !important;
    border: 1px solid rgba(139, 116, 246, 0.2) !important;
}

.event-card-tag-ios.tag-archived {
    background: rgba(142, 142, 147, 0.15) !important;
    color: #8e8e93 !important;
}

.event-card-tag-ios.tag-deactivated {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

.event-card-tags-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 6px !important;
}

.event-card-status-ios {
    display: flex !important;
    flex-direction: column !important;
    align-items: anchor-center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
    justify-content: center;
}

.event-card-status-ios .today-text {
    color: #30d158 !important;
    font-weight: 800 !important;
    font-size: 13px !important;
    letter-spacing: 0.5px;
}

.event-card-status-ios .today-emoji {
    font-size: 24px !important;
    filter: drop-shadow(0 0 5px rgba(48, 209, 88, 0.3));
}