/* --- Reset & Base --- */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.6;
}

/* --- Header --- */

header {
    background: #1d1d1f;
    color: #f5f5f7;
    text-align: center;
    padding: 2.5rem 1rem 2rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

header p {
    color: #a1a1a6;
    font-size: 0.95rem;
    margin-top: 0.4rem;
}

/* --- Main --- */

main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem 4rem;
}

/* --- Search Form --- */

#query-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

#question {
    flex: 1;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 2px solid #d2d2d7;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

#question:focus {
    border-color: #1f78b4;
}

#submit-btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: #1f78b4;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

#submit-btn:hover  { background: #185f8d; }
#submit-btn:disabled { background: #a1a1a6; cursor: not-allowed; }

/* --- Suggestions --- */

#suggestions {
    font-size: 0.85rem;
    color: #6e6e73;
    margin-bottom: 2rem;
}

.suggestion {
    color: #1f78b4;
    text-decoration: none;
    margin-left: 0.15rem;
}

.suggestion:hover { text-decoration: underline; }

.suggestion + .suggestion::before {
    content: '\00b7';
    margin-right: 0.35rem;
    color: #d2d2d7;
}

/* --- Loading --- */

#loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 3rem 0;
    color: #6e6e73;
    font-size: 0.95rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #d2d2d7;
    border-top-color: #1f78b4;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* --- Results --- */

#results { display: none; }

.panel {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.panel h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #1d1d1f;
}

#answer-text {
    font-size: 0.95rem;
    line-height: 1.75;
    white-space: pre-wrap;
}

/* --- Keywords --- */

#keywords-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.keywords-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.kw-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #86868b;
    min-width: 5rem;
}

.keyword-chip {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
}

.keyword-chip.exact {
    background: #dbeafe;
    color: #1e40af;
}

.keyword-chip.expansion {
    background: #ede9fe;
    color: #6d28d9;
}

/* --- Split Layout --- */

#results-split {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

#results-split .panel {
    margin-bottom: 0;
}

/* --- Graph --- */

#graph-container {
    width: 100%;
    height: 650px;
}

/* --- Wide Screen: side-by-side --- */

@media (min-width: 1100px) {
    #results-split {
        flex-direction: row;
        align-items: flex-start;
    }

    #answer-panel {
        flex: 1;
        min-width: 0;
    }

    #graph-panel {
        flex: 1;
        min-width: 0;
    }
}
