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

:root {
    --font-display: 'Sora', 'Avenir Next', 'Trebuchet MS', sans-serif;
    --font-body: 'Manrope', 'Avenir Next', 'Trebuchet MS', sans-serif;

    --text-strong: #111322;
    --text-muted: #4f5772;
    --text-soft: #6f7792;

    --surface-page: #f6f8ff;
    --surface-card: #ffffffde;
    --surface-elevated: #fdfdff;

    --border-soft: #ced6eb;
    --border-strong: #95a8d1;

    --accent: #1654cc;
    --accent-strong: #0d3f9c;
    --accent-soft: #dbe8ff;

    --ok-bg: #e9f9ef;
    --ok-border: #99dfb2;
    --ok-text: #21683a;

    --error-bg: #fff0f0;
    --error-border: #f0a4aa;
    --error-text: #8e2430;

    --radius-lg: 24px;
    --radius-md: 14px;
    --radius-sm: 10px;

    --shadow-soft: 0 16px 42px #0f184b18;
    --shadow-strong: 0 22px 52px #0f184b1f;
}

html {
    height: 100%;
    width: 100%;
    margin: 0;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.45;
    color: var(--text-strong);
    background:
        radial-gradient(120% 120% at 0% 0%, #dbe6ff 0%, #f2f5ff 54%, #f8f9ff 100%),
        linear-gradient(160deg, #f7f8ff 0%, #f4f7ff 35%, #fdf6ef 100%);
    overflow-x: hidden;
    position: relative;
}

body::before,
body::after {
    content: '';
    position: fixed;
    z-index: -1;
    pointer-events: none;
    filter: blur(6px);
}

body::before {
    top: -120px;
    right: -70px;
    width: 380px;
    height: 380px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #b7d0ff 0%, #dce8ff 55%, #eef3ff00 100%);
}

body::after {
    left: -170px;
    bottom: -170px;
    width: 480px;
    height: 480px;
    border-radius: 999px;
    background: radial-gradient(circle at 56% 56%, #ffe5c6 0%, #fbeed8 45%, #fff2df00 100%);
}

body * {
    box-sizing: border-box;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: var(--font-display);
    letter-spacing: 0.01em;
    color: var(--text-strong);
}

p {
    margin: 0;
}

a {
    color: var(--accent);
    text-decoration-color: #8daee8;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--accent-strong);
}

/* region HTMX INDICATOR */

.show-indicator.htmx-request,
.htmx-request .show-indicator {
    position: relative;
}

.show-indicator.htmx-request::after,
.htmx-request .show-indicator::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    bottom: -3px;
    left: -3px;
    background: #ecf2ff url(/static/img/loading.svg) repeat-x;
    background-position-y: 50%;
    background-size: 45px 60px;
    border-radius: var(--radius-sm);
    opacity: 0.92;
}

/* endregion */

/* region BUTTONS */

.buttons-row {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin: 8px 0 0;
}

button,
.button-link {
    appearance: none;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    min-height: 44px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: 0.01em;
    background: #f3f7ff;
    color: #23385f;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

button:hover,
.button-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px #1022442b;
    border-color: #6e88bf;
}

button:active,
.button-link:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px #10224426;
}

button:focus-visible,
.button-link:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 3px solid #8fb4ff;
    outline-offset: 2px;
}

button:disabled,
.button-link[aria-disabled='true'] {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

button.--primary,
.button-link.--primary {
    border-color: #0f4fbc;
    background: linear-gradient(165deg, #2e72df 0%, #1458cb 55%, #0f4eb9 100%);
    color: #ffffff;
}

button.--secondary,
.button-link.--secondary {
    border-color: #8ea4cf;
    background: linear-gradient(170deg, #f8fbff 0%, #edf3ff 100%);
    color: #1f3357;
}

button.--ghost,
.button-link.--ghost {
    border-color: #aac1eb;
    background: #edf3ff88;
    color: #23406d;
}

button.--danger,
.button-link.--danger {
    border-color: #d77f8a;
    background: linear-gradient(170deg, #fff2f3 0%, #ffe6ea 100%);
    color: #8a2634;
}

.icon-button {
    min-height: 34px;
    width: 34px;
    padding: 0;
    border-radius: 999px;
    font-size: 16px;
    line-height: 1;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* endregion */

/* region FORM ELEMENTS */

.form-card {
    width: min(100%, 480px);
    margin: 0 auto;
    padding: clamp(20px, 4vw, 30px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    background: var(--surface-card);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 14px;
    backdrop-filter: blur(2px);
}

.form-card h1 {
    font-size: clamp(27px, 4.3vw, 38px);
}

.form-card > p {
    color: var(--text-muted);
}

label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #243253;
    font-weight: 700;
    font-family: var(--font-display);
}

input,
textarea,
select {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid #adbbda;
    background: #ffffff;
    padding: 11px 12px;
    color: var(--text-strong);
    font: inherit;
    font-family: var(--font-body);
}

input::placeholder,
textarea::placeholder {
    color: #7982a2;
}

input:disabled,
textarea:disabled,
select:disabled {
    background: #eef2fb;
    color: #7782a5;
}

/* endregion */

/* region FEEDBACK */

.feedback {
    border-radius: var(--radius-sm);
    border: 1px dashed #b3bed9;
    min-height: 44px;
    padding: 12px 13px;
    display: flex;
    align-items: center;
    color: var(--text-soft);
    background: #f4f7ff;
}

.feedback:empty {
    display: none;
}

.feedback.error {
    border-style: solid;
    border-color: var(--error-border);
    background: var(--error-bg);
    color: var(--error-text);
}

.feedback.success {
    border-style: solid;
    border-color: var(--ok-border);
    background: var(--ok-bg);
    color: var(--ok-text);
}

/* endregion */

/* region AUTH PAGES */

.auth-shell,
.status-page {
    min-height: 100vh;
    width: min(100%, 1200px);
    margin: 0 auto;
    padding: clamp(18px, 5vw, 44px);
    display: grid;
    place-items: center;
}

.auth-panel,
.status-card {
    width: min(100%, 560px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: rise-in 0.45s ease;
}

.auth-kicker,
.status-kicker {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: #4e67a3;
}

.auth-title,
.status-title {
    font-size: clamp(32px, 5.5vw, 48px);
    line-height: 1.05;
}

.auth-copy,
.status-copy {
    color: var(--text-muted);
    max-width: 52ch;
}

.auth-form {
    width: min(100%, 560px);
}

.auth-inline-link {
    margin: -2px 0 0;
    color: var(--text-muted);
}

.auth-inline-link a {
    font-weight: 700;
}

/* endregion */

/* region HOME PAGE */

.home-page {
    min-height: 100vh;
    width: min(100%, 1200px);
    margin: 0 auto;
    padding: clamp(18px, 4.7vw, 42px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-uploader-card,
.uploaded-videos-card {
    width: min(100%, 1080px);
    margin: 0 auto;
    background: var(--surface-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: clamp(18px, 3vw, 32px);
    backdrop-filter: blur(2px);
    animation: rise-in 0.4s ease;
}

.uploaded-videos-card {
    animation-delay: 0.09s;
}

.video-uploader-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.section-kicker {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: #5872ae;
}

.video-uploader-header h1 {
    font-size: clamp(34px, 7vw, 62px);
    line-height: 0.95;
}

.video-uploader-header p {
    margin: 12px 0 0;
    color: var(--text-muted);
    max-width: 70ch;
}

.video-uploader-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-width: fit-content;
}

.ffmpeg-unavailable-banner {
    margin-bottom: 16px;
    padding: clamp(14px, 2vw, 18px);
    border-radius: 16px;
    border: 1px solid #f0a7ad;
    background: linear-gradient(165deg, #fff6f6 0%, #ffe9eb 100%);
    box-shadow: inset 0 1px 0 #ffffffa8;
}

.ffmpeg-unavailable-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(20px, 3.8vw, 28px);
    font-weight: 800;
    color: #901f31;
}

.ffmpeg-unavailable-copy {
    margin-top: 8px;
    color: #7a3340;
}

.ffmpeg-unavailable-reason {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e8b0b8;
    background: #fff;
    font-family: ui-monospace, 'SFMono-Regular', 'Menlo', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.35;
    color: #631823;
    overflow-wrap: anywhere;
}

.video-upload-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.video-upload-form.is-disabled .video-upload-input {
    cursor: not-allowed;
    border-color: #bac5dd;
    background: linear-gradient(170deg, #f6f8fc 0%, #eff2f9 100%);
}

.video-upload-form.is-disabled .video-upload-title {
    color: #556786;
}

.video-upload-form.is-disabled .video-upload-subtitle {
    color: #5f6f8a;
}

.video-upload-input {
    min-height: clamp(260px, 38vh, 390px);
    border: 3px dashed #8ea8d9;
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: clamp(20px, 4vw, 28px);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    background: linear-gradient(170deg, #f8fbff 0%, #edf2ff 65%, #e9efff 100%);
}

.video-upload-input:hover {
    border-color: #4d71b8;
    transform: translateY(-1px);
    box-shadow: 0 10px 25px #12285a1f;
}

.video-upload-input.is-active {
    border-color: #1d4a98;
    box-shadow: 0 0 0 4px #d8e4fc;
    background: linear-gradient(170deg, #f7faff 0%, #e8f0ff 100%);
}

.video-upload-input input[type='file'] {
    width: 1px;
    height: 1px;
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.video-upload-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 5.4vw, 48px);
    font-weight: 800;
    color: #163767;
}

.video-upload-subtitle {
    color: #3f547d;
    max-width: 720px;
    line-height: 1.45;
}

.uploaded-videos-card h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: clamp(24px, 4vw, 34px);
}

.uploaded-videos-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.uploaded-video-item {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #d8e0f0;
    border-radius: 16px;
    background: var(--surface-elevated);
    padding: 13px 14px;
}

.uploaded-video-details {
    min-width: 200px;
    flex: 1;
}

.uploaded-video-name {
    margin: 0;
    color: #122749;
    font-weight: 800;
}

.uploaded-video-name-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 2px solid #bfd0f4;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.uploaded-video-name-link:hover {
    color: #0f3f8e;
    border-color: #6d8fd0;
}

.uploaded-video-meta {
    margin: 5px 0 0;
    color: #4f617d;
    font-size: 14px;
}

.uploaded-video-download {
    min-width: 142px;
}

.uploaded-video-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.uploaded-videos-empty {
    margin: 0;
    color: #4f6175;
}

/* endregion */

/* region STATUS PAGES */

.status-card {
    padding: clamp(20px, 4vw, 32px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    background: var(--surface-card);
    box-shadow: var(--shadow-soft);
}

.status-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.status-code {
    margin: 0;
    font-family: var(--font-display);
    font-size: 72px;
    line-height: 0.92;
    color: #152f57;
}

/* endregion */

/* region FLASH MESSAGES */

#flashMessageContainer {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: min(100vw - 24px, 820px);
}

.flash-message {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.flash-message,
#flashMessageContainer > .feedback {
    padding: 14px 16px;
    max-width: 100%;
    gap: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #b4c0dd;
    background: #f4f7ff;
    color: #1b2e51;
    box-shadow: 0 0 8px #1d2f5d21;
    animation: ease-out flash-message-in 0.45s;
}

.flash-message.disappear,
#flashMessageContainer .feedback.disappear {
    transform: translateY(120%);
    animation: ease-out flash-message-out 0.25s;
}

@keyframes flash-message-in {
    0% {
        transform: translateY(120%);
        opacity: 0;
    }

    100% {
        transform: translateY(0%);
        opacity: 1;
    }
}

@keyframes flash-message-out {
    0% {
        transform: translateY(0%);
        opacity: 1;
    }

    100% {
        transform: translateY(120%);
        opacity: 0;
    }
}

/* endregion */

/* region MODALS */

#modalContainer {
    position: fixed;
    z-index: 500;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden auto;
}

#modalContainer:has(.modal) {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #08112a9e;
    padding: 50px 10px;
}

.modal {
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    background: white;
    min-width: min(100%, 400px);
    position: relative;
}

.modal > .modal {
    position: absolute;
    top: calc(100% + 10px);
}

/* endregion */

/* region POPUPS */

.popup-anchor {
    position: relative;
    z-index: 10;
}

.popup {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-height: 50vh;
    overflow-y: auto;
    padding: 8px;
}

.popup.visible {
    display: block;
}

/* endregion */

@keyframes rise-in {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 820px) {
    .video-uploader-header {
        flex-direction: column;
    }

    .video-uploader-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    body::before,
    body::after {
        opacity: 0.72;
    }

    .home-page,
    .auth-shell,
    .status-page {
        padding: 14px;
    }

    .video-uploader-card,
    .uploaded-videos-card,
    .form-card,
    .status-card {
        border-radius: 18px;
        padding: 16px;
    }

    .uploaded-video-meta {
        line-height: 1.45;
    }

    .uploaded-video-download,
    .uploaded-video-actions,
    button,
    .button-link {
        width: 100%;
    }

    .uploaded-video-actions {
        flex-direction: column;
    }

    .buttons-row {
        justify-content: stretch;
    }

    .buttons-row > * {
        flex: 1;
    }
}
