/* GXTiming AdminApp — responsive design system (mobile / tablet / desktop) */

:root {
    --gx-branded-header-height: 48px;
    --admin-page-padding: 16px;
    --admin-title-size: 1.75rem;
    --admin-subtitle-size: 0.8125rem;
    --admin-filter-padding: 14px;
    --admin-drawer-width: 280px;
    --admin-chrome-height: var(--gx-branded-header-height);
    --admin-appbar-height: var(--admin-chrome-height);
    --admin-section-gap: 1.25rem;
}

@media (min-width: 768px) {
    :root {
        --admin-page-padding: 20px;
        --admin-title-size: 2rem;
        --admin-subtitle-size: 0.875rem;
        --admin-filter-padding: 16px;
        --admin-section-gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    :root {
        --gx-branded-header-height: 52px;
        --admin-page-padding: 28px;
        --admin-title-size: 2.25rem;
        --admin-subtitle-size: 0.9375rem;
        --admin-filter-padding: 18px;
        --admin-section-gap: 1.75rem;
    }
}


/* ── Layout shell ───────────────────────────────────────────── */

.admin-layout {
    -webkit-tap-highlight-color: transparent;
    --mud-appbar-height: var(--admin-chrome-height);
}

.main-content {
    background-color: var(--gx-bg);
    min-height: calc(100vh - var(--admin-chrome-height));
}

.admin-layout ::deep .mud-main-content.main-content.admin-main-content {
    padding-top: calc(var(--admin-chrome-height) + var(--admin-page-padding)) !important;
    padding-right: var(--admin-page-padding) !important;
    padding-bottom: var(--admin-page-padding) !important;
    padding-left: var(--admin-page-padding) !important;
}

.admin-main-content {
    padding-top: calc(var(--admin-chrome-height) + var(--admin-page-padding));
}

.admin-branded-header {
    z-index: calc(var(--mud-zindex-appbar) + 1);
}

.admin-unified-header ::deep .gx-branded-header__banner {
    opacity: 0.22;
}

.admin-unified-header ::deep .gx-branded-header__badge {
    display: none;
}

.admin-layout ::deep .admin-header-search .mud-input-root {
    background-color: rgba(255, 255, 255, 0.05);
}

.admin-layout ::deep .admin-header-search .mud-input-outlined .mud-input-outlined-border {
    border-color: var(--gx-border-subtle);
}

@media (max-width: 959px) {
    .admin-layout ::deep .mud-main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .admin-branded-header.gx-branded-header--fixed {
        left: 0;
        right: 0;
    }
}

@media (min-width: 960px) {
    .admin-branded-header.gx-branded-header--fixed {
        left: 56px !important;
        width: calc(100% - 56px) !important;
    }

    .admin-layout ::deep .mud-drawer-open.admin-drawer:not(.mud-drawer-mini) ~ .admin-branded-header.gx-branded-header--fixed,
    .admin-layout ::deep .mud-drawer-open.admin-drawer.mud-drawer-open-mini-on-hover:hover ~ .admin-branded-header.gx-branded-header--fixed {
        left: 240px !important;
        width: calc(100% - 240px) !important;
    }
}

/* ── Filter bar layout (75% / 25%) ─────────────────────────── */

.filter-bar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-bar-search {
    flex: 1 1 100%;
    min-width: 0;
}

.filter-bar-status {
    flex: 1 1 100%;
    min-width: 0;
}

@media (min-width: 768px) {
    .filter-bar-search {
        flex: 3 1 0;
    }

    .filter-bar-status {
        flex: 1 1 0;
        max-width: 25%;
    }
}

.events-view-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--admin-section-gap);
}

/* ── Drawer (mobile-first sidebar) ──────────────────────────── */

.admin-drawer ::deep .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.admin-drawer ::deep .nav-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 959px) {
    .admin-drawer ::deep .mud-drawer {
        width: var(--admin-drawer-width) !important;
    }
}

.drawer-header {
    padding: 14px 16px;
    background-color: var(--gx-bg);
    border-bottom: 1px solid var(--gx-border-subtle);
    flex-shrink: 0;
}

.drawer-title {
    white-space: nowrap;
    overflow: hidden;
    font-weight: 700;
}

.drawer-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gx-primary);
    background: rgba(249, 115, 22, 0.15);
    border: 1px solid rgba(249, 115, 22, 0.35);
    border-radius: 4px;
    padding: 2px 6px;
}

/* ── Page headers ───────────────────────────────────────────── */

.admin-layout .mud-container .mud-typography-h4.fw-bold,
.admin-layout .mud-container .admin-page-title,
.admin-layout .page-header .mud-typography-h4 {
    font-size: var(--admin-title-size) !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}

.page-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gx-border-subtle);
}

.page-header .mud-typography-h4,
.page-header .mud-typography-h4.fw-bold,
.admin-page-title {
    font-size: var(--admin-title-size) !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}

.page-header .mud-typography-body2,
.admin-page-subtitle {
    font-size: var(--admin-subtitle-size) !important;
    margin-top: 0.25rem;
}

.page-header-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.page-header-row .page-header-actions {
    flex-shrink: 0;
    width: 100%;
}

@media (min-width: 768px) {
    .page-header-row .page-header-actions {
        width: auto;
    }
}

.gx-add-button-icon-only {
    min-width: 42px;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

/* ── Filter bars ────────────────────────────────────────────── */

.filter-bar {
    margin-bottom: 1rem;
    padding: var(--admin-filter-padding) !important;
    border-radius: 12px !important;
    border: 1px solid var(--gx-border-subtle) !important;
    background: var(--gx-card) !important;
}

.filter-bar ::deep .mud-grid-item .d-flex {
    width: 100%;
}

/* ── Data tables → mobile cards ─────────────────────────────── */

.admin-data-table-container,
.categories-table-container,
.pilots-table-container,
.data-table-container {
    border-radius: 12px !important;
    border: 1px solid var(--gx-border-subtle) !important;
    overflow: hidden;
    background: var(--gx-card) !important;
}

.admin-data-table ::deep .mud-table-head,
.pilots-table ::deep .mud-table-head,
.operations-table ::deep .mud-table-head {
    background: rgba(249, 115, 22, 0.06);
}

.admin-data-table ::deep .mud-table-head .mud-table-cell,
.pilots-table ::deep .mud-table-head .mud-table-cell,
.operations-table ::deep .mud-table-head .mud-table-cell {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gx-text-secondary);
}

@media (max-width: 959px) {
    .admin-data-table ::deep .mud-table-head,
    .pilots-table ::deep .mud-table-head,
    .operations-table ::deep .mud-table-head,
    .readers-table ::deep .mud-table-head {
        display: none;
    }

    .admin-data-table ::deep .mud-table-row,
    .pilots-table ::deep .mud-table-row,
    .operations-table ::deep .mud-table-row,
    .readers-table ::deep .mud-table-row,
    .categories-table ::deep .mud-table-row {
        display: block;
        margin: 0;
        padding: 14px 16px;
        border-bottom: 1px solid var(--gx-border-subtle);
        background: var(--gx-card);
    }

    .admin-data-table ::deep .mud-table-row:last-child,
    .pilots-table ::deep .mud-table-row:last-child,
    .operations-table ::deep .mud-table-row:last-child,
    .readers-table ::deep .mud-table-row:last-child,
    .categories-table ::deep .mud-table-row:last-child {
        border-bottom: none;
    }

    .admin-data-table ::deep .mud-table-cell,
    .pilots-table ::deep .mud-table-cell,
    .operations-table ::deep .mud-table-cell,
    .readers-table ::deep .mud-table-cell,
    .categories-table ::deep .mud-table-cell {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 6px 0 !important;
        border: none !important;
        text-align: left !important;
    }

    .admin-data-table ::deep .mud-table-cell::before,
    .pilots-table ::deep .mud-table-cell::before,
    .operations-table ::deep .mud-table-cell::before,
    .readers-table ::deep .mud-table-cell::before,
    .categories-table ::deep .mud-table-cell::before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--gx-text-disabled);
        flex-shrink: 0;
        min-width: 88px;
        max-width: 40%;
    }

    .admin-data-table ::deep .mud-table-cell[data-label=""]::before,
    .pilots-table ::deep .mud-table-cell[data-label=""]::before {
        display: none;
    }

    .admin-data-table ::deep .mud-table-cell:last-child,
    .pilots-table ::deep .mud-table-cell:last-child,
    .operations-table ::deep .mud-table-cell:last-child,
    .readers-table ::deep .mud-table-cell:last-child,
    .categories-table ::deep .mud-table-cell:last-child {
        justify-content: flex-end;
        padding-top: 10px !important;
        margin-top: 4px;
        border-top: 1px solid var(--gx-border-subtle) !important;
    }

    .admin-data-table ::deep .mud-table-cell:last-child::before,
    .pilots-table ::deep .mud-table-cell:last-child::before,
    .operations-table ::deep .mud-table-cell:last-child::before,
    .readers-table ::deep .mud-table-cell:last-child::before,
    .categories-table ::deep .mud-table-cell:last-child::before {
        display: none;
    }
}

/* ── Row actions ────────────────────────────────────────────── */

.gx-admin-row-actions ::deep .mud-icon-button {
    min-width: 40px;
    min-height: 40px;
}

.gx-admin-row-actions ::deep .mud-button-group {
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 767px) {
    .gx-admin-row-actions ::deep .mud-button-group {
        border: none;
        box-shadow: none;
    }

    .gx-admin-row-actions ::deep .mud-icon-button {
        border: 1px solid var(--gx-border-subtle) !important;
        border-radius: 8px !important;
        margin-left: 4px;
    }

    .gx-admin-row-actions ::deep .mud-icon-button:first-child {
        margin-left: 0;
    }
}

/* ── Containers & overflow ──────────────────────────────────── */

.admin-layout ::deep .mud-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.admin-layout ::deep .mud-container.py-4 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* ── Dashboard & cards ──────────────────────────────────────── */

@media (max-width: 767px) {
    .admin-layout ::deep .mud-grid-spacing-xs-3 > .mud-grid-item {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }
}

/* ── Wizards & settings ─────────────────────────────────────── */

@media (max-width: 767px) {
    .admin-layout ::deep .mud-stepper .mud-step-label {
        font-size: 0.75rem;
    }

    .admin-layout ::deep .mud-paper.pa-6 {
        padding: 16px !important;
    }
}

.event-detail-tabs ::deep .mud-tabs-tabbar-inner {
    flex-wrap: nowrap !important;
}

.event-detail-tabs ::deep .mud-tabs-scroll-button {
    opacity: 0.35;
}

@media (max-width: 959px) {
    .event-detail-tabs ::deep .mud-tabs-scroll-button {
        display: none;
    }
}

/* Pilot edit dialog — keep category select popover above dialog on mobile */
.admin-layout ::deep .mud-dialog .mud-select .mud-popover,
.mud-popover-provider > .mud-popover-open {
    z-index: calc(var(--mud-zindex-dialog) + 2);
}

.admin-layout ::deep .mud-dialog-content {
    overflow: visible;
}

@media (min-width: 768px) and (max-width: 1023px) {
    .results-export-btn-wrap .results-export-icon-btn {
        width: 100%;
        border-radius: 8px;
    }
}

.results-filter-bar .results-filter-export {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.results-filter-bar .results-export-icon-btn {
    width: 42px;
    height: 42px;
}

@media (min-width: 768px) {
    .results-filter-bar .filter-bar-search {
        flex: 2 1 0;
    }

    .results-filter-bar .filter-bar-status {
        flex: 1 1 0;
        max-width: none;
    }
}

.gx-empty-state__subtitle {
    color: var(--gx-text-secondary, rgba(255, 255, 255, 0.72)) !important;
}

.page-header .mud-typography-body2,
.page-header .admin-page-subtitle,
.admin-page-subtitle {
    color: var(--gx-text-secondary, rgba(255, 255, 255, 0.72)) !important;
}

/* ── Event detail tabs (mobile scroll) ─────────────────────── */

.event-detail-tabs ::deep .mud-tabs-tabbar {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    flex-wrap: nowrap !important;
}

.event-detail-tabs ::deep .mud-tab {
    scroll-snap-align: start;
    flex-shrink: 0;
}

.event-detail-header .page-header {
    text-align: center;
}

@media (min-width: 768px) {
    .event-detail-header .page-header {
        text-align: left;
    }
}

.page-header .admin-page-title,
.page-header .mud-typography-h4.fw-bold {
    color: var(--gx-text-primary, #fff);
}

.page-header .admin-page-subtitle,
.page-header .gx-text-secondary {
    color: var(--gx-text-secondary, rgba(255, 255, 255, 0.72)) !important;
}

@media (max-width: 767px) {
    .page-header-row .page-header {
        text-align: center;
        width: 100%;
    }

    .event-card-actions .mud-button-root:first-child {
        flex: 1;
    }

    .event-card-icon-actions {
        flex-shrink: 0;
    }
}

.permissions-mobile-cards .mud-paper {
    border: 1px solid var(--gx-border-subtle);
}

.audit-mobile-cards .audit-diff-added {
    color: var(--mud-palette-success);
}

.audit-mobile-cards .audit-diff-removed {
    color: var(--mud-palette-error);
    text-decoration: line-through;
}

.gx-auth-button-wrap .mud-button-root[disabled],
.gx-auth-button-wrap .mud-button-root.mud-disabled {
    pointer-events: none;
}

