/* === Variables === */
:root {
    --primary: #0f172a;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --radius: 12px;
}

/* === Reset === */
* { margin: 0; padding: 0; box-sizing: border-box; }

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;
}

/* === Layout === */
.container { 
    width: 100%; 
    max-width: 1400px; 
    margin: 0 auto; 
    padding: 0 2rem; 
}

/* === Header === */
.header {
    background: linear-gradient(135deg, var(--primary), #1e293b);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.logo { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.tagline { opacity: 0.85; }

/* === Search === */
main { flex: 1; padding: 2rem 0; }
.search-section { margin-bottom: 2rem; margin-top: 2rem;}

.search-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* === Results === */
.results-section { animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.results-header { margin-bottom: 1rem; }
.result-count { font-size: 0.9rem; color: var(--text-muted); }
.results-list { display: flex; flex-direction: column; gap: 1rem; }

/* === Card === */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.result-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.result-acronym { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.result-acronym h3 { font-size: 1.25rem; font-weight: 700; color: var(--accent); }
.result-acronym .badge { font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 4px; background: var(--bg); color: var(--text-muted); }
.result-acronym .badge-acronym { background: #dbeafe; color: #1d4ed8; }
.result-acronym .badge-concept { background: #dcfce7; color: #15803d; }
.result-meaning { margin-bottom: 0.5rem; }
.result-description { font-size: 0.9rem; color: var(--text-muted); }

/* === Detail Modal === */
.detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.detail-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.detail-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.detail-header h2 { font-size: 1.75rem; color: var(--accent); }
.detail-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.detail-body { padding: 1.5rem; }
.detail-section { margin-bottom: 1.25rem; }
.detail-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.25rem; }

/* === Pagination === */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 2rem; }
.pagination button { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); cursor: pointer; transition: all 0.2s; }
.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination button.active { background: var(--accent); border-color: var(--accent); color: white; }

/* === States === */
.loading { display: flex; justify-content: center; padding: 3rem; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 1.25rem; }
.error-message { background: #fef2f2; color: #ef4444; padding: 1rem; border-radius: 8px; text-align: center; }

/* === Footer === */
.footer { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; border-top: 1px solid var(--border); }

/* === Responsive === */
@media (max-width: 1200px) {
    .container { padding: 0 1.5rem; }
}

@media (max-width: 768px) {
    .container { padding: 0 1rem; }
    .header { padding: 2rem 0; }
    .logo { font-size: 2rem; }
    .search-input { font-size: 1rem; padding: 0.875rem 1rem; }
    .result-card { padding: 1rem; }
    .detail-card { max-width: 95%; margin: 0.5rem; }
}

@media (max-width: 480px) {
    .container { padding: 0 0.75rem; }
    .header { padding: 1.5rem 0; }
    .logo { font-size: 1.75rem; }
    .tagline { font-size: 0.9rem; }
    .search-input { font-size: 0.95rem; padding: 0.75rem; }
    .result-acronym h3 { font-size: 1.1rem; }
    .pagination button { padding: 0.4rem 0.75rem; font-size: 0.9rem; }
}
