/* Surgalt.dev — Bootstrap 5 theme overrides + the handful of components
   Bootstrap has no equivalent for (video player controls, the app-style
   mobile bottom tab bar). Everything else in the site is built directly
   from Bootstrap's own grid/utility/component classes in the templates -
   see static/vendor/bootstrap/. Bootstrap 5.3 ships its component colors
   as CSS custom properties, but most components set their *own* literal
   hex values rather than referencing the shared --bs-primary token, so
   re-theming without a Sass build means overriding both the shared
   tokens and the handful of components that hardcode them.
*/

:root {
    --bs-primary: #011084;
    --bs-primary-rgb: 1, 16, 132;
    --bs-primary-text-emphasis: #011084;
    --bs-primary-bg-subtle: #dde0f6;
    --bs-primary-border-subtle: #b3bbec;
    --bs-link-color: #011084;
    --bs-link-color-rgb: 1, 16, 132;
    --bs-link-hover-color: #020b5f;
    --bs-link-hover-color-rgb: 2, 11, 95;
}

.btn-primary {
    --bs-btn-bg: #011084;
    --bs-btn-border-color: #011084;
    --bs-btn-hover-bg: #020b5f;
    --bs-btn-hover-border-color: #020b5f;
    --bs-btn-active-bg: #020b5f;
    --bs-btn-active-border-color: #010a52;
    --bs-btn-disabled-bg: #011084;
    --bs-btn-disabled-border-color: #011084;
    --bs-btn-focus-shadow-rgb: 1, 16, 132;
}

.btn-outline-primary {
    --bs-btn-color: #011084;
    --bs-btn-border-color: #011084;
    --bs-btn-hover-bg: #011084;
    --bs-btn-hover-border-color: #011084;
    --bs-btn-active-bg: #011084;
    --bs-btn-active-border-color: #011084;
    --bs-btn-disabled-color: #011084;
    --bs-btn-disabled-border-color: #011084;
    --bs-btn-focus-shadow-rgb: 1, 16, 132;
}

.list-group-item.active {
    --bs-list-group-active-bg: #011084;
    --bs-list-group-active-border-color: #011084;
}

.dropdown-item.active,
.dropdown-item:active {
    --bs-dropdown-link-active-bg: #011084;
}

.page-item.active .page-link {
    --bs-pagination-active-bg: #011084;
    --bs-pagination-active-border-color: #011084;
}

.form-check-input:checked {
    background-color: #011084;
    border-color: #011084;
}

.form-control:focus,
.form-select:focus {
    border-color: #6b74c2;
    box-shadow: 0 0 0 0.25rem rgba(1, 16, 132, 0.25);
}

/* Rounded-pill hover/active state for the top nav links - Bootstrap's own
   .navbar-nav only changes text color on hover/active, no background. */

.navbar-nav .nav-link {
    border-radius: var(--bs-border-radius);
    padding-left: 1rem;
    padding-right: 1rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active,
.navbar-nav .nav-link.show {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

body {
    overflow-x: hidden;
}

.site-main {
    min-height: 60vh;
}

/* App-style bottom tab bar (mobile only, via the d-lg-none utility class
   on the element itself) - Bootstrap has no ready-made component for
   this navigation pattern. */

.mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    border-top: 1px solid var(--bs-border-color);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 1030;
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
}

.mobile-tabbar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--bs-secondary-color);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 4px 2px;
    text-align: center;
    text-decoration: none;
}

.mobile-tabbar__item:hover {
    color: var(--bs-secondary-color);
}

/* Video player - custom controls overlay (no Bootstrap equivalent) */

.player-video-wrap {
    position: relative;
    background: #000;
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    margin-bottom: 12px;
    aspect-ratio: 16 / 9;
    max-height: 70vh;
}

.player-video-wrap video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
}

.player-overlay-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 100%);
    color: #fff;
    transition: opacity 0.2s ease;
}

.player-video-wrap.controls-hidden .player-overlay-top {
    opacity: 0;
}

.player-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    flex-shrink: 0;
}

.player-back-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.player-overlay-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

.player-overlay-course {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-overlay-lesson {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40vw;
}

.player-center-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.75rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.player-video-wrap.is-paused .player-center-play {
    opacity: 1;
    pointer-events: auto;
}

.player-video-wrap.controls-hidden .player-center-play {
    opacity: 0;
    pointer-events: none;
}

.player-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 16px 12px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
    color: #fff;
    transition: opacity 0.2s ease;
}

.player-video-wrap.controls-hidden .player-controls {
    opacity: 0;
    pointer-events: none;
}

.player-seek {
    position: relative;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    margin-bottom: 10px;
}

.player-seek__played {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    border-radius: 999px;
    background: #e50914;
}

.player-seek__handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.player-seek:hover .player-seek__handle,
.player-seek.is-dragging .player-seek__handle {
    opacity: 1;
}

.player-controls__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.player-controls__group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.player-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 6px;
    border-radius: 4px;
    line-height: 1;
    font-size: 0.7rem;
}

.player-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.player-btn--text {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 10px;
}

.player-time {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    margin-left: 4px;
}

.player-volume {
    display: flex;
    align-items: center;
    gap: 4px;
}

.player-volume__slider {
    width: 0;
    opacity: 0;
    transition: width 0.15s ease, opacity 0.15s ease, margin 0.15s ease;
    accent-color: #fff;
}

.player-volume:hover .player-volume__slider,
.player-volume:focus-within .player-volume__slider {
    width: 70px;
    opacity: 1;
    margin-left: 2px;
}

.player-speed {
    position: relative;
}

.player-speed__menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: rgba(20, 20, 20, 0.95);
    border-radius: 8px;
    padding: 6px;
    min-width: 110px;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.player-speed.is-open .player-speed__menu {
    display: flex;
}

.player-speed__menu button {
    background: none;
    border: none;
    color: #fff;
    text-align: left;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.player-speed__menu button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.player-speed__menu button.is-active {
    color: #e50914;
    font-weight: 700;
}

/* In fullscreen, hide everything except the video itself (cinema mode). */

#player-root.is-fullscreen {
    position: relative;
    display: block;
    background: #000;
    height: 100vh;
}

#player-root.is-fullscreen .player-main {
    height: 100%;
    padding: 0;
}

#player-root.is-fullscreen .player-video-wrap {
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
    margin-bottom: 0;
}

#player-root.is-fullscreen .player-nav,
#player-root.is-fullscreen .player-main > h1,
#player-root.is-fullscreen .player-main > p,
#player-root.is-fullscreen .player-main > a.btn,
#player-root.is-fullscreen .player-sidebar {
    display: none;
}
