/* MatchView Custom Styles */

:root {
    --matchview-primary: #3498DB;
    --matchview-primary-dark: #2980B9;
    --matchview-dark-blue: #318EB0;
    --matchview-darker-blue: #1A252F;
    --matchview-off-white: #ECEFF1;
    --matchview-light-grey: #F5F5F5;
    --matchview-grey: #5D6D7E;
    --matchview-dark-grey: #4A4A4A;
    --matchview-accent: #5DADE2;
}

html, body {
    font-family: 'Roboto', sans-serif;
    overflow-x: hidden;
}

/* Main layout: comfortable horizontal padding on small screens */
.matchview-main-container {
    padding-left: 12px !important;
    padding-right: 12px !important;
    max-width: 100%;
}

@media (min-width: 600px) {
    .matchview-main-container {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

@media (min-width: 960px) {
    .matchview-main-container {
        padding-left: 24px !important;
        padding-right: 24px !important;
    }
}

/* App bar: avoid chip + actions overflowing on narrow screens */
.matchview-appbar-userchip .mud-chip-content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: min(200px, 46vw);
}

@media (max-width: 400px) {
    .matchview-appbar-userchip .mud-chip-content {
        max-width: 36vw;
    }
}

/* Data tables: horizontal scroll on desktop (Manage Videos uses cards on narrow screens) */
.mud-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 8px;
}

@media (min-width: 960px) {
    .manage-videos-desktop-table.mud-table-responsive .mud-table-root {
        min-width: 720px;
    }
}

/*
 * Manage Videos: cards below md; table md+.
 * Must use !important — MudStack sets display:flex and loads after app.css, which
 * was overriding display:none and caused both layouts to show on desktop.
 */
.manage-videos-mobile-list {
    display: none !important;
}

.manage-videos-toolbar-mobile {
    display: none !important;
}

.manage-videos-desktop-table {
    display: block !important;
}

@media (max-width: 959.98px) {
    .manage-videos-toolbar-mobile {
        display: flex !important;
        flex-direction: column !important;
    }

    .manage-videos-mobile-list {
        display: block !important;
    }

    .manage-videos-desktop-table {
        display: none !important;
    }

    .manage-videos-search-full,
    .manage-videos-filter-full {
        width: 100% !important;
        max-width: none !important;
    }

    .manage-video-card .manage-video-card-actions {
        justify-content: flex-start;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        padding-top: 8px;
        margin-top: 4px;
    }
}

/* Admin video page header stacks on narrow viewports */
.manage-videos-header {
    align-items: flex-start !important;
}

@media (max-width: 600px) {
    .manage-videos-header {
        flex-direction: column;
        align-items: stretch !important;
    }
    .manage-videos-title {
        font-size: 1.35rem !important;
    }
    .manage-videos-add-btn {
        width: 100%;
    }
}

/* Home hero */
.hero-block {
    border-radius: 6px;
}

@media (max-width: 600px) {
    .hero-block {
        border-radius: 0;
        margin-left: -4px;
        margin-right: -4px;
        width: calc(100% + 8px);
    }
    .hero-block .mud-button {
        width: 100%;
        max-width: 280px;
    }
}

/* MudBlazor theme overrides for MatchView branding */
.mud-theme-primary {
    background-color: var(--matchview-primary) !important;
}

.mud-appbar.mud-appbar-color-primary {
    background-color: var(--matchview-dark-blue) !important;
}

/* Video container for responsive embedding */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background-color: #000;
    border-radius: 8px;
}

.video-container iframe,
.video-container video,
.video-container #video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Small video preview container */
.video-preview-small {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background-color: #000;
    border-radius: 4px;
}

.video-preview-small iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Event list scrollable container */
.event-list {
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.event-list::-webkit-scrollbar {
    width: 6px;
}

.event-list::-webkit-scrollbar-track {
    background: var(--matchview-light-grey);
    border-radius: 3px;
}

.event-list::-webkit-scrollbar-thumb {
    background: var(--matchview-grey);
    border-radius: 3px;
}

.event-list::-webkit-scrollbar-thumb:hover {
    background: var(--matchview-dark-grey);
}

/* Selected event highlight */
.event-selected {
    background-color: rgba(52, 152, 219, 0.12) !important;
    border-left: 3px solid var(--matchview-primary);
}

/* Time offset button styling */
.time-offset-btn {
    min-width: 55px !important;
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
    .mud-table-cell {
        padding: 8px 4px !important;
        font-size: 0.875rem;
    }
    
    .filter-chips .mud-chip {
        margin: 2px !important;
        font-size: 0.75rem;
    }
    
    .time-offset-btn {
        min-width: 45px !important;
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
    }
    
    .event-list {
        max-height: 300px;
    }
    
    .video-container {
        border-radius: 0;
        margin-left: -16px;
        margin-right: -16px;
        width: calc(100% + 32px);
    }
}

/* Tablet adjustments */
@media (min-width: 601px) and (max-width: 959px) {
    .event-list {
        max-height: 400px;
    }
}

/* Cursor pointer for clickable items */
.cursor-pointer {
    cursor: pointer;
}

/* Card hover effect */
.mud-card.cursor-pointer:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

/* Filter chips container */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Loading spinner centered */
.loading-center {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* Sticky dialog actions for scrollable dialogs */
.sticky-dialog-actions {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    margin-top: auto;
    z-index: 1;
}

/* Scrollable dialog content */
.scrollable-dialog-content {
    max-height: 60vh;
    overflow-y: auto;
}

/* MatchView Logo styling */
.matchview-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.matchview-logo-icon {
    width: 32px;
    height: 32px;
}

.matchview-logo-text {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.matchview-logo-text .match {
    color: var(--matchview-off-white);
}

.matchview-logo-text .view {
    color: var(--matchview-accent);
}

/* Audit log styling */
.audit-log-item {
    border-left: 3px solid var(--matchview-primary);
    padding-left: 12px;
    margin-bottom: 8px;
}

.audit-log-item.email-action {
    border-left-color: #9b59b6;
}

.audit-log-item.video-action {
    border-left-color: #27ae60;
}

.audit-log-item.user-action {
    border-left-color: #e67e22;
}

.audit-log-item.access-action {
    border-left-color: #3498db;
}
