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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0d0f14;
    --surface: #141922;
    --surface-2: #191f2a;
    --line: #2a3240;
    --text: #e7ecf3;
    --muted: #95a1b3;
    --accent: #5ba3ff;
    --accent-2: #3e82d7;
    --danger-bg: #2a1b1f;
    --danger-line: #7f3e4a;
    --danger-text: #f2c8cf;
    --success: #6dd8a8;
    --radius: 12px;
}

body {
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    padding: 1.5rem 1rem;
}

.page,
.page-wrapper,
.success-wrap {
    width: min(980px, 100%);
    margin: 0 auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.brand {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.hero,
.header {
    margin-bottom: 1rem;
}

.hero-main,
.panel,
.card,
.success-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.hero-main,
.panel,
.card,
.success-card {
    padding: 1.2rem;
}

.eyebrow {
    display: inline-block;
    font-size: 0.76rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.65rem;
}

h1,
.title,
.success-title {
    font-size: clamp(1.45rem, 2.4vw, 2rem);
    line-height: 1.2;
    margin-bottom: 0.45rem;
}

.lead,
.subtitle,
.card-text,
.note,
.success-footer {
    color: var(--muted);
}

.card-title {
    font-size: 1.12rem;
    margin-bottom: 0.35rem;
}

.error-box,
.alert-card {
    background: var(--danger-bg);
    border-color: var(--danger-line);
    color: var(--danger-text);
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.upload-block {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.upload-title {
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.upload-area {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 118px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
}

.upload-area:hover {
    border-color: #415069;
}

.upload-area.drag-over {
    border-color: var(--accent);
    background: #1a2535;
}

.upload-icon {
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: grid;
    place-items: center;
    margin: 0 auto 0.5rem;
    color: var(--muted);
}

.upload-icon::before {
    content: '+';
    font-size: 1.1rem;
    line-height: 1;
}

.upload-text {
    text-align: center;
    padding: 0 0.6rem;
}

.upload-text strong {
    display: block;
    font-size: 0.86rem;
    margin-bottom: 0.15rem;
}

.upload-text small {
    font-size: 0.76rem;
    color: var(--muted);
}

input[type='file'] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.note {
    font-size: 0.82rem;
}

button,
.btn,
.link-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 9px;
    border: 1px solid transparent;
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    font-size: 0.86rem;
    font-weight: 600;
    padding: 0.66rem 1rem;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

button[type='submit'],
.btn.primary {
    background: var(--accent);
    color: #04101f;
}

button[type='submit']:hover:not(:disabled),
.btn.primary:hover {
    background: var(--accent-2);
    color: #eaf3ff;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.secondary,
.link-back {
    background: transparent;
    border-color: var(--line);
    color: var(--text);
}

.btn.secondary:hover,
.link-back:hover {
    border-color: #4b5970;
}

.buttons-row,
.footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.footer {
    margin-top: 1rem;
}

.checkbox-row {
    margin-bottom: 0.55rem;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
}

input[type='checkbox'] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.classi-box {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 0.45rem;
    padding: 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    max-height: 280px;
    overflow-y: auto;
}

.classi-box .checkbox-label {
    width: 100%;
    padding: 0.35rem 0.4rem;
    border-radius: 8px;
    border: 1px solid transparent;
}

.classi-box .checkbox-label:hover {
    border-color: #3b465a;
}

.classi-box.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.loading {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(8, 10, 14, 0.62);
    z-index: 999;
}

.loading.active {
    display: grid;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid #ffffff2e;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 900ms linear infinite;
}

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

.success-badge {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    color: var(--success);
    margin-bottom: 0.7rem;
}

.success-footer {
    margin-top: 0.9rem;
    font-size: 0.82rem;
}

.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

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

    .buttons-row,
    .footer {
        flex-direction: column;
    }

    button,
    .btn,
    .link-back {
        width: 100%;
    }
}
