/* Vademécum - Estilos dinámicos */
:root {
    --bg: #0c1117;
    --bg-card: #161b22;
    --bg-elevated: #21262d;
    --bg-input: #21262d;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --accent-soft: rgba(88, 166, 255, 0.15);
    --success: #3fb950;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.container {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 1.25rem;
    width: 100%;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow var(--transition), background var(--transition);
}
.header.header-scrolled {
    box-shadow: var(--shadow);
}
.header .container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.header-text {
    flex: 1;
    min-width: 200px;
}
.site-description {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 52rem;
}
.logo {
    display: block;
    text-decoration: none;
    line-height: 0;
}
.logo-img {
    display: block;
    height: 40px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}
.logo:hover .logo-img {
    opacity: 0.9;
}
.tagline {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Main */
.main {
    flex: 1;
    padding: 0;
}

/* Hero (página home) */
.page-home {
    padding-bottom: 2rem;
}
.hero {
    position: relative;
    padding: 3rem 0 3.5rem;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(155deg, rgba(88, 166, 255, 0.06) 0%, transparent 45%, rgba(63, 185, 80, 0.04) 100%);
    pointer-events: none;
}
.hero-content {
    position: relative;
}
.hero-title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    font-weight: 700;
    line-height: 1.25;
    animation: fadeUp 0.5s ease;
}
.hero-subtitle {
    margin: 0 0 2rem;
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 36rem;
    animation: fadeUp 0.5s ease 0.1s both;
}
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search card */
.search-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    animation: fadeUp 0.5s ease 0.2s both;
}
.search-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.pill {
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.pill:hover {
    background: var(--bg-elevated);
    color: var(--text);
    border-color: var(--accent);
}
.pill.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}
.search-input-wrap {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}
.search-input-wrap input {
    flex: 1;
    min-width: 220px;
}
.search-hint {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.search-form {
    position: relative;
}

/* Form base */
.form-row {
    margin-bottom: 1rem;
}
.form-row label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.form-row-input {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}
.form-row-input input {
    flex: 1;
    min-width: 200px;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}
input[type="text"],
select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn {
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background var(--transition), transform 0.15s ease;
}
.btn:active {
    transform: scale(0.98);
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
}
.btn-search {
    white-space: nowrap;
}

/* Autocomplete */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.15s ease;
}
.autocomplete-list:empty {
    display: none;
}
.autocomplete-item {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition);
}
.autocomplete-item:hover,
.autocomplete-item[aria-selected="true"] {
    background: var(--bg-input);
}
.autocomplete-item small {
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* Features (home) */
.features {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
}
.features-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}
.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.feature-icon {
    font-size: 1.5rem;
    line-height: 1;
}

/* Results */
.results-section .container {
    padding-top: 2rem;
    padding-bottom: 2rem;
}
.results-header {
    margin-bottom: 1.5rem;
    animation: fadeUp 0.4s ease;
}
.back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 0.75rem;
    transition: color var(--transition);
}
.back-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}
.results-header h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
}
.results-meta {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.95rem;
}
.no-results {
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
}
.product-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    margin-bottom: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    animation: fadeUp 0.4s ease backwards;
}
.product-list .product-card:nth-child(1) { animation-delay: 0.05s; }
.product-list .product-card:nth-child(2) { animation-delay: 0.1s; }
.product-list .product-card:nth-child(3) { animation-delay: 0.15s; }
.product-list .product-card:nth-child(4) { animation-delay: 0.2s; }
.product-list .product-card:nth-child(5) { animation-delay: 0.25s; }
.product-list .product-card:nth-child(n+6) { animation-delay: 0.3s; }
.product-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.product-name {
    margin: 0 0 0.35rem;
    font-size: 1.2rem;
    font-weight: 600;
}
.product-presen {
    margin: 0 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.product-price {
    margin: 0 0 1rem;
    font-size: 1.05rem;
}
.product-price strong {
    color: var(--success);
}
.product-details {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.detail-block {
    font-size: 0.9rem;
}
.detail-label {
    color: var(--text-muted);
    margin-right: 0.35rem;
}
.detail-list {
    margin: 0.25rem 0 0;
    padding-left: 1.2rem;
    list-style: disc;
}
.detail-list li {
    margin-bottom: 0.2rem;
}
.detail-block-componentes {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.detail-list-inline {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    padding-left: 0;
    list-style: none;
    margin: 0.25rem 0 0;
}
.detail-list-inline li {
    margin-bottom: 0;
}
.detail-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    text-decoration: underline;
    font-family: inherit;
    transition: color var(--transition);
}
.btn-link:hover {
    color: var(--accent-hover);
}
.product-comentario {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

/* Search section (páginas que no son home) */
.search-section h1 {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 600;
}
.intro {
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.2s, opacity 0.2s;
}
.modal.is-open {
    visibility: visible;
    opacity: 1;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    cursor: pointer;
    transition: opacity 0.2s;
}
.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96);
    transition: transform 0.2s ease;
}
.modal.is-open .modal-content {
    transform: scale(1);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-title {
    margin: 0;
    font-size: 1.15rem;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
    transition: color var(--transition);
}
.modal-close:hover {
    color: var(--text);
}
.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}
.modal-body .loading {
    color: var(--text-muted);
}
.modal-body .principio-section {
    margin-bottom: 1rem;
}
.modal-body .principio-section h3 {
    margin: 0 0 0.4rem;
    font-size: 0.9rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.modal-body .principio-section p,
.modal-body .principio-section div {
    margin: 0;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}
