/* ====================== ROOT SETTINGS ====================== */

:root {
    --bg: #0f172a;
    --bg-alt: #020617;
    --card-bg: #020617;
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.15);
    --border: #1e293b;
    --text: #e5e7eb;
    --muted: #64748b;
    --danger: #f97373;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1f2933 0, #020617 50%, #000 100%);
    color: var(--text);
    min-height: 100vh;
}

/* ====================== PAGE LAYOUT ====================== */

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 16px 48px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: conic-gradient(from 180deg, #38bdf8, #a855f7, #ec4899, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.5);
}

.logo-mark span {
    font-weight: 700;
    font-size: 18px;
    color: #0f172a;
}

.logo-text-main {
    font-weight: 600;
    font-size: 18px;
    letter-spacing: 0.05em;
}

.logo-text-sub {
    font-size: 12px;
    color: var(--muted);
}

/* ====================== CARDS ====================== */

.card {
    background: rgba(15, 23, 42, 0.9);
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow:
        0 20px 40px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(148, 163, 184, 0.1);
    padding: 20px 20px 24px;
    backdrop-filter: blur(24px);
}

.card-header {
    margin-bottom: 12px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

.card-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.field-label {
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--muted);
}

/* ====================== TEXTAREA ====================== */

textarea {
    width: 100%;
    min-height: 56px;
    resize: none;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.4;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6);
}

/* ====================== BUTTONS ====================== */

.row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition:
        transform 0.05s ease-out,
        background 0.15s ease-out,
        color 0.15s ease-out,
        border-color 0.15s ease-out;
    white-space: nowrap;
}

.btn:active {
    transform: translateY(1px);
}

/* Primary button */
.btn-primary {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    color: #0b1120;
    border: 1px solid #0ea5e9;
    box-shadow: none; /* no glow */
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0ea5e9, #38bdf8); /* subtle gradient swap */
    border-color: #38bdf8;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Ghost button */
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-ghost:hover {
    background: rgba(15, 23, 42, 0.85); /* slightly brighter */
    border-color: rgba(148, 163, 184, 0.7);
    color: #e5e7eb;
}

/* ====================== STATUS TEXT ====================== */

.status {
    margin-top: 8px;
    font-size: 13px;
}

.status-error {
    color: var(--danger);
}

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

/* ====================== FILE LIST TABLE ====================== */

.files-card {
    margin-top: 20px;
    padding: 16px 16px 14px;
}

.files-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
}

.files-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: rgba(15, 23, 42, 0.9);
}

th,
td {
    padding: 8px 6px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.7);
}

th {
    text-align: left;
    font-weight: 500;
    color: var(--muted);
    font-size: 12px;
}

tbody tr:hover {
    background: rgba(15, 23, 42, 0.85);
}

.col-check {
    width: 32px;
}

.col-size {
    width: 120px;
    text-align: right;
}

.file-name {
    word-break: break-all;
}

.file-size {
    font-variant-numeric: tabular-nums;
}

/* ====================== FUTURISTIC LOADING ====================== */

#loading-box {
    margin-top: 10px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 10px;
    backdrop-filter: blur(8px);
    display: none;
}

#loading-status {
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 8px;
}

#loading-progress {
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #38bdf8, #0ea5e9);
    box-shadow: 0 0 8px #38bdf8;
    border-radius: 5px;
    transition: width 0.25s ease-out;
}

.loading-spinner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid rgba(56, 189, 248, 0.15);
    border-top-color: #38bdf8;
    animation: spin 0.9s linear infinite;
    margin-bottom: 10px;
}

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

/* ========================= NUMBER INPUT ========================= */
/* Custom number input (neon arrows) */

.number-wrapper {
    position: relative;
    width: 100%;
}

.number-wrapper input[type="number"] {
    width: 100%;
    padding-right: 36px !important; /* reserve space for custom arrows */
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    color: var(--text);
    height: 40px;
    text-align: center; /* center the number */
}

/* Hide native spinners */
input[type="number"] {
    appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    display: none;
}

/* Arrow container */
.number-arrows {
    position: absolute;
    right: 6px; /* slightly closer to the input text */
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

/* Arrow buttons */
.number-arrow {
    width: 16px;
    height: 12px;
    color: #38bdf8;
    opacity: 0.8;
    cursor: pointer;
    font-size: 12px;
    line-height: 12px;
    text-align: center;
    user-select: none;
    transition: 0.15s;
}

.number-arrow:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* ====================== DOWNLOAD SETTINGS ROW ====================== */

.download-settings {
    display: flex;
    align-items: flex-end;
    justify-content: center; /* center the whole block */
    gap: 14px;
    margin-top: 14px;
    flex-wrap: wrap;
    width: 100%;
    text-align: center;
}

.download-settings .setting {
    flex: 0 0 auto;
    min-width: 90px; /* was 150 */
}

/* Input width in settings block */
.download-settings .setting .number-wrapper input[type="number"] {
    max-width: 90px; /* was 160 */
}

/* Stop button container */
.download-settings .stop-setting {
    display: flex;
    align-items: flex-end;
}

/* ====================== STOP BUTTON STYLE ====================== */

#btn-stop-download {
    height: 40px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid rgba(248, 113, 113, 0.35);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition:
        background 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        transform 0.05s ease;
}

#btn-stop-download:hover {
    background: rgba(248, 113, 113, 0.16);
    border-color: rgba(248, 113, 113, 0.9);
    color: #fecaca;
    box-shadow: 0 0 22px rgba(248, 113, 113, 0.55);
    transform: translateY(0.5px);
}

/* ====================== RESPONSIVE ====================== */

@media (max-width: 640px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ====================== END OF STYLESHEET ====================== */
