body {
    margin-top: var(--nav-bar-height);
    margin-bottom: var(--nav-bar-height);
    font-size: 1em;
}

/* safe area for iphone notch in landscape mode) */
@supports(padding:max(0px)) {

    body,
    header,
    footer {
        padding-left: min(0vmin, env(safe-area-inset-left));
        padding-right: min(0vmin, env(safe-area-inset-right));
    }
}

a {
    cursor: pointer;
}

svg {
    height: 1rem;
}

/* Vanilla CSS Smart Tooltip System */
[data-tooltip] {
    position: relative;
    display: inline-block;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(20, 24, 33, 0.94);
    color: #f0f4f8;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    max-width: 220px;
    width: max-content;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    line-height: 1.35;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 9999;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.td-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.soldout {
    color: darkred;
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--bg-main);
        color: var(--text-main);
    }

    .dropdown-menu {
        background-color: var(--dropdown-bg);
        color: var(--dropdown-text);
    }

    .dropdown-menu a:hover {
        color: var(--dropdown-hover-text);
    }

    .dropdown-menu a {
        color: var(--dropdown-text);
    }

    .card {
        background-color: var(--card-bg);
    }

    .card .card-header {
        background-color: var(--card-header-bg);
    }

    .dropdown-dates-menuitem {
        color: silver;
    }

    .category-total {
        color: silver;
    }



    a {
        color: lightblue;
    }

    a:hover {
        color: white;
    }

    .row-thead {
        background-color: var(--bg-main);
    }

    .menu-icon {
        fill: silver;
    }

    .soldout {
        color: red;
    }
}

/* Toast Notification Utility */
.toast-container {
    position: fixed;
    top: 70px;
    right: 16px;
    z-index: 1600;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-notification {
    background-color: rgba(33, 37, 41, 0.95);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-notification.fade-out {
    animation: toastFadeOut 0.3s ease forwards;
}

@keyframes toastFadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Pull to Refresh Floating Indicator */
.ptr-indicator {
    position: fixed;
    top: calc(var(--nav-bar-height) + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 1050;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-card, #ffffff);
    color: var(--primary-color, #1d4ed8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ptr-indicator.ptr-visible {
    opacity: 1;
}

.ptr-indicator.ptr-refreshing i {
    animation: ptrSpin 0.8s linear infinite;
}

@keyframes ptrSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Global loading states */
body.loading-location,
body.loading-location * {
    cursor: wait !important;
}

/* Shared Page Hero Header block styling */
.page-hero {
    padding: 30px 15px;
    text-align: center;
}

/* OAuth Sign-In Styles */
.oauth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: #6c757d;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.oauth-divider::before,
.oauth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #dee2e6;
}

.oauth-divider:not(:empty)::before {
    margin-right: .5em;
}

.oauth-divider:not(:empty)::after {
    margin-left: .5em;
}

@media (prefers-color-scheme: dark) {

    .oauth-divider::before,
    .oauth-divider::after {
        border-bottom-color: #495057;
    }

    .oauth-divider {
        color: #adb5bd;
    }
}

.oauth-btn-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 15px 0;
}

/* Base custom Apple Sign-In button designed to look premium and native */
.apple-signin-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    height: 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.apple-signin-btn:hover {
    background-color: #1a1a1a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.apple-signin-btn svg {
    position: absolute;
    left: 12px;
    height: 16px;
    fill: currentColor;
}

@media (prefers-color-scheme: dark) {
    .apple-signin-btn {
        background-color: #ffffff;
        color: #000000;
    }

    .apple-signin-btn:hover {
        background-color: #f2f2f2;
    }
}

.login-action-links {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 13px;
}

.login-action-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.login-action-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Native HTML <dialog> styling */
dialog.custom-dialog {
    border: none;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    background: transparent;
    overflow: visible;

    /* Bootstrap 5 Modal CSS Variables fallback for native <dialog> wrapper */
    --bs-modal-bg: var(--modal-bg);
    --bs-modal-color: var(--text-primary);
    --bs-modal-border-color: var(--border-color);
    --bs-modal-border-width: 1px;
    --bs-modal-border-radius: 8px;
    --bs-modal-inner-border-radius: 7px;
    --bs-modal-padding: 1rem;
    --bs-modal-header-padding-x: 1rem;
    --bs-modal-header-padding-y: 1rem;
    --bs-modal-header-padding: 1rem 1rem;
    --bs-modal-header-border-color: var(--border-color);
    --bs-modal-header-border-width: 1px;
    --bs-modal-footer-gap: 0.5rem;
    --bs-modal-footer-bg: transparent;
    --bs-modal-footer-border-color: var(--border-color);
    --bs-modal-footer-border-width: 1px;
}

dialog.custom-dialog {
    border: none;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    background: transparent;
    margin: auto;
}

dialog.custom-dialog[open] {
    opacity: 1;
    transform: scale(1);
}

dialog.custom-dialog::backdrop {
    background-color: rgba(10, 15, 25, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

dialog.custom-dialog .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color) !important;
}

dialog.custom-dialog .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

dialog.custom-dialog#modalCategories {
    max-width: 800px;
}

/* Modern Date Dialog Styles */
.date-inputs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 576px) {
    .date-inputs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.date-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.modern-date-input {
    height: 48px;
    padding: 10px 14px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-color) !important;
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    font-size: 0.95rem !important;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modern-date-input:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

/* Calendar indicator icon for Webkit browsers */
.modern-date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(var(--calendar-indicator-invert, 0));
    opacity: 0.6;
    transition: opacity 0.2s;
}

.modern-date-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Dropup menus positioning fix (fallback for no-Popper.js) */
.dropup .dropdown-menu {
    top: auto;
    bottom: 100%;
}

/* Global Ticket Giveaway Badges & Buttons */
.status-badge-entered {
    background-color: var(--accent-purple-light) !important;
    color: var(--accent-purple) !important;
    border: 1px solid var(--accent-purple) !important;
    font-weight: 500;
}

.btn-giveaway-entry {
    border-color: var(--accent-purple) !important;
    color: var(--accent-purple) !important;
}

.btn-giveaway-entry:hover,
.btn-giveaway-entry:focus {
    background-color: var(--accent-purple) !important;
    color: #ffffff !important;
}

/* Global Dark Mode Contrast Overrides */
@media (prefers-color-scheme: dark) {
    .text-muted {
        color: var(--text-secondary) !important;
    }

    .text-dark {
        color: var(--text-primary) !important;
    }
}

[data-bs-theme="dark"] .text-muted {
    color: var(--text-secondary) !important;
}

[data-bs-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

/* Login Callout Card (Shared across Win & Favorites pages) */
.login-callout,
.win-callout {
    background-color: var(--bg-card-header, #f8f9fa);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

@media (prefers-color-scheme: dark) {

    .login-callout,
    .win-callout {
        background-color: var(--bg-card, #222222);
        border-color: rgba(255, 255, 255, 0.1);
    }
}

[data-bs-theme="dark"] .login-callout,
[data-bs-theme="dark"] .win-callout {
    background-color: var(--bg-card, #222222);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Bottom Navigation Bar Micro-Labels (Stacked strictly on mobile < 576px) */
@media (max-width: 575.98px) {
    #bottom_nav .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 4px 1px 2px 1px;
    }

    #bottom_nav .nav-icon {
        font-size: 1.1rem;
        margin-bottom: 2px;
        margin-right: 0;
    }

    #bottom_nav .nav-label {
        font-size: 0.65rem;
        line-height: 1;
        white-space: nowrap;
    }
}

/* Intermediate breakpoint (576px - 768px): compact horizontal inline items */
@media (min-width: 576px) and (max-width: 767.98px) {
    #bottom_nav .nav-link {
        padding: 6px 4px !important;
        font-size: 0.82rem;
    }

    #bottom_nav .nav-icon {
        font-size: 0.95rem;
        margin-right: 4px;
    }
}

/* Component Styles: Favorites Page */
.sub-card {
    background: var(--bs-body-bg, #ffffff);
    border: 1px solid var(--bs-border-color, #e0e0e0);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.sub-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-card-desc {
    font-size: 0.825rem;
    color: var(--text-secondary, #6c757d);
    margin-top: 4px;
    margin-bottom: 10px;
    line-height: 1.35;
}

.sub-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sub-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid var(--bs-border-color, #ced4da);
    background-color: var(--bg-action-btn, #f8f9fa);
    color: var(--text-primary, #212529);
    cursor: pointer;
    transition: all 0.15s ease;
}

.sub-card-btn:hover,
.sub-card-btn:focus {
    background-color: var(--bg-action-btn-hover, #e9ecef);
    color: var(--text-primary, #212529);
    text-decoration: none;
}

.sub-card-btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff !important;
}

.sub-card-btn-primary:hover,
.sub-card-btn-primary:focus {
    background-color: var(--primary-hover);
    color: #ffffff !important;
}

.action-btn-primary i,
.action-btn-primary .action-btn-icon,
.action-btn-purple i,
.action-btn-purple .action-btn-icon,
.sub-card-btn-primary i,
.btn-primary i,
.btn-primary .fa-light,
.btn-primary .fa-solid {
    color: #ffffff !important;
}

/* Component Styles: My Venues Pill Bar */
.venue-filter-container {
    position: relative;
}

.venue-pill-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    padding-right: 24px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: smooth;
    user-select: none;
}

.venue-pill-bar.active-drag {
    cursor: grabbing;
    scroll-behavior: auto;
}

.venue-pill-bar::-webkit-scrollbar {
    display: none;
}

.venue-pill-btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 50rem;
    padding: 6px 14px;
    border: 1px solid var(--bs-border-color, #dee2e6);
    background-color: var(--bs-body-bg, #ffffff);
    color: var(--bs-body-color, #212529);
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}

.venue-pill-btn.active {
    background-color: var(--bs-primary, #0d6efd);
    border-color: var(--bs-primary, #0d6efd);
    color: #ffffff;
}

.venue-pill-btn.active .badge {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}

.venue-pill-btn .badge {
    font-size: 0.75rem;
    font-weight: 600;
}

.venue-filter-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 6px;
    width: 24px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--bs-body-bg, #ffffff));
    pointer-events: none;
}

@media (min-width: 768px) {
    .venue-pill-bar {
        flex-wrap: wrap;
        padding-right: 0;
        overflow-x: visible;
    }

    .venue-filter-container::after {
        display: none;
    }
}