/* Estilo base */
body {
    background-color: black;
    color: #80ff80;
    font-family: 'Courier New', monospace;
    padding: 2rem;
    line-height: 1.5;
    font-size: 1rem;
}

/* Titulos */
h1, h2 {
    text-align: center;
    line-height: 1.3;
}

.site-header {
    margin: 1rem auto 1.5rem;
    text-align: center;
}

.site-header-compact {
    margin-bottom: 1rem;
}

.site-title {
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 3rem);
    letter-spacing: 0.04em;
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-title a:hover {
    text-decoration: none;
}

.site-nav-row {
    text-align: center;
    margin: 0.75rem 0 0;
}

.legal-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    line-height: 1.7;
}

.search-shell {
    max-width: 760px;
    margin: 0 auto 1.5rem;
}

.search-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1 1 320px;
    min-width: 0;
}

.search-submit {
    width: auto;
    min-width: 120px;
}

.search-summary {
    text-align: center;
    margin: 1rem auto 1.5rem;
    max-width: 760px;
}

.search-summary-note {
    color: #aaa;
}

.table-empty-state {
    text-align: center;
}

.share-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 0.5rem 0.85rem;
    flex-wrap: wrap;
}

.share-list li {
    margin: 0;
}

.error-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(124, 255, 122, 0.12), transparent 28rem),
        radial-gradient(circle at bottom right, rgba(124, 255, 122, 0.08), transparent 24rem),
        #030603;
}

.error-header {
    margin-bottom: 2rem;
}

.error-kicker {
    margin: 0 0 0.75rem;
    text-align: center;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #b9ffb9;
    font-size: 0.82rem;
}

.error-main {
    max-width: 1100px;
    margin: 0 auto;
}

.error-hero {
    padding: 2rem;
    border: 1px solid rgba(124, 255, 122, 0.7);
    border-radius: 24px;
    background: rgba(8, 18, 8, 0.82);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.error-code {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(124, 255, 122, 0.7);
    border-radius: 999px;
    color: #030603;
    background: #7cff7a;
    font-weight: bold;
    letter-spacing: 0.12em;
}

.error-copy {
    max-width: 44rem;
    margin: 1rem auto 0;
    text-align: center;
    color: #dfffdc;
    font-size: 1.05rem;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.75rem;
}

.error-action {
    min-width: 200px;
    padding: 0.95rem 1.2rem;
    border-radius: 999px;
    background: #7cff7a;
    color: #031003;
    font-weight: bold;
    text-align: center;
}

.error-action:hover {
    text-decoration: none;
    background: #9bff9a;
}

.error-action-secondary {
    background: transparent;
    color: #7cff7a;
    border: 1px solid rgba(124, 255, 122, 0.8);
}

.error-action-secondary:hover {
    background: rgba(124, 255, 122, 0.08);
}

.error-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.error-card {
    display: grid;
    gap: 0.55rem;
    padding: 1.2rem;
    border: 1px solid rgba(124, 255, 122, 0.36);
    border-radius: 18px;
    background: rgba(9, 15, 9, 0.78);
    min-height: 132px;
}

.error-card:hover {
    text-decoration: none;
    border-color: rgba(124, 255, 122, 0.78);
    transform: translateY(-1px);
}

.error-card span {
    color: #d2f7d2;
}

/* Clases de utilidad para accesibilidad */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #90ff90;
    color: black;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
    font-weight: bold;
}

.skip-link:focus {
    top: 6px;
}

/* Estados de foco mejorados */
:focus-visible {
    outline: 2px solid #90ff90;
    outline-offset: 2px;
}

a:focus, button:focus, input:focus, textarea:focus {
    outline: 2px solid #90ff90;
    outline-offset: 2px;
}

/* Texto de ayuda */
.help-text {
    font-size: 0.9rem;
    color: #90ff90;
    margin-top: 0.3rem;
    font-style: italic;
}

/* Articulos */
article {
    max-width: 700px;
    margin: 2rem auto;
    padding: 1.5rem;
    border: 1px solid #80ff80;
    background: #111;
    box-sizing: border-box;
}

article h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    line-height: 1.3;
}

article p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Tablas */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    border: 1px solid #80ff80;
    padding: 0.5rem;
    text-align: left;
}

th {
    background-color: #111;
}

/* Links */
a {
    color: #90ff90;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Formulario */
form {
    box-sizing: border-box;
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
    background: #111;
    padding: 1rem;
    border: 1px solid #80ff80;
    border-radius: 8px;
}

form label {
    display: block;
    margin-bottom: 1rem;
    color: #80ff80;
    font-size: 1rem;
}

form input,
form textarea {
    width: 100%;
    background: black;
    color: #80ff80;
    border: 1px solid #80ff80;
    padding: 0.5rem;
    font-family: monospace;
    font-size: 1rem;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

form button {
    background: #70ff70;
    color: black;
    padding: 0.8rem 1.5rem;
    border: none;
    font-weight: bold;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s ease;
    display: block;
}

form button:hover {
    background: #60ff60;
}

form button:focus {
    outline: 2px solid #90ff90;
    outline-offset: 2px;
}

/* Mensaje */
#msg {
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
    color: #80ff80;
    font-size: 0.95rem;
}

/* Modo claro */
.light-mode {
    background-color: #ffffff;
    color: #000000;
}

.light-mode input,
.light-mode textarea {
    background: #f5f5f5;
    color: #000000;
    border-color: #444;
}

.light-mode form {
    background: #f0f0f0;
    border-color: #aaa;
}

.light-mode article {
    background: #f9f9f9;
    border-color: #ccc;
}

.light-mode th,
.light-mode td {
    border-color: #666;
}

.light-mode th {
    background-color: #eee;
}

.light-mode a {
    color: #006600;
}

.light-mode .skip-link {
    background: #006600;
    color: white;
}

.light-mode .help-text {
    color: #006600;
}

.light-mode :focus-visible {
    outline: 2px solid #006600;
}

.light-mode a:focus, 
.light-mode button:focus, 
.light-mode input:focus, 
.light-mode textarea:focus {
    outline: 2px solid #006600;
}

.light-mode .tag {
    background-color: #006600;
    color: white;
}

.light-mode .tag:hover {
    background-color: #005500;
}

/* Boton modo oscuro / claro */
#theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #90ff90;
    display: inline-block;
    margin-left: auto;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#theme-toggle:hover {
    background-color: rgba(144, 255, 144, 0.1);
}

#theme-toggle:focus {
    outline: 2px solid #90ff90;
    outline-offset: 2px;
}

#theme-toggle::before {
    content: ""; /* dark mode */
}

body.light-mode #theme-toggle::before {
    content: ""; /* light mode */
}

.theme-toggle-wrapper {
    display: flex;
    justify-content: flex-end;
    padding: 1rem;
}

/* Responsive: ocultar columna fuente en movil */
@media (max-width: 600px) {
    #news-table th:nth-child(2),
    #news-table td:nth-child(2) {
        display: none;
    }

    .search-results-table th:nth-child(3),
    .search-results-table td:nth-child(3) {
        display: none;
    }

    #news-table td a {
        word-break: break-word;
        font-size: 1.1rem;
        line-height: 1.5;
    }

    #news-table td {
        padding: 0.8rem;
    }

    #news-table th {
        font-size: 1rem;
        padding: 0.8rem;
    }

    .pagination-container {
        gap: 0.75rem;
    }

    .pagination-container button,
    .pagination-container .pagination-btn,
    .pagination-container span {
        font-size: 0.95rem;
    }

    .error-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive: mejora visual movil */
@media (max-width: 480px) {
    body {
        padding: 0.8rem;
        font-size: 1rem;
        line-height: 1.55;
    }

    h1, h2 {
        font-size: 1.55rem;
        text-align: center;
        margin-bottom: 1rem;
    }

    .site-header {
        margin: 0.5rem auto 1rem;
    }

    .site-title {
        font-size: 1.85rem;
    }

    .site-nav-row {
        margin-top: 0.6rem;
    }

    article {
        max-width: 100%;
        margin: 1rem auto;
        padding: 1.1rem;
        font-size: 1rem;
        line-height: 1.65;
    }

    article h2 {
        font-size: 1.3rem;
        margin-bottom: 0.85rem;
        line-height: 1.35;
        text-wrap: balance;
    }

    article p {
        margin-bottom: 1rem;
        font-size: 1rem;
        line-height: 1.65;
    }

    form {
        padding: 1rem;
    }

    form input,
    form textarea {
        font-size: 1.1rem;
        padding: 0.8rem;
    }

    form button {
        font-size: 1.1rem;
        padding: 0.8rem;
    }

    .search-form {
        padding: 0;
        border: 0;
        background: transparent;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        max-width: 100%;
    }

    .search-input,
    .search-submit {
        width: 100%;
    }

    .search-summary {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }

    .legal-footer {
        font-size: 0.85rem;
        line-height: 1.9;
        padding-bottom: 1.5rem;
    }

    .error-hero {
        padding: 1.25rem;
        border-radius: 18px;
    }

    .error-code {
        margin-bottom: 0.75rem;
    }

    .error-copy {
        font-size: 0.95rem;
    }

    .error-action {
        width: 100%;
        min-width: 0;
    }

    .error-card {
        min-height: 0;
        padding: 1rem;
    }

    /* Mejoras para etiquetas en movil */
    .tags-container {
        margin: 2rem 0;
    }

    .tags-container strong {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .tags-wrapper {
        gap: 0.8rem;
    }

    .tag {
        font-size: 1.1rem;
        padding: 0.6rem 1rem;
        border-radius: 6px;
        font-weight: bold;
        letter-spacing: 0.5px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mejoras para enlaces de compartir */
    .share-links {
        font-size: 1.2rem;
        margin-top: 2.5rem;
    }

    .share-links h3 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .share-links a {
        margin: 0.4rem 0.6rem;
        font-size: 1.1rem;
        /* Removido: estilos de boton para mantener como enlaces simples */
    }
}

/* Mejoras especificas para iPhone y pantallas muy pequenas */
@media (max-width: 390px) {
    body {
        padding: 0.5rem;
        font-size: 0.98rem;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .site-header {
        margin: 0.35rem auto 0.85rem;
    }

    .site-title {
        font-size: 1.65rem;
    }

    .site-nav-row {
        font-size: 0.95rem;
    }

    .error-kicker {
        letter-spacing: 0.16em;
    }

    .error-hero h2 {
        font-size: 1.4rem;
    }

    article {
        padding: 0.9rem;
        margin: 0.5rem auto;
        border-width: 2px;
        width: 100%;
        box-sizing: border-box;
    }

    article h2 {
        font-size: 1.15rem;
        margin-bottom: 1rem;
        line-height: 1.3;
    }

    article p {
        font-size: 0.98rem;
        line-height: 1.7;
        margin-bottom: 1rem;
    }

    #news-table td a {
        font-size: 1rem;
        line-height: 1.45;
    }

    #news-table td,
    #news-table th {
        padding: 0.65rem 0.5rem;
    }

    .pagination-container {
        justify-content: stretch;
    }

    .pagination-container button,
    .pagination-container .pagination-btn {
        flex: 1 1 calc(50% - 0.5rem);
        text-align: center;
        padding: 0.65rem 0.8rem;
    }

    .pagination-container span {
        width: 100%;
        text-align: center;
    }

    /* Informacion de fuente y fecha mas legible */
    article p:last-of-type,
    article p small {
        font-size: 1.1rem;
    }

    /* Etiquetas especificas para iPhone */
    .tags-container {
        margin: 2.5rem 0;
    }

    .tags-container strong {
        font-size: 1.4rem;
        margin-bottom: 1.2rem;
        color: #80ff80;
    }

    .tags-wrapper {
        gap: 1rem;
    }

    .tag {
        font-size: 1.2rem;
        padding: 0.8rem 1.2rem;
        border-radius: 8px;
        font-weight: bold;
        letter-spacing: 0.5px;
        min-height: 48px;
        text-align: center;
        line-height: 1.2;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .share-links h3 {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }

    .share-links a {
        display: inline-block;
        margin: 0.5rem 0.8rem;
        font-size: 1.05rem;
        /* Removido: estilos de boton para mantener como enlaces simples */
    }

    /* Boton de volver mas visible */
    a[href="/"] {
        font-size: 1rem;
        padding: 0.8rem 1rem;
        display: inline-block;
        margin: 1.5rem 0;
        background: #80ff80;
        color: black;
        border-radius: 4px;
        font-weight: bold;
        text-decoration: none;
    }

    a[href="/"]:hover {
        background: #66ff66;
    }

    /* Video embed mas pequeno en movil */
    #noticia-embed {
        margin: 1.5rem 0;
    }

    #noticia-embed iframe,
    #noticia-embedded-content iframe {
        max-width: 100%;
        aspect-ratio: 16 / 9;
        height: auto;
    }
}

@media (min-width: 601px) {
    form button {
        width: auto;
        display: block;
        margin: 0 auto;
        padding: 0.8rem 2rem;
    }
}

/* Videos centrados y responsivos (contenido legacy + embeddedContent) */
#noticia-embed,
#noticia-embedded-content {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

#noticia-embed iframe,
#noticia-embedded-content iframe,
iframe.consent-iframe {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: none;
    background: black;
    animation: fadeIn 0.8s ease-in;
}

/* Estilo para las redes sociales */
.share-links {
    text-align: center;
    margin-top: 2rem;
    font-size: 1rem;
}

.share-links a {
    margin: 0 0.5rem;
    color: #80ff80;
    text-decoration: none;
}

.share-links a:hover {
    text-decoration: underline;
}

body.light-mode .share-links a {
    color: #007700;
}

.light-mode .article-meta {
    border-top-color: #ccc;
}

.light-mode .help-text {
    color: #006600;
}

.light-mode :focus-visible {
    outline: 2px solid #006600;
}

.light-mode a:focus, 
.light-mode button:focus, 
.light-mode input:focus, 
.light-mode textarea:focus {
    outline: 2px solid #006600;
}

.light-mode .tag {
    background-color: #006600;
    color: white;
}

.light-mode .tag:hover {
    background-color: #005500;
}

.light-mode span[aria-label="requerido"] {
    color: #cc0000;
}

/* Estilos para modo claro en movil */
@media (max-width: 480px) {
    body.light-mode a[href="/"] {
        background: #007700;
        color: white;
    }

    body.light-mode .tags-container strong {
        color: #000000;
    }
}

@media (max-width: 390px) {
    body.light-mode a[href="/"] {
        background: #007700;
        color: white;
    }

    body.light-mode .tags-container strong {
        color: #000000;
    }
}

/* Cursor terminal parpadeante solo en modo oscuro */
body:not(.light-mode) .terminal-cursor {
    display: inline-block;
    margin-left: 4px;
    animation: blink-cursor 0.8s steps(2, start) infinite;
    color: #80ff80;
    font-weight: bold;
    font-size: 1rem;
}

/* Animaciones */
@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Estilo para los botones de paginacion del index */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem auto;
}

.pagination-container button,
.pagination-container .pagination-btn {
    background-color: #70ff70;
    color: black;
    padding: 0.5rem 1.2rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.pagination-container button:hover:not(:disabled),
.pagination-container .pagination-btn:hover:not(.disabled) {
    background-color: #60ff60;
}

.pagination-container button:focus,
.pagination-container .pagination-btn:focus {
    outline: 2px solid #90ff90;
    outline-offset: 2px;
}

.pagination-container button:disabled,
.pagination-container .pagination-btn.disabled {
    background-color: #444;
    color: #888;
    cursor: not-allowed;
}

.pagination-container span {
    font-family: monospace;
    font-size: 1rem;
    font-weight: bold;
    color: #80ff80;
}

/* Estilos para etiquetas/tags */
.tags-container {
    margin: 1.5rem 0;
}

.tags-container strong {
    display: block;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    color: #80ff80;
}

.tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background-color: #70ff70;
    color: black;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    display: inline-block;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-decoration: none;
    line-height: 1.2;
}

.tag:hover {
    background-color: #60ff60;
    transform: translateY(-1px);
    text-decoration: none;
    color: black;
}

.tag:active {
    transform: translateY(0);
}

.no-tags {
    color: #666;
    font-style: italic;
    font-size: 0.9rem;
}

/* Estilos adicionales para elementos semanticos */
.article-content {
    margin: 1.5rem 0;
}

.article-meta {
    margin: 2rem 0 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

.article-meta p {
    margin: 0.5rem 0;
}

/* Mejoras para caption y fieldset */
table caption {
    margin-bottom: 1rem;
    font-weight: bold;
}

fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

legend {
    font-weight: bold;
    margin-bottom: 1rem;
}

/* Estilos para indicadores de campos requeridos */
span[aria-label="requerido"] {
    color: #ff8080;
    font-weight: bold;
}

/* Cookie consent banner styles */
.cookie-banner {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.95);
    color: #fff;
    padding: 1rem;
    border-radius: 8px;
    z-index: 10000;
    display: none;
}
.cookie-banner .cookie-actions { display:flex; gap:0.5rem; margin-top:0.5rem; align-items:center; }
.cookie-preferences {
    display:none;
    position:fixed;
    right:1rem;
    bottom:5rem;
    z-index:10001;
    background:#fffdf7;
    color:#111;
    padding:1rem;
    border-radius:8px;
    border:1px solid #d8d2bf;
    box-shadow:0 10px 30px rgba(0,0,0,0.25);
}
.cookie-preferences h3,
.cookie-preferences legend,
.cookie-preferences label,
.cookie-preferences p {
    color:#111;
}
.cookie-preferences fieldset {
    border:1px solid #c8c1ab;
    border-radius:6px;
    padding:1rem;
    background:#fff;
}
.cookie-preferences legend {
    display:block;
    padding:0 0.35rem;
    margin:0 0 0.75rem 0.5rem;
    background:#fff;
    line-height:1.2;
}
.cookie-preferences input[type="checkbox"] {
    accent-color:#2f7d32;
}
.cookie-preferences-actions { margin-top:0.8rem; display:flex; gap:0.5rem; }
.cookie-link { color: #90ff90; display:inline-block; margin-top:0.5rem; }

.btn.primary { background:#70ff70; color:black; padding:.5rem 1rem; border-radius:6px; border:none; cursor:pointer; }
.btn.outline { background:transparent; border:1px solid #ccc; color:#fff; padding:.4rem .8rem; border-radius:6px; cursor:pointer; }
.cookie-preferences .btn.primary {
    background:#2f7d32;
    color:#fff;
}
.cookie-preferences .btn.outline {
    background:#fff;
    border:1px solid #6b7280;
    color:#111;
}
