body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}
.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 3px solid #4CAF50;
    padding-bottom: 10px;
}
h1 {
    color: #333;
    margin: 0;
}
h2 {
    color: #555;
    margin-top: 30px;
    border-bottom: 2px solid #2196F3;
    padding-bottom: 8px;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 30px;
}
th {
    background-color: #4CAF50;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: bold;
}
td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}
tr:hover {
    background-color: #f5f5f5;
}
tr.past-event {
    opacity: 0.4;
}

.country {
    font-weight: bold;
    color: #FF9800;
}
.level {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: bold;
}
.available {
    color: #4CAF50;
    font-weight: bold;
}
.full {
    color: #f44336;
    font-weight: bold;
}

/* Utilization coloring (applied to Utilization column cells) */
.util-ok { color: #2e7d32; font-weight: bold; }
.util-low { color: #ef6c00; font-weight: bold; }
.util-full { color: #c62828; font-weight: bold; }
.footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    text-align: center;
    color: #777;
    font-size: 14px;
}
a {
    color: #2196F3;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 50px;
}
th:hover {
    background-color: #45a049;
}
th.sortable::after {
    content: ' ↕';
    position: absolute;
    right: 30px;
    opacity: 0.5;
}
th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
}
th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
}
.filter-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
    padding: 2px 5px;
    border-radius: 3px;
}
.filter-icon:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
}
.filter-icon.active {
    opacity: 1;
    color: #FFD700;
}
.filter-dropdown {
    /* position: fixed with top/left set by attachDropdownToggle (script.js)
       at open time, computed from the filter icon's actual screen
       coordinates -- not tied to the table's own layout/height, so a
       collapsed (all-rows-hidden) table can't clip it. */
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-top: 2px;
}
.filter-dropdown.show {
    display: block;
}
.filter-dropdown-header {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    background-color: #f9f9f9;
    font-weight: bold;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.filter-dropdown-content {
    padding: 5px;
}
.filter-option {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
    color: #333;
}
.filter-option:hover {
    background-color: #f5f5f5;
}
.filter-option input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}
.filter-option label {
    cursor: pointer;
    user-select: none;
    flex: 1;
}
.filter-only-link {
    margin-left: 8px;
    font-size: 11px;
    color: #2196F3;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}
.filter-only-link:hover {
    background-color: #e3f2fd;
    text-decoration: none;
}
.filter-actions {
    padding: 8px 10px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.filter-btn {
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    color: #2196F3;
    display: inline-block;
}
.filter-btn:hover {
    text-decoration: underline;
}
.filter-text-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 14px;
}
.filter-text-input:focus {
    outline: none;
    border-color: #4CAF50;
}
.filter-date-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 14px;
}
.filter-date-input:focus {
    outline: none;
    border-color: #4CAF50;
}
h2.collapsible {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-left: 30px;
}
h2.collapsible:hover {
    color: #2196F3;
}
h2.collapsible::after {
    content: ' ▼';
    position: absolute;
    left: 0;
    font-size: 0.8em;
}
h2.collapsible.collapsed::after {
    content: ' ▶';
}
.table-container {
    display: block;
}
.table-container.collapsed {
    display: none;
}

/* Mobile responsive styles */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
        border-radius: 4px;
    }
    
    h1 {
        font-size: 24px;
        padding-bottom: 8px;
    }
    
    h2 {
        font-size: 20px;
        margin-top: 20px;
        padding-bottom: 6px;
    }
    
    /* Make tables horizontally scrollable on mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 800px;
        font-size: 14px;
    }
    
    th, td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    th {
        padding-right: 45px;
        font-size: 13px;
    }
    
    th.sortable::after {
        right: 25px;
        font-size: 12px;
    }
    
    .filter-icon {
        right: 6px;
        font-size: 12px;
    }
    
    .filter-dropdown {
        min-width: 180px;
        max-height: 250px;
        font-size: 14px;
    }
    
    .filter-option {
        padding: 8px;
    }
    
    .filter-btn {
        font-size: 13px;
        padding: 4px 8px;
    }
    
    .filter-text-input,
    .filter-date-input {
        font-size: 14px;
        padding: 8px;
    }
    
    /* Increase touch target sizes */
    h2.collapsible {
        padding: 10px 0 10px 30px;
        font-size: 18px;
    }
    
    .footer {
        font-size: 12px;
        margin-top: 20px;
        padding-top: 15px;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    th {
        padding-right: 40px;
        font-size: 12px;
    }
    
    .filter-dropdown {
        min-width: 160px;
        max-height: 200px;
        font-size: 13px;
    }
}

/* Landscape orientation on mobile devices */
@media screen and (max-width: 896px) and (orientation: landscape) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 10px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 20px;
        padding-bottom: 5px;
        margin: 0 0 10px 0;
    }
    
    h2 {
        font-size: 16px;
        margin-top: 15px;
        padding-bottom: 5px;
    }
    
    h2.collapsible {
        padding: 8px 0 8px 25px;
        font-size: 16px;
    }
    
    h2.collapsible::after {
        font-size: 0.7em;
    }
    
    /* Optimize table display for landscape */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    table {
        min-width: 100%;
        font-size: 11px;
    }
    
    th, td {
        padding: 5px 4px;
        white-space: nowrap;
    }
    
    th {
        padding-right: 35px;
        font-size: 11px;
        position: sticky;
        top: 0;
        background-color: #4CAF50;
        z-index: 10;
    }
    
    th.sortable::after {
        right: 20px;
        font-size: 10px;
    }
    
    .filter-icon {
        right: 4px;
        font-size: 10px;
        padding: 1px 3px;
    }
    
    .filter-dropdown {
        min-width: 150px;
        max-height: 40vh;
        font-size: 12px;
    }
    
    .filter-dropdown-header {
        padding: 6px;
        font-size: 11px;
    }
    
    .filter-option {
        padding: 5px 6px;
        font-size: 11px;
    }
    
    .filter-option input[type="checkbox"] {
        margin-right: 5px;
    }
    
    .filter-only-link {
        font-size: 10px;
        padding: 1px 4px;
    }
    
    .filter-actions {
        padding: 5px 6px;
    }
    
    .filter-btn {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .filter-text-input,
    .filter-date-input {
        font-size: 12px;
        padding: 5px;
    }
    
    .level {
        padding: 2px 5px;
        font-size: 10px;
    }
    
    .footer {
        font-size: 10px;
        margin-top: 10px;
        padding-top: 10px;
    }
}

/* Auth header, deliverability banner, settings modal */
.auth-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 32px;
}
.auth-logged-out {
    display: flex;
    align-items: center;
    gap: 10px;
}
.auth-hint {
    color: #777;
    font-size: 13px;
}
.auth-logged-in {
    display: flex;
    align-items: center;
    gap: 10px;
}
#auth-user-name {
    font-weight: bold;
    color: #333;
}
.auth-button {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    background-color: #2196F3;
    color: white;
    cursor: pointer;
    font-size: 14px;
}
.auth-button:hover {
    background-color: #1976d2;
}
.banner {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
}
.banner p {
    margin: 0;
}
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-content {
    position: relative;
    background: white;
    padding: 25px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
/* The close button lives outside .modal-scroll (below), so it stays put in
   the corner regardless of how far the content underneath is scrolled. */
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #777;
    padding: 4px 8px;
}
.modal-close:hover {
    color: #333;
}
.modal-scroll {
    overflow-y: auto;
    /* Lets this flex item shrink below its content's natural height so
       overflow-y:auto actually scrolls instead of growing .modal-content
       past its max-height. */
    min-height: 0;
}
.modal-content h2 {
    margin-top: 0;
    padding-right: 24px;
}
.modal-content h3 {
    margin-bottom: 8px;
    color: #555;
}
.settings-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}
.settings-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}
.settings-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    background: #f5f5f5;
    padding: 4px 10px;
    border-radius: 4px;
}
#settings-countries-other {
    margin-bottom: 15px;
}
#settings-countries-other summary {
    cursor: pointer;
    color: #555;
    font-size: 13px;
    margin-bottom: 8px;
}
#settings-countries-other .settings-checkboxes {
    margin-bottom: 0;
}
#setting-min-level {
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-bottom: 15px;
    display: block;
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}
.modal-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
#settings-save {
    background-color: #4CAF50;
    color: white;
}
#settings-save:hover {
    background-color: #43a047;
}
#settings-cancel {
    background-color: #eee;
    color: #333;
}
#settings-cancel:hover {
    background-color: #ddd;
}
#settings-status {
    margin-top: 10px;
    font-size: 13px;
    color: #555;
}
.danger-button {
    margin-top: 15px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    background-color: #f5f5f5;
    color: #c62828;
}
.danger-button:hover {
    background-color: #ffebee;
}

/* Inline event card styles */
tr.event-row { cursor: pointer; }
tr.event-row.expanded { background-color: #eef7ff; }
tr.detail-row td { background: #fafafa; padding: 16px 20px; border-bottom: 1px solid #ddd; }
.inline-card h3 { margin: 0 0 8px; }
.inline-card .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 16px; margin-bottom: 10px; }

/* Per-event subscribe bell. Uses ::before rather than a text node so the
   button never contributes to the cell's textContent, which sorting,
   filtering, and the inline detail card all read directly. */
.subscribe-bell {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 6px 0 0;
    font-size: 15px;
    line-height: 1;
    vertical-align: middle;
}
.subscribe-bell::before {
    content: "🔕";
    opacity: 0.55;
}
.subscribe-bell:hover::before {
    opacity: 0.85;
}
.subscribe-bell.subscribed::before {
    content: "🔔";
    opacity: 1;
}
