@import url("https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;600;700;800&display=swap");

* {
    box-sizing: border-box;
}

body {
    font-family: "Heebo", system-ui, sans-serif;
}

body.auth-locked header,
body.auth-locked main,
body.auth-locked footer {
    display: none;
}

body.auth-locked #login-modal {
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.62)),
        radial-gradient(circle at 20% 20%, rgba(220, 38, 38, 0.35), transparent 34%),
        linear-gradient(135deg, rgb(9, 9, 11), rgb(24, 24, 27));
}

body.auth-locked #login-modal > div {
    position: relative;
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
}

body.auth-locked #login-modal > div::before {
    content: "CineVault";
    display: block;
    margin-bottom: 1rem;
    color: white;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0;
    text-align: center;
}

button {
    cursor: pointer;
}

.nav-link.active {
    color: rgb(239 68 68);
}

.hero-bg {
    background:
        linear-gradient(90deg, rgba(9, 9, 11, 0.2), rgba(9, 9, 11, 0.92)),
        linear-gradient(0deg, rgb(9, 9, 11), rgba(9, 9, 11, 0.1) 45%),
        var(--hero-image, url("https://picsum.photos/id/1015/1920/1080")) center / cover no-repeat;
}

#hero-genres {
    display: none;
}

#hero-genres span {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card {
    transition: transform 0.24s ease, opacity 0.24s ease;
}

.card:hover {
    transform: translateY(-7px) scale(1.035);
    z-index: 5;
}

.poster {
    transition: box-shadow 0.24s ease, filter 0.24s ease;
}

.card:hover .poster {
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.55), 0 8px 10px -6px rgb(0 0 0 / 0.55);
    filter: brightness(1.06);
}

.line-clamp-2,
.line-clamp-3,
.line-clamp-4 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    -webkit-line-clamp: 2;
}

.line-clamp-3 {
    -webkit-line-clamp: 3;
}

.line-clamp-4 {
    -webkit-line-clamp: 4;
}

.genre-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    max-height: 6.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding-block: 0.125rem;
    scrollbar-width: thin;
    width: 100%;
}

.genre-button {
    max-width: 12rem;
    min-height: 2.625rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.25rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(180deg, rgba(24, 24, 27, 0.95) 0%, rgba(9, 9, 11, 0.85) 100%);
    border: 1px solid #3f3f46;
    border-radius: 1.25rem;
}

.toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 9.5rem;
    flex: 1 1 9.5rem;
    max-width: 14rem;
}

.toolbar-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #d4d4d8;
    padding-inline: 0.125rem;
}

.toolbar-select {
    appearance: none;
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #fafafa;
    background-color: #27272a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a1a1aa' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    border: 1px solid #52525b;
    border-radius: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.toolbar-select:hover {
    border-color: #71717a;
    background-color: #303036;
}

.toolbar-select:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.toolbar-select option {
    background: #18181b;
    color: #fafafa;
}

@media (min-width: 768px) {
    .catalog-toolbar {
        gap: 1.25rem 1.5rem;
    }

    .toolbar-field {
        flex: 0 1 12rem;
    }
}

.continue-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.continue-strip {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    flex: 1;
    padding-block: 0.25rem;
}

.continue-strip::-webkit-scrollbar {
    display: none;
}

.continue-nav {
    flex: 0 0 2.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: rgb(39 39 42);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.continue-nav:hover {
    background: rgb(63 63 70);
}

.continue-card {
    flex: 0 0 11.5rem;
    width: 11.5rem;
    text-align: right;
    color: white;
    position: relative;
}

.continue-card-play {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: inherit;
}

.continue-remove {
    position: absolute;
    top: 0.45rem;
    left: 0.45rem;
    z-index: 3;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.continue-remove:hover {
    background: rgb(127 29 29);
}

.continue-card-poster {
    position: relative;
    overflow: hidden;
    border-radius: 0.9rem;
    aspect-ratio: 2 / 3;
    background: rgb(39 39 42);
    border: 1px solid rgb(63 63 70);
}

.continue-card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.continue-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.15) 55%, transparent);
}

.continue-card-copy {
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 1;
}

.continue-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.2rem;
}

.continue-card-subtitle {
    font-size: 0.8rem;
    color: rgb(212 212 216);
}

.continue-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0.28rem;
    background: rgba(255, 255, 255, 0.25);
    z-index: 2;
}

.continue-progress-bar {
    height: 100%;
    background: rgb(220 38 38);
}

.modal-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    z-index: 2;
}

.details-shell {
    position: relative;
    max-height: calc(100vh - 2rem);
}

.details-layout {
    max-height: calc(100vh - 2rem);
    overflow: hidden;
}

.details-copy {
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.series-picker {
    margin-top: 1.5rem;
}

.episode-button.active {
    background: rgb(220 38 38);
    color: white;
}

.episode-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
    margin-top: 0.75rem;
    padding: 1rem;
    border: 1px solid rgb(63 63 70);
    border-radius: 0.875rem;
    background: rgb(15 15 18);
}

.genre-strip::-webkit-scrollbar,
.details-copy::-webkit-scrollbar {
    width: 0.55rem;
}

.genre-strip::-webkit-scrollbar-thumb,
.details-copy::-webkit-scrollbar-thumb {
    background: rgb(113 113 122);
    border-radius: 999px;
}

.picker-field label {
    display: block;
    margin-bottom: 0.45rem;
    color: rgb(212 212 216);
    font-weight: 600;
}

.picker-field select {
    width: 100%;
    height: 3.25rem;
    border: 1px solid rgb(63 63 70);
    border-radius: 0.75rem;
    background: rgb(39 39 42);
    color: white;
    padding-inline: 1rem;
    outline: none;
}

.picker-field select:focus {
    border-color: rgb(239 68 68);
}

.episode-watch-button {
    height: 3.25rem;
    padding-inline: 1.5rem;
    border-radius: 0.75rem;
    background: rgb(220 38 38);
    color: white;
    font-weight: 700;
    white-space: nowrap;
}

.episode-note {
    grid-column: 1 / -1;
    color: rgb(161 161 170);
    font-size: 0.95rem;
}

.my-list-action {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.1rem;
    padding-inline: 0.85rem;
    border-radius: 999px;
    background: rgb(220 38 38);
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
}

.my-list-add.added {
    background: rgb(22 163 74);
}

.my-list-remove {
    background: white;
    color: rgb(220 38 38);
}

.my-list-remove.removed {
    background: rgb(244 244 245);
    color: rgb(22 163 74);
}

.details-actions {
    margin-bottom: 1.75rem;
}

.delete-catalog-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 3.5rem;
    padding-inline: 1.25rem;
    border-radius: 0.875rem;
    border: 1px solid rgb(239 68 68 / 0.55);
    background: rgb(24 24 27);
    color: rgb(252 165 165);
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.delete-catalog-btn:hover {
    background: rgb(127 29 29 / 0.35);
    border-color: rgb(248 113 113);
    color: white;
}

.admin-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto auto auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.admin-form label span {
    display: block;
    margin-bottom: 0.35rem;
    color: rgb(212 212 216);
    font-size: 0.9rem;
}

.admin-form input {
    width: 100%;
    min-height: 2.75rem;
    border: 1px solid rgb(63 63 70);
    border-radius: 0.75rem;
    background: rgb(39 39 42);
    color: white;
    padding-inline: 0.8rem;
    outline: none;
}

.admin-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
}

.admin-check input {
    width: 1.1rem;
    min-height: 1.1rem;
}

.admin-save,
.admin-reset,
.admin-action {
    min-height: 2.75rem;
    padding-inline: 1rem;
    border-radius: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.admin-save {
    background: rgb(220 38 38);
}

.admin-reset,
.admin-action {
    background: rgb(39 39 42);
}

.admin-delete {
    background: rgb(127 29 29);
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid rgb(63 63 70);
    border-radius: 0.875rem;
}

.admin-table {
    width: 100%;
    min-width: 72rem;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.9rem;
    border-bottom: 1px solid rgb(39 39 42);
    text-align: right;
    vertical-align: middle;
}

.admin-table th {
    color: rgb(212 212 216);
    background: rgb(24 24 27);
}

.admin-table td {
    color: rgb(244 244 245);
}

.device-summary {
    font-weight: 800;
    color: rgb(248 113 113);
    margin-bottom: 0.35rem;
}

.device-list {
    display: grid;
    gap: 0.35rem;
}

.device-row {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) minmax(8rem, auto) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem;
    border-radius: 0.5rem;
    background: rgb(24 24 27);
}

.device-row span,
.device-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-row small {
    color: rgb(161 161 170);
}

.device-delete {
    border-radius: 0.45rem;
    background: rgb(127 29 29);
    color: white;
    padding: 0.35rem 0.55rem;
    font-size: 0.85rem;
}

.media-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.media-tab {
    min-height: 2.75rem;
    padding-inline: 1.25rem;
    border-radius: 9999px;
    background: rgb(39 39 42);
    color: white;
    font-weight: 700;
}

.media-tab.active {
    background: rgb(220 38 38);
}

.media-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.media-form.hidden {
    display: none;
}

.media-form label span {
    display: block;
    margin-bottom: 0.35rem;
    color: rgb(212 212 216);
    font-size: 0.9rem;
}

.media-form input,
.media-form textarea,
.media-form select {
    width: 100%;
    min-height: 2.75rem;
    border: 1px solid rgb(63 63 70);
    border-radius: 0.75rem;
    background: rgb(39 39 42);
    color: white;
    padding-inline: 0.8rem;
    outline: none;
}

.media-form textarea {
    min-height: 7rem;
    padding-block: 0.75rem;
    resize: vertical;
}

.media-wide {
    grid-column: 1 / -1;
}

.media-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.series-search-wrap {
    position: relative;
}

.series-results {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 0.35rem);
    z-index: 20;
    max-height: 16rem;
    overflow-y: auto;
    border: 1px solid rgb(63 63 70);
    border-radius: 0.75rem;
    background: rgb(24 24 27);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.series-results.hidden {
    display: none;
}

.series-result-item {
    display: block;
    width: 100%;
    text-align: right;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgb(39 39 42);
    color: white;
}

.series-result-item:hover,
.series-result-item.active {
    background: rgb(39 39 42);
}

.series-result-item:last-child {
    border-bottom: none;
}

.series-result-meta {
    display: block;
    margin-top: 0.2rem;
    color: rgb(161 161 170);
    font-size: 0.85rem;
}

.series-results-empty {
    padding: 0.85rem 1rem;
    color: rgb(161 161 170);
    font-size: 0.9rem;
}

video {
    background: black;
    object-fit: contain;
}

@media (max-width: 640px) {
    .card:hover {
        transform: none;
    }
}

.series-results-empty {
    padding: 0.85rem 1rem;
    color: rgb(161 161 170);
    font-size: 0.9rem;
}

.profile-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
    align-items: start;
}

.profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: rgb(24 24 27);
    border: 1px solid rgb(63 63 70);
    border-radius: 1rem;
    padding: 0.75rem;
}

.profile-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: right;
    padding: 0.9rem 1rem;
    border-radius: 0.75rem;
    color: rgb(212 212 216);
    background: transparent;
    font-size: 1rem;
}

.profile-nav-item:hover,
.profile-nav-item.active {
    background: rgb(39 39 42);
    color: white;
}

.profile-nav-logout {
    margin-top: 0.5rem;
    color: rgb(248 113 113);
}

.profile-content {
    background: rgb(24 24 27);
    border: 1px solid rgb(63 63 70);
    border-radius: 1rem;
    padding: 1.5rem 1.75rem;
    min-height: 28rem;
}

.profile-panel.hidden {
    display: none;
}

.profile-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.profile-subtitle {
    color: rgb(161 161 170);
    margin-bottom: 1.5rem;
}

.profile-info-table {
    border-top: 1px solid rgb(63 63 70);
}

.profile-info-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid rgb(39 39 42);
}

.profile-info-label {
    color: rgb(161 161 170);
}

.profile-info-value {
    color: white;
}

.profile-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgb(30 58 138);
    color: rgb(191 219 254);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.9rem;
}

.profile-status-badge.inactive {
    background: rgb(127 29 29);
    color: rgb(254 202 202);
}

.profile-devices-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-device-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgb(63 63 70);
    border-radius: 0.85rem;
    background: rgb(39 39 42);
}

.profile-device-meta {
    min-width: 0;
}

.profile-device-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.profile-device-sub {
    color: rgb(161 161 170);
    font-size: 0.9rem;
}

.profile-device-current {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: rgb(74 222 128);
}

.profile-password-form {
    display: grid;
    gap: 1rem;
    max-width: 28rem;
}

.profile-password-form label span {
    display: block;
    margin-bottom: 0.35rem;
    color: rgb(212 212 216);
}

.profile-password-form input {
    width: 100%;
    min-height: 2.75rem;
    border: 1px solid rgb(63 63 70);
    border-radius: 0.75rem;
    background: rgb(39 39 42);
    color: white;
    padding-inline: 0.8rem;
}

.profile-continue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 1rem;
}

@media (max-width: 768px) {
    #hero-genres {
        display: none;
    }

    .details-layout,
    .details-copy {
        max-height: none;
        overflow: visible;
    }

    .details-shell {
        max-height: none;
    }

    .episode-picker {
        grid-template-columns: 1fr;
    }

    .admin-form {
        grid-template-columns: 1fr;
    }

    .media-form {
        grid-template-columns: 1fr;
    }

    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-info-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }
}
