* {
    box-sizing: border-box;
}

:root {
    --red: #ec3013;
    --red-dark: #ae1800;
    --ink: #201e1d;
    --gray: #6b6866;
    --line: #d9d7d6;
    --bg: #f3f2f2;
    --panel: #ffffff;
    --font: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
}

h1, h2, h3, .brand, .login-logo, .movie-card-body .title {
    font-weight: 800;
    letter-spacing: -0.02em;
}

a {
    color: var(--red);
}

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

.btn {
    display: inline-block;
    border: 1px solid var(--ink);
    background: var(--panel);
    color: var(--ink);
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    opacity: 0.85;
}

.btn-primary {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.btn-outline {
    background: transparent;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-screen {
    display: flex;
    min-height: 100vh;
}

.login-brand {
    flex: 1.15;
    min-width: 0;
    background: var(--red);
    color: #fff;
    padding: 44px 44px 36px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: -0.01em;
    font-size: 20px;
}

.login-logo .swatch {
    width: 24px;
    height: 24px;
    background: #fff;
}

.login-brand h1 {
    font-size: clamp(36px, 6vw, 84px);
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin: 0 0 18px;
    overflow-wrap: break-word;
}

.login-brand p {
    font-size: 18px;
    max-width: 34ch;
    opacity: 0.9;
}

.login-brand-stats {
    display: flex;
    gap: 36px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.85;
}

.login-form-side {
    flex: 1;
    min-width: 0;
    background: var(--bg);
    padding: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.login-form-wrap {
    width: 100%;
    max-width: 460px;
}

.eyebrow {
    color: var(--red);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.login-form-wrap h2 {
    font-size: clamp(30px, 4vw, 46px);
    margin: 10px 0;
}

.login-form-wrap > p {
    color: var(--gray);
    font-size: 16px;
    margin: 0 0 28px;
}

.lang-switch {
    display: inline-flex;
    border: 1px solid var(--ink);
}

.lang-switch a {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    color: var(--ink);
}

.lang-switch a.active {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

.login-actions {
    position: absolute;
    top: 24px;
    right: 24px;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"] {
    width: 100%;
    padding: 15px 16px;
    border: 1px solid var(--line);
    background: #e9e9e9;
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--ink);
    background: #fff;
}

.form-error input {
    border-color: var(--red);
    background: #fff;
}

.field-error {
    color: var(--red-dark);
    font-size: 12px;
    margin-top: 4px;
}

.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--red);
    border-left: 4px solid var(--red);
    background: #fdeceb;
    color: var(--red-dark);
    font-size: 13px;
    margin-bottom: 20px;
}

.alert svg {
    flex: none;
    margin-top: 2px;
}

.alert strong {
    display: block;
    margin-bottom: 2px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    font-size: 13px;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 6px;
}

hr.rule {
    border: none;
    border-top: 1px solid var(--line);
    margin: 24px 0;
}

.demo-credentials {
    font-size: 12px;
    color: var(--gray);
    margin: 0;
}

.demo-credentials strong {
    color: var(--ink);
}

.demo-credentials-anchored {
    position: absolute;
    left: 44px;
    bottom: 44px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.site-header {
    background: var(--panel);
    border-bottom: 2px solid var(--ink);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-decoration: none;
    color: var(--ink);
}

.brand .swatch {
    width: 18px;
    height: 18px;
    background: var(--red);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.main-nav a {
    text-decoration: none;
    color: var(--red);
    font-weight: 600;
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-right form {
    margin: 0;
}

.page-heading {
    padding: 32px 0 20px;
}

.page-heading h1 {
    font-size: 44px;
    margin: 4px 0 6px;
}

.page-heading .meta {
    color: var(--gray);
    font-size: 13px;
}

.filters-bar {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--ink);
    margin-bottom: 24px;
}

.filters-bar .form-group {
    margin-bottom: 0;
    flex: 1 1 160px;
}

.type-toggle {
    display: inline-flex;
    border: 1px solid var(--ink);
}

.type-toggle button {
    background: #fff;
    border: none;
    border-right: 1px solid var(--ink);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.type-toggle button:last-child {
    border-right: none;
}

.type-toggle button.active {
    background: var(--red);
    color: #fff;
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 28px;
    padding-bottom: 40px;
}

.movie-card {
    background: var(--panel);
    border: 1px solid var(--line);
    position: relative;
    text-decoration: none;
    color: var(--ink);
    display: block;
}

.movie-poster-box {
    position: relative;
    aspect-ratio: 2 / 3;
    background: #e2e2e2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.poster-placeholder-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #9a9a9a;
    text-transform: uppercase;
}

.favorite-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 1px solid var(--ink);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    z-index: 2;
}

.favorite-toggle.is-favorited {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.favorite-toggle-text {
    position: static;
    width: auto;
    height: auto;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
}

.movie-card-body {
    padding: 14px 16px 18px;
}

.movie-card-body .title {
    font-weight: 700;
    font-size: 16px;
    margin: 0 0 4px;
}

.movie-card-body .sub {
    font-size: 13px;
    color: var(--gray);
}

.fav-list {
    border-top: 2px solid var(--ink);
}

.fav-row {
    display: grid;
    grid-template-columns: 96px 1fr auto;
    gap: 28px;
    align-items: center;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
    transition: background-color 0.3s ease;
}

.fav-row.is-confirming {
    background: #fdeceb;
}

.fav-poster {
    aspect-ratio: 2 / 3;
    background: #e2e2e2;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

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

.fav-poster-placeholder {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #9a9a9a;
    text-align: center;
    padding: 0 6px 8px;
}

.fav-info .title {
    font-weight: 800;
    font-size: 22px;
    margin: 0 0 4px;
}

.fav-info .meta {
    color: var(--gray);
    font-size: 14px;
    margin: 0;
}

.fav-action-slot {
    position: relative;
    display: grid;
    justify-items: end;
}

.fav-actions,
.fav-confirm {
    grid-area: 1 / 1;
}

.fav-actions {
    display: flex;
    gap: 10px;
    clip-path: inset(0 0 0 0);
    opacity: 1;
    transition: clip-path 0.3s ease, opacity 0.2s ease;
}

.fav-row.is-confirming .fav-actions {
    clip-path: inset(0 0 0 100%);
    opacity: 0;
    pointer-events: none;
}

.fav-actions .btn-danger-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--red-dark);
    border-color: var(--red);
}

.fav-confirm {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--red-dark);
    white-space: nowrap;
    clip-path: inset(0 100% 0 0);
    opacity: 0;
    pointer-events: none;
    transition: clip-path 0.3s ease 0.1s, opacity 0.2s ease 0.1s;
}

.fav-row.is-confirming .fav-confirm {
    clip-path: inset(0 0 0 0);
    opacity: 1;
    pointer-events: auto;
}

.state-box {
    border: 1px solid var(--line);
    background: var(--panel);
    padding: 28px;
    text-align: center;
    margin: 24px 0;
}

.state-box h3 {
    margin: 0 0 8px;
}

.state-box p {
    color: var(--gray);
    margin: 0 0 16px;
}

.state-box.state-error {
    border-color: var(--red);
    background: #fdeceb;
}

.state-icon {
    width: 64px;
    height: 64px;
    border: 2px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--red);
}

.loading-row {
    text-align: center;
    padding: 24px 0;
    color: var(--gray);
    font-size: 13px;
    font-weight: 600;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--line);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: -2px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.detail-back {
    display: inline-block;
    margin: 20px 0;
    font-weight: 600;
    text-decoration: none;
}

.detail-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 56px;
    padding-bottom: 56px;
}

.detail-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-poster {
    aspect-ratio: 2 / 3;
    background: #e2e2e2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-side .favorite-toggle-text {
    width: 100%;
    justify-content: center;
    padding: 14px 18px;
    font-size: 15px;
}

.ratings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    border-top: 2px solid var(--ink);
    padding-top: 16px;
}

.ratings-list .row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.ratings-list dt {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--gray);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ratings-list dd {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    white-space: nowrap;
}

.ratings-list .row-boxoffice {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.ratings-list .row-boxoffice dd {
    font-size: 17px;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.badge {
    border: 1px solid var(--ink);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.badge-red {
    border-color: var(--red);
    color: var(--red);
}

.detail-title h1 {
    font-size: clamp(34px, 4vw, 52px);
    margin: 6px 0 8px;
}

.detail-subtitle {
    color: var(--gray);
    font-size: 16px;
    margin-bottom: 24px;
}

.plot-block {
    border-top: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    padding: 20px 0;
    margin-bottom: 28px;
}

.plot-block h6 {
    margin: 0 0 10px;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--gray);
}

.plot {
    line-height: 1.65;
    font-size: 17px;
    max-width: 72ch;
    margin: 0;
}

.detail-tables {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 48px;
}

.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-grid dt {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--gray);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.detail-grid dd {
    margin: 3px 0 0;
    font-size: 15px;
}

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--ink);
    color: #fff;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.toast.toast-error {
    background: var(--red-dark);
}

@media (max-width: 720px) {
    .login-screen {
        flex-direction: column;
    }

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

    .site-header .container {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 24px;
        gap: 10px;
    }
}
