/* frontend/styles.css */

body {
    font-family: 'Inter', sans-serif;
    background-color: #fafafa;
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1000px;
    padding: 60px 20px;
    box-sizing: border-box;
}

/* Loading Screen */
#loading-state {
    text-align: center;
    margin-top: 20vh;
    font-size: 1.1rem;
    color: #888;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Dashboard Content (Hidden by Default) */
#dashboard-content { display: none; }

.header { text-align: center; margin-bottom: 50px; }
.header h1 { font-weight: 300; font-size: 2.8rem; margin: 0 0 10px 0; color: #111; letter-spacing: -1px; }

/* Minimalist Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.stat-card {
    background: #fff; border: 1px solid #eaeaea; border-radius: 12px; padding: 30px 20px;
    text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.02); transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }
.stat-num { font-size: 2.8rem; font-weight: 600; color: #2563eb; margin-bottom: 5px; }
.stat-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: #6b7280; }

/* Search Area */
.search-container { width: 100%; max-width: 750px; margin: 0 auto 40px auto; }
.search-input {
    width: 100%; padding: 22px 30px; font-size: 1.2rem; border: 1px solid #d1d5db;
    border-radius: 50px; outline: none; box-shadow: 0 10px 25px rgba(0,0,0,0.04);
    transition: all 0.3s; box-sizing: border-box; font-family: 'Inter', sans-serif;
}
.search-input:focus { border-color: #3b82f6; box-shadow: 0 10px 30px rgba(59, 130, 246, 0.15); }

/* Recent Searches UI */
#recent-searches-container {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: -25px;
    margin-bottom: 30px;
    padding: 0 20px;
    align-items: center;
}
.recent-tag {
    background: #f3f4f6;
    color: #4b5563;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
}
.recent-tag:hover {
    background: #e5e7eb;
    color: #111;
    border-color: #d1d5db;
}

/* Results Table */
#search-results {
    display: none; background: #fff; border: 1px solid #eaeaea;
    border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 18px 20px; border-bottom: 1px solid #f3f4f6; }
th { background: #f9fafb; font-weight: 600; color: #4b5563; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
td { color: #111; font-size: 0.95rem; }
tr:last-child td { border-bottom: none; }
tr:hover { background: #fdfdfd; }

.btn-view {
    background: #f3f4f6; color: #3b82f6; border: 1px solid #e5e7eb; padding: 8px 14px;
    border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: all 0.2s;
}
.btn-view:hover { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* Modal styling */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); justify-content: center;
    align-items: center; z-index: 1000;
}
.modal-content {
    background: #fff; padding: 40px; border-radius: 16px; width: 90%; max-width: 600px;
    max-height: 85vh; overflow-y: auto; position: relative; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}
.close-btn { position: absolute; top: 20px; right: 25px; cursor: pointer; font-size: 1.8rem; color: #9ca3af; line-height: 1; }
.close-btn:hover { color: #111; }
.modal-content h3 { margin-top: 0; font-size: 1.5rem; color: #111; margin-bottom: 5px; }
.molecule-card { background: #f9fafb; border: 1px solid #e5e7eb; padding: 20px; border-radius: 10px; margin-top: 20px; }
.molecule-card h4 { margin: 0 0 10px 0; color: #2563eb; font-size: 1.2rem; }
.molecule-card p { margin: 8px 0; font-size: 0.95rem; line-height: 1.5; color: #374151; }
.molecule-card strong { color: #111; }

/* Contextual Autocomplete Dropdown Styling */
.guess-block {
    padding: 18px 22px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}
.guess-block:hover { background: #f8fafc; }
.guess-block:last-child { border-bottom: none; }

.guess-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.guess-badge {
    background: #eff6ff;
    color: #2563eb;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.guess-match {
    font-weight: 600;
    color: #111;
    font-size: 1.1rem;
}
.guess-resolutions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    font-size: 0.85rem;
    color: #4b5563;
}
.res-item strong {
    color: #6b7280;
    font-weight: 600;
}
.auto-highlight {
    background-color: #fef08a;
    padding: 0 3px;
    border-radius: 3px;
    color: #854d0e;
}

/* Autocomplete Dropdown Base & Positioning */
.search-wrapper { 
    position: relative; 
    width: 100%; 
    max-width: 750px; 
    margin: 0 auto 40px auto; 
}

.search-container { 
    width: 100%; 
}

#autocomplete-dropdown {
    display: none; /* Hidden until the user starts typing */
    position: absolute; 
    top: 100%; 
    left: 0; 
    right: 0; 
    background: #fff;
    border: 1px solid #e5e7eb; 
    border-radius: 12px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    margin-top: 8px; 
    z-index: 100; /* CRITICAL: Forces the dropdown to float on top of the main table */
    max-height: 450px; 
    overflow-y: auto;
}