/* ============================================
   EMR Events — Modern Glassmorphism Theme
   ============================================ */

:root {
    --emr-primary: #0073aa;
    --emr-primary-hover: #005f8d;
    --emr-success: #28a745;
    --emr-bg-glass: rgba(255, 255, 255, 0.7);
    --emr-blur: blur(12px);
    --emr-border-glass: rgba(255, 255, 255, 0.3);
    --emr-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --emr-radius: 16px;
}

/* --- Search Bar --- */

.emr-events-search-bar {
    background: var(--emr-bg-glass);
    backdrop-filter: var(--emr-blur);
    -webkit-backdrop-filter: var(--emr-blur);
    padding: 30px;
    border: 1px solid var(--emr-border-glass);
    border-radius: var(--emr-radius);
    margin-bottom: 40px;
    box-shadow: var(--emr-shadow);
}

.emr-events-date-search {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
}

.emr-search-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

@media (min-width: 768px) {
    .emr-search-field {
        flex: 0 0 calc(33.333% - 14px);
    }
}

.emr-search-field label {
    font-size: 0.8em;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.emr-search-field input[type="text"],
.emr-search-field input[type="date"],
.emr-modal-trigger {
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95em;
    color: #222;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.emr-modal-trigger {
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.emr-modal-trigger:after {
    content: '▼';
    font-size: 0.7em;
    color: #777;
}

/* --- Action Buttons --- */

.emr-search-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin-top: 10px;
}

@media (min-width: 768px) {
    .emr-search-actions {
        flex: 0 0 calc(33.333% - 14px);
        margin-top: 0;
        justify-content: flex-end;
    }
}

.emr-search-submit {
    background: var(--emr-primary);
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
}

.emr-search-submit:hover {
    background: var(--emr-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.3);
}

.emr-search-submit.emr-ready {
    background: var(--emr-success);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.emr-search-reset {
    font-size: 0.9em;
    color: #666;
    text-decoration: none;
    font-weight: 700;
}

.emr-search-reset:hover {
    color: #d9534f;
    text-decoration: underline;
}

/* --- Layout --- */

.emr-archive-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.emr-events-page-layout {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

@media (min-width: 1024px) {
    .emr-events-page-layout {
        flex-direction: row;
    }
    .emr-main-events-content {
        flex: 1;
    }
    .emr-events-sidebar {
        flex: 0 0 320px;
    }
}

/* --- Event Card --- */

.emr-events-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.emr-event-card {
    display: flex;
    flex-direction: row;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: var(--emr-blur);
    -webkit-backdrop-filter: var(--emr-blur);
    border: 1px solid var(--emr-border-glass);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    min-height: 260px; /* Enforced minimum height */
}

.emr-event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
}

.emr-event-image {
    flex: 0 0 320px;
    width: 320px;
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

.emr-event-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.emr-event-card:hover .emr-event-image img {
    transform: scale(1.1);
}

.emr-event-content {
    padding: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.emr-event-content h2 {
    margin: 0 0 15px 0;
    font-size: 1.8em;
    font-weight: 700;
}

.emr-event-content h2 a {
    color: #222;
    text-decoration: none;
}

.emr-event-meta {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    color: #555;
    font-size: 0.95em;
}

.emr-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.emr-event-excerpt {
    margin-bottom: 25px;
    line-height: 1.7;
    color: #444;
    flex-grow: 1;
}

.emr-event-actions {
    display: flex;
    gap: 15px;
}

.emr-details-btn,
.emr-ticket-btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s;
}

.emr-ticket-btn {
    background: var(--emr-primary);
    color: #fff;
}

.emr-ticket-btn:hover {
    background: var(--emr-primary-hover);
}

.emr-details-btn {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.emr-details-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* --- Sidebar --- */

.emr-sidebar-widget {
    background: var(--emr-bg-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 25px;
    border: 1px solid var(--emr-border-glass);
    border-radius: var(--emr-radius);
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.emr-sidebar-widget h3 {
    margin: 0 0 20px 0;
    font-size: 1.1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 3px solid var(--emr-primary);
    display: inline-block;
    padding-bottom: 6px;
}

.emr-term-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.emr-term-list li a {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(0, 115, 170, 0.05);
    border: 1px solid rgba(0, 115, 170, 0.1);
    border-radius: 30px;
    color: var(--emr-primary);
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.emr-term-list li a:hover {
    background: var(--emr-primary);
    color: #fff;
    transform: translateY(-2px);
}

/* --- Filter Notice --- */

.emr-filter-notice {
    background: rgba(0, 115, 170, 0.08);
    border-left: 4px solid var(--emr-primary);
    padding: 20px 25px;
    border-radius: 0 10px 10px 0;
    margin-bottom: 30px;
    color: #2c3e50;
    font-size: 1.1em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

/* --- Pagination --- */

.emr-pagination {
    margin-top: 50px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.emr-pagination .page-numbers {
    padding: 12px 20px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    color: #333;
    transition: all 0.2s;
}

.emr-pagination .page-numbers:hover {
    background: #f8f9fa;
}

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

/* --- Modals Dialogs --- */

.emr-filter-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.emr-filter-modal.emr-modal-open {
    display: flex;
}

.emr-modal-backdrop {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.emr-modal-dialog {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    border: 1px solid var(--emr-border-glass);
}

.emr-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.emr-modal-body {
    padding: 25px;
    overflow-y: auto;
}

.emr-modal-footer {
    padding: 15px 25px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: right;
}

.emr-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
}

.emr-checkbox-label:hover {
    background: rgba(0, 0, 0, 0.05);
}

.emr-checkbox-label input {
    width: 20px;
    height: 20px;
}

/* --- Upcoming Events List --- */

.emr-upcoming-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.emr-upcoming-list li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.emr-upcoming-date {
    display: block;
    font-size: 0.75em;
    font-weight: 800;
    color: var(--emr-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.emr-upcoming-title {
    text-decoration: none;
    color: #222;
    font-weight: 700;
    font-size: 0.95em;
}

/* --- Responsive --- */

@media (max-width: 767px) {
    .emr-event-card {
        flex-direction: column;
    }
    .emr-event-image {
        width: 100%;
        height: 240px;
        flex: none;
    }
}