:root {
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --blue-accent: #0071e3;
    --blue-hover: #005bb5;
    --yellow-accent: #f1c40f;
    --border-radius: 16px;
}

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

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    padding: 20px; 
    padding-bottom: 80px;
}

header { max-width: 650px; margin: 0 auto 20px; text-align: center; }

.brand-area { cursor: pointer; display: inline-block; }
h1 { font-size: 26px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.5px; color: #111; }

.sub-header { color: var(--text-muted); font-size: 13px; font-weight: 500; margin-bottom: 20px; }
.version-display {
    font-size: 7px;
    background-color: #BBBBBB;
    color: var(--card-bg);
    padding: 2px 6px;
    border-radius: 6px;
    margin: 0px 6px 1px 1px;
    font-weight: 600;
    vertical-align: middle;
    display: none; 
}

input[type="text"] {
    width: 100%; padding: 14px 20px; font-size: 16px; border: none; border-radius: 12px;
    background: var(--card-bg); box-shadow: 0 4px 6px rgba(0,0,0,0.04);
    outline: none; transition: box-shadow 0.2s ease; margin-bottom: 15px;
}
input[type="text"]:focus { box-shadow: 0 0 0 2px var(--blue-accent); }

/* Chips de Filtros */
.chips-container {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 5px;
    scrollbar-width: none;
    margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px;
    /* Degradado */
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 20px, black calc(100% - 20px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 20px, black calc(100% - 20px), transparent 100%);
}
.chips-container::-webkit-scrollbar { display: none; }

.chip {
    background: var(--card-bg); border: 1px solid #ddd; color: var(--text-muted);
    padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
    white-space: nowrap; cursor: pointer; transition: all 0.2s ease;
}
.chip:hover { border-color: var(--blue-accent); color: var(--blue-accent); }
.chip.active { background: var(--blue-accent); color: white; border-color: var(--blue-accent); }

.chip.tag-chip { border-color: var(--yellow-accent); color: #666; }
.chip.tag-chip.active { background: var(--yellow-accent); color: #000; border-color: var(--yellow-accent); }

/* Cabecera de resultados */
.results-header { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 0 5px; }
#status { color: var(--text-muted); font-size: 13px; font-weight: 500; }

.btn-share-list {
    background: none; border: none; color: var(--blue-accent); font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; gap: 4px; transition: opacity 0.2s;
}
.btn-share-list:hover { opacity: 0.7; }

#resultsContainer { max-width: 650px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

.card {
    background: var(--card-bg); padding: 20px; border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); position: relative; border-left: 6px solid transparent;
}

.card.leve { border-left-color: #34c759; }
.card.grave { border-left-color: #ff9500; }
.card.muy-grave { border-left-color: #ff3b30; }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.normativa { font-weight: 700; font-size: 16px; color: #000; }
.ley-sec { color: var(--text-muted); font-size: 13px; font-weight: 400; margin-left: 6px; }

.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; background: #f2f2f7; color: #333; }

.card.leve .badge { background-color: #34c759; color: #ffffff; }
.card.grave .badge { background-color: #ff9500; color: #ffffff; }
.card.muy-grave .badge { background-color: #ff3b30; color: #ffffff; }

.descripcion { font-size: 15px; line-height: 1.5; color: #333; margin-bottom: 16px; }

.user-tags-display { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.user-tag { background: #fffde7; border: 1px solid var(--yellow-accent); color: #856600; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }

.card-footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid #f0f0f0; padding-top: 16px; }
.tag { background: #f2f2f7; padding: 5px 10px; border-radius: 8px; font-size: 12px; color: #555; font-weight: 500; }
.tag strong { color: #222; }

.comentario { margin-top: 12px; font-size: 13px; color: #555; font-style: italic; background: #fafafa; padding: 12px; border-radius: 8px; border-left: 3px solid var(--yellow-accent); }

.actions { margin-left: auto; display: flex; gap: 8px; }
.btn-action {
    background-color: #f2f2f7; color: var(--text-main); border: none;
    padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s ease;
}
.btn-action:hover { background-color: #e5e5ea; }
.btn-share { background-color: var(--blue-accent); color: white; }
.btn-share:hover { background-color: var(--blue-hover); }

#toast {
    visibility: hidden; min-width: 250px; background-color: rgba(0,0,0,0.85); color: #fff;
    text-align: center; border-radius: 20px; padding: 12px 20px; position: fixed; backdrop-filter: blur(10px);
    z-index: 1000; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 14px; font-weight: 500;
    opacity: 0; transition: opacity 0.3s, bottom 0.3s;
}
#toast.show { visibility: visible; opacity: 1; bottom: 40px; }

/* MODAL ETIQUETAS */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.modal-overlay.show { opacity: 1; visibility: visible; }

.modal-content {
    background: var(--card-bg); width: 90%; max-width: 400px;
    border-radius: 20px; padding: 24px; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transform: translateY(20px); transition: transform 0.3s ease;
}
.modal-overlay.show .modal-content { transform: translateY(0); }

.modal-content h3 { font-size: 18px; margin-bottom: 4px; }
.modal-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

.modal-suggestions-area { margin-top: 16px; margin-bottom: 24px; }
.modal-suggestions-area p { font-size: 12px; font-weight: 600; color: #555; margin-bottom: 8px; }
.suggestions-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 100px; overflow-y: auto; }
.suggestion-chip {
    background: #f2f2f7; border: 1px solid #ddd; padding: 4px 10px; border-radius: 12px;
    font-size: 12px; cursor: pointer; color: #333; transition: background 0.2s;
}
.suggestion-chip:hover { background: #e5e5ea; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-modal { padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; border: none; cursor: pointer; }
.btn-cancel { background: #f2f2f7; color: #333; }
.btn-save { background: var(--blue-accent); color: white; }

/* --- LÓGICA BOTONES COOKIES --- */
.cookie-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }

.btn-cookie {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: flex;
    flex-direction: column; /* Apila el texto principal y el small */
    align-items: center;
    justify-content: center;
    min-height: 52px; /* Altura mínima uniforme */
    transition: all 0.2s;
}

.btn-cookie small { font-size: 10px; opacity: 0.8; font-weight: 400; margin-top: 2px; }

/* Ajuste de colores */
.btn-cookie.accept { background: var(--blue-accent); color: white; }
.btn-cookie.reject { background: #f2f2f7; color: #333; }

/* Banner de Cookies */
.cookie-banner {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: #ffffff; border-top: 1px solid #e5e5ea;
    padding: 20px; z-index: 1000; box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
}
.cookie-content { max-width: 650px; margin: 0 auto; text-align: center; }
.cookie-content h3 { font-size: 16px; margin-bottom: 8px; }
.cookie-content p { font-size: 14px; color: #555; margin-bottom: 16px; }
.cookie-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.cookie-link { 
    font-size: 12px; color: var(--text-muted); cursor: pointer; 
    text-decoration: underline; margin-top: 10px; display: inline-block;
}


/* Ajuste del Modal de política para que se vea bien */
.policy-text { 
    font-size: 14px; color: #333; line-height: 1.6; 
    text-align: left; max-height: 300px; overflow-y: auto; margin-bottom: 20px;
}

.policy-text p {
    margin: 4px 0 0 0;
}

.policy-text ul {
    margin: 10px 0 10px 20px;
}
.policy-text li {
    margin-bottom: 10px;
    font-size: 13px;
    color: #444;
}

.cookie-config-footer {
    text-align: center;
    padding: 15px; 
    margin-top: 20px;
    display: none;
}

.btn-cookie-footer {
    background: none;
    border: none;
    color: var(--text-muted);
    text-decoration: underline;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-cookie-footer:hover {
    color: var(--blue-accent);
}

.pwa-banner {
    background: #fffde7;
    border-bottom: 2px solid #ffe082;
    margin-bottom: 10px;
    padding: 15px;
    text-align: center;
    font-size: 14px;
    color: #333;
    width: 100%;
    display: none; /* Controlado por JS */
}

.pwa-banner p { margin-bottom: 10px; }

#androidContent {
    display: flex;
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    gap: 10px;
}

#installBtn {
    margin: 0 auto; 
    display: inline-block; 
}

.hidden { 
    display: none !important; 
}

/* Responsive */
@media (max-width: 400px) {
    .cookie-actions { flex-direction: column; }
}