/* ---------- Base ---------- */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f4f6f8;
    color: #1e2a38;
    line-height: 1.5;
}

a {
    color: #0d9488;
}

/* ---------- Navigation bar ---------- */
nav {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    padding: 18px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

nav .brand {
    color: #ffffff;
    font-size: 21px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.3px;
}

nav .nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    margin-left: 22px;
    font-size: 15px;
    transition: color 0.15s ease;
}

nav .nav-links a:hover {
    color: #ffffff;
}

/* ---------- Main content ---------- */
main {
    max-width: 860px;
    margin: 40px auto;
    padding: 0 20px 60px;
}

h1 {
    margin-bottom: 24px;
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

/* ---------- Flash messages ---------- */
.flash-messages {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.flash-messages li {
    background-color: #fef2f2;
    border-left: 4px solid #dc2626;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 14px;
}

/* ---------- Forms ---------- */
form {
    background: #ffffff;
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    max-width: 420px;
}

label {
    margin-top: 14px;
    font-weight: 600;
    font-size: 14px;
    color: #334155;
}

input, select {
    padding: 10px 12px;
    margin-top: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    background-color: #f8fafc;
    transition: border-color 0.15s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: #0d9488;
    background-color: #ffffff;
}

button {
    margin-top: 24px;
    padding: 12px;
    background-color: #0d9488;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

button:hover {
    background-color: #0f766e;
}

button:active {
    transform: scale(0.98);
}

/* ---------- Search status ---------- */
#search-status {
    margin-top: 18px;
    font-style: italic;
    color: #475569;
}

/* ---------- Filter/sort controls ---------- */
#results-controls {
    margin-top: 24px;
    background: #ffffff;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

#results-controls label {
    margin-top: 0;
    font-size: 13px;
    color: #64748b;
}

#results-controls select {
    margin-top: 4px;
}

/* ---------- Result cards ---------- */
.result-card {
    background: #ffffff;
    padding: 20px 24px;
    margin-top: 16px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.result-card h3 {
    margin: 0 0 6px 0;
    font-size: 18px;
}

.result-card h3 a {
    color: #0f172a;
    text-decoration: none;
}

.result-card h3 a:hover {
    color: #0d9488;
    text-decoration: underline;
}

.result-card .source {
    display: inline-block;
    color: #0d9488;
    background-color: #ecfdf5;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    margin: 0 0 12px 0;
}

.result-card p:not(.source) {
    white-space: pre-line;
    color: #475569;
    font-size: 14px;
    margin: 0 0 12px 0;
}

.result-card .save-btn {
    margin-top: 0;
    background-color: #0f172a;
    padding: 8px 16px;
    font-size: 14px;
}

.result-card .save-btn:hover {
    background-color: #1e293b;
}

/* ---------- History table ---------- */
.history-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.history-table th, .history-table td {
    text-align: left;
    padding: 12px 18px;
    border-bottom: 1px solid #eef2f6;
    font-size: 14px;
}

.history-table th {
    background-color: #0f172a;
    color: #ffffff;
    font-weight: 600;
}

.history-table tr:last-child td {
    border-bottom: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    nav {
        padding: 16px 20px;
    }

    nav .nav-links a {
        margin-left: 12px;
        font-size: 13px;
    }

    main {
        margin: 24px auto;
        padding: 0 14px 40px;
    }

    form {
        max-width: 100%;
    }
}

/* ---------- Hero banner ---------- */
.hero {
    background:
        radial-gradient(circle at 20% 30%, rgba(13, 148, 136, 0.55), transparent 55%),
        radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.45), transparent 50%),
        linear-gradient(135deg, #0f172a, #1e293b 60%, #0d9488);
    color: #ffffff;
    padding: 48px 36px;
    border-radius: 16px;
    margin-bottom: 28px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.hero h1 {
    color: #ffffff;
    font-size: 32px;
    margin-bottom: 10px;
}

.hero p {
    color: #e2e8f0;
    font-size: 15px;
    max-width: 480px;
    margin: 0;
}

@media (max-width: 600px) {
    .hero {
        padding: 32px 22px;
    }

    .hero h1 {
        font-size: 24px;
    }
}
