/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --primary: #1a56db;
    --primary-dark: #1e3a8a;
    --primary-light: #dbeafe;
    --accent: #0ea5e9;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #0d9488;
    --buying: #6366f1;
    --selling: #e11d48;
    --general: #0891b2;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 1040px; margin: 0 auto; padding: 0 1.5rem; width: 100%; }

/* ===== Header / Hero with Carousel ===== */
header {
    position: relative;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-carousel {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-carousel .hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.hero-carousel .hero-slide.active {
    opacity: 1;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(135deg, rgba(30,58,138,0.85) 0%, rgba(14,165,233,0.75) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #fff;
    padding: 3rem 0 2.5rem;
}

.logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.subtitle {
    opacity: 0.92;
    margin-top: 0.5rem;
    font-size: 1.1rem;
    font-weight: 300;
}

/* Carousel dots */
.carousel-dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 0.4rem;
}

.carousel-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transition: background 0.3s, transform 0.3s;
    cursor: pointer;
}

.carousel-dots .dot.active {
    background: #fff;
    transform: scale(1.3);
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

/* ===== Input Section ===== */
.input-section {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-top: -2rem;
    position: relative;
    z-index: 10;
    box-shadow: var(--shadow-lg);
}

.form-group { flex: 1; min-width: 220px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.9rem; }
.form-group input, .form-group select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

#generate-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 2rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    white-space: nowrap;
    height: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
#generate-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
#generate-btn:active { transform: translateY(0); }
#generate-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ===== Report Catalog Grid ===== */
.catalog h2 { margin-bottom: 1rem; font-size: 1.3rem; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

.report-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: box-shadow 0.25s, transform 0.2s;
    position: relative;
    overflow: hidden;
    background: var(--surface);
}
.report-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.report-card-img {
    height: 120px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.report-card-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.15) 100%);
}

.report-card-body {
    padding: 0.9rem 1rem;
    position: relative;
}

.report-num {
    position: absolute;
    top: -1.4rem;
    right: 0.8rem;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.report-card h3 { font-size: 0.95rem; margin-bottom: 0.4rem; padding-right: 2rem; }
.report-card p { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.4rem; line-height: 1.45; }

.badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    color: #fff;
}
.badge.buying { background: var(--buying); }
.badge.selling { background: var(--selling); }
.badge.general { background: var(--general); }

/* ===== Spinner ===== */
#loading { text-align: center; padding: 2.5rem; }
.spinner {
    width: 40px; height: 40px; margin: 0 auto 1rem;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Results ===== */
#results { box-shadow: var(--shadow-lg); }
.result-header {
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
}
#result-title { font-size: 1.3rem; color: var(--primary-dark); }
#result-meta { font-size: 0.85rem; color: var(--text-muted); }

#result-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
#result-body table caption {
    text-align: left;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.6rem 0;
    color: var(--primary);
}
#result-body th, #result-body td {
    text-align: left;
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--border);
}
#result-body th { font-weight: 600; background: var(--bg); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
#result-body tr:hover td { background: #f0f7ff; }

/* ===== Footer ===== */
footer {
    margin-top: auto;
    padding: 2rem 0;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-logo {
    height: 36px;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.footer-logo:hover { opacity: 1; }

.footer-powered { font-size: 0.75rem; }
footer a { color: var(--primary); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
    header { min-height: 260px; }
    .hero-content { padding: 2rem 0 2rem; }
    header h1 { font-size: 1.5rem; }
    .logo { width: 72px; height: 72px; }
    .input-section { flex-direction: column; margin-top: -1.5rem; }
    .report-grid { grid-template-columns: 1fr; }
    .report-card-img { height: 90px; }
}
