/* --- IMPORTACIÓN DE LA FUENTE INTER --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

body { 
    background: #ffffff; 
    font-family: 'Inter', sans-serif; /* Cambiado a Inter */
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; margin: 0;
    position: relative;
    padding: 40px 0 120px 0;
    box-sizing: border-box;
}

#lang-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    border: 1px solid #a2a9b1;
    border-radius: 2px;
    background: #f8f9fa;
    padding: 4px 8px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    color: #202122;
    font-family: inherit; /* Hereda Inter */
}

/* --- CONTENEDOR PARA EL EFECTO FANTASMA --- */
.search-wrapper {
    position: relative;
    width: 80%;
    max-width: 500px;
}

#input, .input-overlay { 
    width: 100%; border: none; border-bottom: 2px solid #202122;
    padding: 10px 0; font-size: 24px; outline: none; text-align: center;
    background: transparent;
    font-family: inherit; /* Hereda Inter */
    box-sizing: border-box;
}

#input {
    position: relative;
    z-index: 2;
}

.input-overlay {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    border-bottom-color: transparent; 
    pointer-events: none; 
    white-space: pre;
    overflow: hidden;
    text-overflow: clip;
}

.overlay-hidden {
    color: transparent;
}

.overlay-visible {
    color: #72777d;
    margin-left: 5px;
    display: inline-block;
}

/* --- SELECTOR DE MODOS --- */
.mode-selector {
    display: flex;
    gap: 16px;
    margin-top: 15px;
    font-size: 13px;
}

.mode-btn {
    background: transparent;
    border: none;
    color: #72777d;
    cursor: pointer;
    padding: 4px 8px;
    font-family: inherit; /* Hereda Inter */
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.mode-btn.active {
    color: #202122;
    border-bottom-color: #202122;
    font-weight: bold;
}

#res { 
    margin-top: 35px; width: 85%; max-width: 620px; font-size: 15px; 
    line-height: 1.6; color: #202122; text-align: left; 
}

.wiki-box {
    background: transparent;
    border: none;
    border-bottom: 1px dotted #a2a9b1;
    padding: 0;
    padding-bottom: 20px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-title {
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 4px;
}
.result-title:hover { text-decoration: underline; }

.wiki-box .result-title { color: #8d6e63; }
.wiki-box .result-title:visited { color: #6d4c41; }

#res > div:first-of-type .wiki-box:first-of-type .result-title { color: #2e7d32; }
#res > div:first-of-type .wiki-box:first-of-type .result-title:visited { color: #1b5e20; }

#wiki-section .wiki-box:last-of-type .result-title { color: #c5a059; }
#wiki-section .wiki-box:last-of-type .result-title:visited { color: #b0893e; }

.btn-img, .btn-nav {
    background: #f8f9fa; border: 1px solid #a2a9b1; cursor: pointer; font-size: 13px;
    padding: 2px 6px; color: #202122; border-radius: 2px;
    vertical-align: middle; text-decoration: none; display: inline-block;
    font-family: inherit; /* Asegura Inter en botones */
}
.btn-img { margin-left: 8px; }
.btn-img:hover, .btn-nav:hover { background: #ffffff; color: #000; border-color: #72777d; }
.btn-nav:disabled { color: #a2a9b1; border-color: #eaecf0; cursor: not-allowed; background: #f8f9fa; }

.stars-container {
    margin-top: 10px; font-size: 13px; color: #72777d; display: flex; align-items: center; gap: 4px;
}
.stars-gold { color: #ffbc00; letter-spacing: 2px; }

.pagination-container {
    display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 15px; font-size: 13px; color: #72777d; padding-bottom: 20px;
}

.web-block {
    margin-top: 10px; font-size: 13px; border-top: 1px solid #eaecf0; padding-top: 8px; display: flex; flex-direction: column; gap: 6px; 
}
.web-block a { color: #006621; text-decoration: none; }
.web-block a:hover { text-decoration: underline; }

.img-container { margin-top: 12px; text-align: center; }

/* Cuadrícula de transparencia para previsualizaciones */
.img-preview { 
    max-width: 240px; max-height: 180px; border: 1px solid #a2a9b1; padding: 3px; 
    background-color: #eee;
    background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), 
                      linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
    cursor: zoom-in;
}
.direct-img { max-width: 100%; max-height: 250px; margin-top: 15px; }

/* --- GALERÍA DE IMÁGENES MODO GRID --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
    animation: fadeIn 0.3s ease-in-out;
}
.gallery-item {
    background: #f8f9fa;
    border: 1px solid #eaecf0;
    padding: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 140px;
    cursor: zoom-in;
}
.gallery-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* --- LIGHTBOX MODAL --- */
.lightbox {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: 'Inter', sans-serif; /* Cambiado a Inter */
}

.lightbox-content {
    max-width: 80%;
    max-height: 75vh;
    object-fit: contain;
    border: 3px solid #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    background-color: #e5e5e5;
    background-image: linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff), 
                      linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}
.lightbox-caption {
    margin-top: 15px;
    font-size: 14px;
    text-align: center;
    max-width: 70%;
    line-height: 1.4;
    word-break: break-word;
}
.lightbox-credit {
    font-size: 12px;
    color: #ccc;
    margin-top: 5px;
}
.lightbox-close {
    position: absolute;
    top: 20px; right: 20px;
    background: transparent; border: none;
    color: #fff; font-size: 35px; cursor: pointer;
    z-index: 1010;
}

/* FLECHAS DE NAVEGACIÓN DEL LIGHTBOX */
.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 28px;
    padding: 12px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
    border-radius: 4px;
    z-index: 1010;
}
.lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.9);
    color: black;
}
.lightbox-arrow.left { left: 30px; }
.lightbox-arrow.right { right: 30px; }

footer {
    position: absolute; bottom: 20px; left: 0; width: 100%; text-align: center; font-size: 11px; color: #72777d; letter-spacing: 0.2px; line-height: 1.6; padding: 0 10px; box-sizing: border-box; border-top: 1px solid #eaecf0; padding-top: 15px;
}
/* Mantiene intacto el estilo tipográfico de Palmera Search */
footer strong { font-family: 'Special Elite', system-ui, -apple-system, sans-serif; font-size: 15px; color: #202122; }


/* --- NUEVOS ESTILOS PARA EL WIKCIONARIO --- */
.dict-box {
    background: #f8f9fa;
    border-left: 4px solid #8d6e63;
    padding: 15px 20px;
    margin-bottom: 25px;
    font-size: 14px;
    color: #202122;
    animation: fadeIn 0.3s ease-in-out forwards;
}

.dict-box .dict-title {
    font-size: 20px;
    font-weight: bold;
    color: #8d6e63;
    margin-bottom: 5px;
}

.dict-box .dict-type {
    font-style: italic;
    color: #72777d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.dict-box .dict-definition {
    line-height: 1.5;
}

.dict-box ol {
    margin: 5px 0 0 20px;
    padding: 0;
}

.dict-box li {
    margin-bottom: 6px;
}
