* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #e2e8f0;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 32px 20px 40px;
}

.card {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 18px;
    backdrop-filter: blur(4px);
}

h1, h2 {
    margin: 0 0 10px;
}

.subtitle {
    margin: 0 0 18px;
    color: #94a3b8;
}

.form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

label {
    font-size: 0.9rem;
    color: #cbd5e1;
}

input,
select,
button {
    border-radius: 10px;
    border: 1px solid #334155;
    padding: 11px 12px;
    font-size: 0.95rem;
}

input,
select {
    background: #0b1220;
    color: #e2e8f0;
}

button {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

button:hover {
    filter: brightness(1.1);
}

button:active {
    transform: translateY(1px);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.18);
}

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

.button-row button {
    flex: 1;
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 0.95rem;
    margin-top: 0;
}

.btn-reset {
    background: linear-gradient(135deg, #64748b, #475569);
}

#generate-btn.loading,
#generate-btn:disabled {
    background: #475569;
    cursor: not-allowed;
    opacity: 0.7;
    filter: none;
}

.error-card {
    border-color: rgba(248, 113, 113, 0.65);
}

.report-header p {
    margin: 2px 0;
    color: #cbd5e1;
}

.report-body {
    margin-top: 16px;
    border-radius: 10px;
    background: #020617;
    border: 1px solid #334155;
    padding: 14px;
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 0.9rem;
    overflow-x: auto;
}

/* ---------- Loading card with spinner ---------- */
.loading-card {
    display: flex;
    align-items: center;
    gap: 14px;
    border-color: rgba(59, 130, 246, 0.5);
}

.loading-card[hidden] {
    display: none;
}

.loading-spinner {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: 3px solid #334155;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loading-text {
    margin: 0;
    color: #94a3b8;
    font-size: 0.95rem;
}

/* ---------- Report card extra polish ---------- */
.report-card[hidden] {
    display: none;
}

.error-card[hidden] {
    display: none;
}

.report-subtitle {
    margin: 2px 0;
    color: #94a3b8;
    font-size: 0.85rem;
    white-space: pre-wrap;
    line-height: 1.4;
}

.stock-report-options {
    margin-top: 4px;
    margin-bottom: 4px;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
}

.trend-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.trend-actions button {
    margin-top: 0;
}

.inline-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.inline-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin: 12px 0;
}

.candidate-market-block {
    background: #020617;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.88rem;
}

.candidate-market-block h3 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    color: #93c5fd;
}

.candidate-market-block ul {
    margin: 0;
    padding-left: 18px;
    color: #cbd5e1;
}

.trend-table-wrap {
    margin-top: 14px;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #020617;
}

.trend-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.trend-table-wrap th,
.trend-table-wrap td {
    border-bottom: 1px solid #1e293b;
    padding: 8px 10px;
    text-align: left;
}

.trend-table-wrap th {
    color: #94a3b8;
    font-weight: 600;
}

.trend-table-wrap td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.trend-note {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #94a3b8;
}

.trend-deepseek {
    margin-top: 16px;
    padding: 14px;
    border-radius: 10px;
    background: #020617;
    border: 1px solid #334155;
    white-space: pre-wrap;
    font-size: 0.85rem;
    line-height: 1.45;
    max-height: 420px;
    overflow-y: auto;
}

.trend-inline-error {
    margin-top: 8px;
    color: #fca5a5;
    font-size: 0.9rem;
}
