@import url('https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;700&display=swap');

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

body {
    background: #181818;
    color: #e0e0e0;
    font-family: 'Fira Mono', monospace;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background: #222;
    border-bottom: 2px solid #00ff00;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    flex: 0 0 auto;
}

.logo {
    color: #00ff00;
    font-size: 1.5rem;
    text-decoration: none;
    font-weight: bold;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-desc-container {
    flex: 1 1 auto;
    text-align: right;
}

.header-desc {
    color: #b2ffb2;
    font-size: 1rem;
    font-style: italic;
}

.terminal-window {
    background: #1a1a1a;
    border-radius: 8px;
    box-shadow: 0 0 24px #000a;
    margin: 2rem auto;
    padding: 2rem;
    max-width: 700px;
    border: 2px solid #00ff00;
    position: relative;
}

.search-section {
    margin-bottom: 2rem;
}

.search-title {
    color: #00ff00;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #222;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid #00ff00;
    box-shadow: 0 0 8px #00ff0040;
    position: relative;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    max-width: 100%;
}

.terminal-prompt {
    color: #00ff00;
    font-weight: bold;
    font-size: 1.2rem;
}

.subreddit-autocomplete-container {
    position: relative;
    flex: 1 1 220px;
    min-width: 0;
    max-width: 220px;
}

input[type="text"]#subreddit,
input[type="text"]#keyword {
    width: 220px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    background: #181818;
    color: #e0e0e0;
    border: none;
    border-bottom: 2px solid #00ff00;
    font-size: 1rem;
    padding: 0.5rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: #b2ffb2;
}

.suggestions {
    position: absolute;
    background: #222;
    border: 1px solid #00ff00;
    border-radius: 4px;
    z-index: 10;
    max-height: 240px;
    overflow-y: auto;
    width: 100%; /* Always match input width */
    color: #00ff00;
    font-family: inherit;
    font-size: 1rem;
    display: none;
    left: 0;
    top: 100%;
    box-sizing: border-box;
}

.suggestion-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 1.05rem;
}

.suggestion-item:hover, .suggestion-item.active {
    background: #00ff00;
    color: #181818;
}

input[type="text"]#keyword {
    flex: 1 1 220px;
}

select {
    background: #181818;
    color: #00ff00;
    border: 1px solid #00ff00;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    font-family: inherit;
    font-size: 1rem;
    min-width: 90px;
}

button {
    background: #00ff00;
    color: #181818;
    border: none;
    border-radius: 4px;
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 12px;
    min-width: 110px;
}

button:hover {
    background: #b2ffb2;
    color: #222;
}

.blinking-cursor {
    color: #00ff00;
    font-weight: bold;
    animation: blink 1s steps(1) infinite;
    font-size: 1.2rem;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.loading {
    display: none;
    color: #b2ffb2;
    font-size: 1.1rem;
    margin: 2rem 0;
    text-align: center;
}

.results {
    margin-top: 1.5rem;
}

.result-item {
    background: #222;
    border-left: 4px solid #00ff00;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 0 8px #00ff0020;
    transition: background 0.2s;
}

.result-item:hover {
    background: #181818;
}

.result-title {
    color: #00ff00;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-decoration: none;
}

.result-meta {
    color: #b2ffb2;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.result-desc {
    color: #e0e0e0;
    font-size: 1rem;
}

.terminal-footer {
    background: #222;
    border-top: 2px solid #00ff00;
    color: #b2ffb2;
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
    font-size: 1rem;
    letter-spacing: 1px;
}

/* --- Mobile Responsive Styles --- */
@media (max-width: 700px) {
    .terminal-header,
    .terminal-footer {
        width: 100%;
        margin: 0;
        border-radius: 0;
        left: 0;
        right: 0;
        padding-left: 0;
        padding-right: 0;
        box-sizing: border-box;
    }
    .logo-container .logo span {
        font-size: 1.1em;
    }
    .header-desc-container {
        text-align: center;
        margin-top: 5px;
    }
    .header-desc {
        font-size: 0.95em;
        display: block;
        margin-top: 5px;
    }
    .terminal-window {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        padding: 10px 5px;
        box-sizing: border-box;
    }
    .search-section {
        margin-bottom: 1rem;
        padding: 0;
    }
    .search-title {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    .search-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 0.75rem 0.5rem;
    }
    .subreddit-autocomplete-container,
    .suggestions,
    input[type="text"]#subreddit,
    input[type="text"]#keyword,
    select,
    button {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .terminal-prompt,
    .blinking-cursor {
        display: none;
    }
    .results {
        margin-top: 15px;
        font-size: 1em;
    }
    .loading {
        font-size: 1em;
        margin: 10px 0;
    }
    .result-item {
        padding: 0.7rem;
        font-size: 0.95em;
    }
    .result-title {
        font-size: 1em;
    }
    .result-meta {
        font-size: 0.85em;
    }
    .result-desc {
        font-size: 0.95em;
    }
}
