:root {
    color-scheme: dark;
    --background: #10121b;
    --surface: #1d202d;
    --input: #131620;
    --border: #333647;
    --primary: #9368d0;
    --primary-hover: #aa85df;
    --text: #f2f4f8;
    --muted: #a8adbd;
    --success: #51c993;
    --danger: #ef7474;
    --warning: #e6b566;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(
        ellipse at top,
        #242036 0%,
        var(--background) 65%
    );
}

/* BRAND */

.brand {
    text-align: center;
    margin-bottom: 36px;
}

.brand-name {
    font-size: clamp(20px, 4vw, 34px);
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--primary-hover);
}

.brand-slogan {
    margin-top: 10px;
    font-size: 14px;
    font-style: italic;
    color: var(--muted);
    letter-spacing: .5px;
}

/* CARDS */

.card,
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 16px 60px rgba(0,0,0,.3);
}

.login-card {
    width: 100%;
    max-width: 420px;
}

h1 {
    margin: 0 0 12px;
    font-size: 26px;
}

h2 {
    margin: 0 0 16px;
    font-size: 22px;
}

.login-card h1,
.login-description {
    text-align: center;
}

.login-description {
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 28px;
}

/* INPUTS */

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 20px;
    background: var(--input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary);
    border-color: var(--primary);
}

/* BUTTONS */

button,
.button {
    display: inline-block;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, box-shadow .2s;
}

.login-card button {
    width: 100%;
}

button:hover,
.button:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 20px rgba(147,104,208,.25);
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* APPLICATION LAYOUT */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    padding: 24px 32px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.app-header .brand {
    text-align: left;
    margin: 0;
}

.app-header .brand-name {
    font-size: 24px;
}

.app-header .brand-slogan {
    font-size: 12px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

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

.media-card {
    text-align: center;
    transition: transform .2s, border-color .2s;
}

@media (hover: hover) {
    .media-card:hover {
        transform: translateY(-4px);
        border-color: var(--primary);
    }
}

.media-card .button {
    width: 100%;
    margin-top: 16px;
}

.media-icon {
    color: var(--primary-hover);
    margin-bottom: 20px;
}

/* MESSAGES */

.muted {
    color: var(--muted);
}

.access-note {
    margin-top: 24px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.error-message {
    background: rgba(239,116,116,.1);
    border: 1px solid rgba(239,116,116,.3);
    color: var(--danger);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 20px;
}

.footer {
    margin-top: 32px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* MOBILE */

@media (max-width: 600px) {
    .media-grid {
        grid-template-columns: 1fr;
    }

    .app-header {
        padding: 20px;
    }

    .app-header .brand-name {
        font-size: 19px;
    }

    .card,
    .login-card {
        padding: 24px;
    }
}

/* MEDIA SEARCH */

.back-link {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 24px;
}

.back-link:hover {
    color: var(--primary-hover);
}

.search-form {
    display: flex;
    gap: 12px;
    margin: 24px 0;
}

.search-form input {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.search-results {
    display: grid;
    gap: 16px;
}

.result-card {
    display: flex;
    gap: 24px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    transition: border-color .2s;
}

.result-card:hover {
    border-color: var(--primary);
}

.movie-poster,
.poster-placeholder {
    width: 130px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 10px;
    align-self: flex-start;
    flex-shrink: 0;
}

.poster-placeholder {
    background: var(--input);
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 13px;
}

.result-details {
    flex: 1;
    min-width: 0;
}

.result-details h2 {
    margin-bottom: 10px;
}

.media-status {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--input);
    color: var(--muted);
    font-size: 13px;
}

.status-5 {
    color: var(--success);
}

.status-2,
.status-3,
.status-4 {
    color: var(--warning);
}

.movie-overview {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

@media (max-width: 600px) {
    .result-card {
        gap: 14px;
        padding: 14px;
    }

    .movie-poster,
    .poster-placeholder {
        width: 85px;
    }

    .result-details h2 {
        font-size: 18px;
    }
}

/* MOVIE DETAILS */

.movie-hero {
    display: flex;
    align-items: flex-start;
    gap: 32px;
}

.detail-poster {
    width: 190px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 12px;
}

.movie-information {
    flex: 1;
    min-width: 0;
}

.metadata-id {
    color: var(--muted);
    font-size: 12px;
}

.detail-section {
    margin-top: 24px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row span {
    color: var(--muted);
}

.detail-row:last-child {
    border-bottom: none;
}

.notice {
    padding: 16px;
    margin-bottom: 16px;
    line-height: 1.5;
    border-radius: 10px;
    border: 1px solid;
}

.notice-success {
    color: var(--success);
    background: rgba(81,201,147,.08);
    border-color: rgba(81,201,147,.25);
}

.notice-warning {
    color: var(--warning);
    background: rgba(230,181,102,.08);
    border-color: rgba(230,181,102,.25);
}

select:disabled {
    opacity: .5;
}

@media (max-width: 600px) {
    .movie-hero {
        gap: 18px;
        flex-direction: column;
    }

    .detail-poster {
        width: 140px;
    }
}


/* Automatic media analysis */

.analysis-results {
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 18px;
    background: #131620;
    border: 1px solid #333647;
    border-radius: 12px;
}

.analysis-results[hidden] {
    display: none;
}

.media-property {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #333647;
}

.media-property:last-child {
    border-bottom: 0;
}

.media-property strong {
    text-align: right;
    overflow-wrap: anywhere;
    min-width: 0;
}

.analysis-success {
    color: #51c993;
    font-weight: 600;
}

.analysis-error {
    color: #ef7474;
    font-weight: 600;
}

.upload-button {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    border-radius: 10px;
}

.upload-button[data-state="blocked"] {
    background: #963c45 !important;
    color: #ffffff !important;
    opacity: 1;
}

.upload-button[data-state="pending"] {
    background: #997029 !important;
    color: #ffffff !important;
    opacity: 1;
}


/* Library quality comparison */

.quality-status {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid #333647;
    border-radius: 10px;
    font-weight: 600;
}

.quality-status[hidden] {
    display: none;
}

.quality-status[data-state="new"] {
    color: #51c993;
    background: rgba(81, 201, 147, .08);
    border-color: rgba(81, 201, 147, .30);
}

.quality-status[data-state="duplicate"],
.quality-status[data-state="blocked"] {
    color: #ef7474;
    background: rgba(239, 116, 116, .08);
    border-color: rgba(239, 116, 116, .30);
}

.quality-status[data-state="upgrade"],
.quality-status[data-state="review"],
.quality-status[data-state="pending"] {
    color: #e6b566;
    background: rgba(230, 181, 102, .08);
    border-color: rgba(230, 181, 102, .30);
}

.upload-button[data-state="ready"] {
    background: #9368d0 !important;
    color: #ffffff !important;
    opacity: 1;
}

.upload-button[data-state="upgrade"] {
    background: #997029 !important;
    color: #ffffff !important;
    opacity: 1;
}


/* UPLOAD TRANSFER PANEL */

.upload-progress-panel {
    margin-top: 24px;
    padding: 22px;
    background: #131620;
    border: 1px solid #333647;
    border-radius: 12px;
}

.upload-progress-panel[hidden],
.upload-progress-panel [hidden] {
    display: none !important;
}

.transfer-heading,
.transfer-statistics {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.transfer-heading {
    margin-bottom: 14px;
    color: #f2f4f8;
}

#transfer-percent {
    color: #aa85df;
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}

#transfer-progress {
    display: block;
    appearance: none;
    width: 100%;
    height: 12px;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    background: #333647;
}

#transfer-progress::-webkit-progress-bar {
    background: #333647;
    border-radius: 8px;
}

#transfer-progress::-webkit-progress-value {
    background: #9368d0;
    border-radius: 8px;
    transition: width .25s ease;
}

#transfer-progress::-moz-progress-bar {
    background: #9368d0;
    border-radius: 8px;
    transition: width .25s ease;
}

.transfer-statistics {
    margin-top: 12px;
    color: #a8adbd;
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

#transfer-eta {
    margin-top: 12px;
    font-size: .9rem;
}

.transfer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.transfer-actions button {
    flex: 1;
    background: #252837;
    color: #f2f4f8;
    border: 1px solid #44485c;
    border-radius: 8px;
    padding: 12px 18px;
    cursor: pointer;
}

.transfer-actions button:hover:not(:disabled) {
    border-color: #9368d0;
    background: #30283f;
}

.transfer-actions button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.transfer-security {
    margin-top: 18px;
    font-size: .8rem;
    color: #51c993;
}

.transfer-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    background: #1d202d;
    overflow-wrap: anywhere;
}

.transfer-message[data-state="error"] {
    color: #ef7474;
}

.transfer-message[data-state="success"] {
    color: #51c993;
}

.transfer-message[data-state="warning"] {
    color: #e6b566;
}



/* MEDIA SOURCE SELECTION */

.source-panel {
    margin-top: 24px;
    padding: 20px;
    background: #131620;
    border: 1px solid #333647;
    border-radius: 12px;
}

.source-panel[hidden] {
    display: none !important;
}

.source-panel h3 {
    margin: 0 0 16px;
    color: #f2f4f8;
}

.source-message {
    margin: 0 0 18px;
    color: #e6b566;
    line-height: 1.5;
}

.source-message[data-state="detected"],
.source-message[data-state="confirmed"] {
    color: #51c993;
}

.source-panel select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 13px 14px;
    background: #1d202d;
    border: 1px solid #44485c;
    border-radius: 8px;
    color: #f2f4f8;
    font: inherit;
    color-scheme: dark;
    cursor: pointer;
}

.source-panel select:focus {
    outline: none;
    border-color: #9368d0;
    box-shadow: 0 0 0 3px rgba(147, 104, 208, .15);
}

.source-panel select:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.source-help {
    color: #a8adbd;
    font-size: .85rem;
    line-height: 1.5;
    margin: 10px 0;
}

.source-quality-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding: 16px 0;
    border-top: 1px solid #333647;
}

#assigned-quality {
    color: #aa85df;
    text-align: right;
}

#assigned-quality[data-state="classified"] {
    color: #51c993;
}

#assigned-quality[data-state="review"] {
    color: #e6b566;
}


/* My Uploads */

.uploads-heading,
.upload-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.upload-list-item {
    padding: 18px 0;
    border-bottom: 1px solid #333647;
}

.upload-list-item:first-child {
    padding-top: 0;
}

.upload-list-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.upload-list-heading h3 {
    margin: 0;
    overflow-wrap: anywhere;
}

.upload-list-filename {
    margin: 8px 0 4px;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.upload-list-date {
    margin: 4px 0 12px;
    font-size: 0.8rem;
}

.upload-list-status {
    color: #bb97ee;
    font-size: 0.9rem;
    font-weight: 600;
}

.upload-list-status[data-state="completed"] {
    color: #51c993;
}

.upload-list-status[data-state="failed"],
.upload-list-status[data-state="rejected"] {
    color: #ef7474;
}

.upload-list-status[data-state="cancelled"],
.upload-list-status[data-state="expired"] {
    color: var(--muted);
}

.upload-list-status[data-state="awaiting_approval"],
.upload-list-status[data-import-state="needs_review"] {
    color: #e6b566;
}

.upload-list-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-list-progress progress {
    flex: 1;
    min-width: 0;
    height: 8px;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    background: #333647;
    accent-color: #9368d0;
}

.upload-list-progress progress::-webkit-progress-bar {
    background: #333647;
}

.upload-list-progress progress::-webkit-progress-value {
    background: #9368d0;
    border-radius: 8px;
}

.upload-list-progress progress::-moz-progress-bar {
    background: #9368d0;
    border-radius: 8px;
}

.upload-list-progress span {
    min-width: 44px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--muted);
}


/* Upload cancellation */

.upload-list-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

button.upload-cancel-button {
    background: transparent;
    color: #ef7474;
    border: 1px solid #ef7474;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
}

button.upload-cancel-button:hover {
    background: rgba(239, 116, 116, 0.12);
}

.upload-list-status[data-state="cancelling"] {
    color: #e6b566;
}

.upload-cancel-message {
    margin-top: 12px;
    font-size: 0.9rem;
}


/* Administration */

.admin-section {
    margin-bottom: 24px;
}

.admin-table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #333647;
    vertical-align: middle;
}

.admin-table th {
    color: #a8adbd;
    font-size: 0.85rem;
    font-weight: 500;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

.admin-table td:last-child,
.admin-table th:last-child {
    text-align: right;
    white-space: nowrap;
}

.admin-role {
    font-weight: 500;
}

.admin-role[data-role="administrator"] {
    color: #aa85df;
}

.admin-role[data-role="contributor"] {
    color: #51c993;
}

.admin-role[data-role="regular"] {
    color: #a8adbd;
}

.admin-role[data-role="disabled"] {
    color: #ef7474;
}


/* Pending approvals */

.approval-card {
    border: 1px solid #333647;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    background: #171925;
}

.approval-card h3 {
    margin: 0 0 8px;
}

.approval-meta,
.approval-filename {
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.approval-comparison {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 20px 0;
}

.approval-version {
    background: #1d202d;
    border: 1px solid #333647;
    border-radius: 10px;
    padding: 18px;
    overflow-wrap: anywhere;
}

.approval-version h3 {
    margin-top: 12px;
}

.approval-proposed {
    border-color: #51c993;
}

.approval-size {
    font-size: 1.7rem;
    font-weight: 600;
    margin: 10px 0;
}

.approval-storage {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
}

.approval-storage strong {
    color: #51c993;
}

.approval-storage strong[data-increase="True"] {
    color: #e6b566;
}

.approval-reason {
    color: #e6b566;
    background: rgba(230, 181, 102, 0.07);
    border-radius: 8px;
    padding: 12px;
}

.approval-hierarchy {
    border-top: 1px solid #333647;
    border-bottom: 1px solid #333647;
    margin: 18px 0;
    padding: 14px 0;
}

.approval-hierarchy summary {
    cursor: pointer;
    color: #aa85df;
    font-weight: 500;
}

.hierarchy-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 0.85rem;
}

.hierarchy-rank {
    color: #a8adbd;
    min-width: 28px;
}

.hierarchy-name {
    flex: 1;
}

.hierarchy-markers {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    color: #a8adbd;
    font-size: 0.75rem;
}

.hierarchy-current {
    background: rgba(147, 104, 208, 0.14);
}

.hierarchy-proposed {
    background: rgba(81, 201, 147, 0.12);
}

.marker-current {
    color: #aa85df;
}

.marker-proposed,
.marker-allowed {
    color: #51c993;
}

.approval-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.approval-empty {
    padding: 24px;
    text-align: center;
    color: #a8adbd;
}

@media (max-width: 600px) {

    .approval-comparison {
        grid-template-columns: 1fr;
    }

    .hierarchy-markers {
        max-width: 45%;
    }
}


/* Administrator rejection pending */

.upload-list-status[data-state="rejecting"] {
    color: #e6b566;
}


/* Administrator upload history */

.admin-upload-message {
    color: #e6b566;
    background: rgba(230, 181, 102, 0.07);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.admin-upload-message[data-state="rejected"],
.admin-upload-message[data-state="failed"] {
    color: #ef7474;
    background: rgba(239, 116, 116, 0.07);
}

.admin-upload-limit {
    font-size: 0.8rem;
    margin-top: 18px;
}


/* Brand home navigation */
.brand-name .brand-home-link,
.brand-name .brand-home-link:visited,
.brand-name .brand-home-link:hover {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.brand-name .brand-home-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}
