/* RedAI-Web – Bugs conocidos (página pública y detalle) */

.bugs-page {
    padding: 1rem 0 2rem;
    min-height: 60vh;
    background: var(--neo-bg, #0b0f19);
    color: var(--neo-text, #e6e9f2);
}

.bugs-page .container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .bugs-page .container { padding: 0 1.5rem; }
}

/* Header */
.bugs-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--neo-border, rgba(255,255,255,0.08));
}

.bugs-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.35rem 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--neo-primary, #6366f1), var(--neo-accent, #8b5cf6));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bugs-header h1 i { -webkit-text-fill-color: initial; color: var(--neo-primary); }

.bugs-header .bugs-intro {
    font-size: 0.9rem;
    color: var(--neo-muted, #9aa6bf);
    margin: 0;
    line-height: 1.5;
}

/* Toolbar: filtros y búsqueda */
.bugs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.bugs-toolbar .search-wrap {
    flex: 1;
    min-width: 180px;
}

.bugs-toolbar .search-wrap input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border-radius: 8px;
    border: 1px solid var(--neo-border);
    background: var(--neo-surface, #101625);
    color: var(--neo-text);
    font-size: 0.9rem;
}

.bugs-toolbar select {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--neo-border);
    background: var(--neo-surface);
    color: var(--neo-text);
    font-size: 0.9rem;
}

.bugs-toolbar .btn-report-bug {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--neo-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.bugs-toolbar .btn-report-bug:hover { opacity: 0.9; }

/* Bloques: Top votados / Recientes */
.bugs-blocks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
    .bugs-blocks { grid-template-columns: 1fr; }
}

.bugs-block {
    background: var(--neo-surface, #101625);
    border: 1px solid var(--neo-border);
    border-radius: 12px;
    padding: 1rem;
}

.bugs-block h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--neo-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.bugs-block ul { list-style: none; padding: 0; margin: 0; }
.bugs-block li { margin-bottom: 0.4rem; }
.bugs-block li:last-child { margin-bottom: 0; }
.bugs-block a {
    color: var(--neo-text);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.bugs-block a:hover { color: var(--neo-primary); }
.bugs-block .bug-id-mini { font-weight: 600; color: var(--neo-primary); font-size: 0.8rem; }

/* Tabla / Cards de lista */
.bugs-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bug-card {
    background: var(--neo-surface);
    border: 1px solid var(--neo-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    padding-left: 1.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    border-left: 4px solid var(--neo-border);
}

.bug-card:hover {
    border-color: var(--neo-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

/* Borde izquierdo por estado */
.bug-card--status-open { border-left-color: #f59e0b; }
.bug-card--status-in_progress { border-left-color: #3b82f6; }
.bug-card--status-fixed_next { border-left-color: #10b981; }
.bug-card--status-wont_fix { border-left-color: #6b7280; }
.bug-card--status-invalid { border-left-color: #ef4444; }

.bug-card--top-voted {
    background: linear-gradient(135deg, var(--neo-surface) 0%, rgba(99, 102, 241, 0.04) 100%);
}

.bug-badge-top {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: #ea580c;
    background: rgba(234, 88, 12, 0.15);
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    flex-shrink: 0;
}

.bug-card-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.bug-card-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bug-card-title-row a {
    font-weight: 600;
    font-size: 1rem;
    color: var(--neo-text);
    text-decoration: none;
}

.bug-card-title-row a:hover { color: var(--neo-primary); }

.bug-id-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--neo-primary);
    background: rgba(99, 102, 241, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.bug-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.bug-status, .bug-severity {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.bug-status.open { background: #fef3c7; color: #92400e; }
.bug-status.in_progress { background: #dbeafe; color: #1e40af; }
.bug-status.fixed_next { background: #d1fae5; color: #065f46; }
.bug-status.wont_fix { background: #e5e7eb; color: #374151; }
.bug-status.invalid { background: #fee2e2; color: #991b1b; }

.bug-severity.low { background: #e0e7ff; color: #3730a3; }
.bug-severity.medium { background: #fef3c7; color: #92400e; }
.bug-severity.high { background: #fed7aa; color: #9a3412; }
.bug-severity.critical { background: #fecaca; color: #b91c1c; }

.bug-meta {
    font-size: 0.8rem;
    color: var(--neo-muted);
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.bug-meta span { display: inline-flex; align-items: center; gap: 0.25rem; }

.bug-votes {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.bug-votes .btn-vote {
    background: transparent;
    border: 1px solid var(--neo-border);
    color: var(--neo-text);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.bug-votes .btn-vote:hover { background: var(--neo-surface-2); }
.bug-votes .btn-vote.voted {
    background: linear-gradient(135deg, var(--neo-primary), var(--neo-accent, #8b5cf6));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.bug-votes .btn-vote.voted:hover { opacity: 0.95; filter: brightness(1.05); }
.bug-votes .vote-count { transition: transform 0.2s ease; }
.bug-votes .btn-vote:active .vote-count { transform: scale(1.15); }
@keyframes vote-bump { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
.bug-votes .vote-count.vote-bump { animation: vote-bump 0.35s ease; }

/* Empty */
.bugs-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--neo-muted);
}

/* Guía "Cómo reportar" */
.bugs-how-to {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--neo-surface);
    border: 1px solid var(--neo-border);
    border-radius: 12px;
}

.bugs-how-to summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--neo-primary);
}

.bugs-how-to .how-to-content {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--neo-muted);
    line-height: 1.6;
}

.bugs-how-to .how-to-content ul { margin: 0.5rem 0 0 1rem; padding: 0; }

/* Modal reportar bug y modales de bugs: responsive en pantallas pequeñas */
.bugs-modal-backdrop {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(0.5rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.bugs-modal-backdrop.is-open { display: flex; }

/* En móvil el modal no debe sobresalir: altura máxima y scroll solo dentro del modal */
@media (max-width: 640px) {
    .bugs-modal-backdrop {
        align-items: flex-start;
        padding: 0.5rem;
        min-height: 100%;
    }
    .bugs-modal-backdrop.is-open {
        padding-bottom: 2rem;
    }
}

.bugs-modal {
    background: var(--neo-surface);
    border: 1px solid var(--neo-border);
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: min(90vh, 90dvh);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin: auto;
}

@media (max-width: 640px) {
    .bugs-modal {
        max-height: calc(100dvh - 1rem);
        max-height: calc(100vh - 1rem);
    }
}

.bugs-modal .modal-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--neo-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.bugs-modal .modal-header h2 { margin: 0; font-size: 1rem; }
.bugs-modal .modal-close {
    background: none;
    border: none;
    color: var(--neo-muted);
    cursor: pointer;
    padding: 0.35rem;
    font-size: 1.5rem;
    line-height: 1;
}

.bugs-modal .modal-body {
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.bugs-modal label { display: block; margin-bottom: 0.25rem; font-size: 0.85rem; font-weight: 500; }
.bugs-modal input[type="text"],
.bugs-modal input[type="email"],
.bugs-modal input[type="file"],
.bugs-modal select,
.bugs-modal textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--neo-border);
    background: var(--neo-bg);
    color: var(--neo-text);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
}

.bugs-modal select { cursor: pointer; }
.bugs-modal textarea { min-height: 80px; resize: vertical; }
.bugs-modal .form-actions { margin-top: 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; flex-shrink: 0; }
.bugs-modal .form-actions button { padding: 0.5rem 1rem; border-radius: 8px; font-weight: 600; cursor: pointer; }
.bugs-modal .form-actions .btn-submit { background: var(--neo-primary); color: #fff; border: none; }
.bugs-modal .form-actions .btn-cancel { background: transparent; border: 1px solid var(--neo-border); color: var(--neo-text); }

/* ========== Página detalle bug ========== */
.bug-detail-page {
    padding: 1rem 0 2rem;
    min-height: 60vh;
    background: var(--neo-bg);
    color: var(--neo-text);
}

.bug-detail-page .container { max-width: 800px; margin: 0 auto; padding: 0 1rem; }

.bug-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--neo-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.bug-detail-back:hover { color: var(--neo-primary); }

.bug-detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--neo-border);
}

.bug-detail-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.bug-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.bug-detail-body {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.bug-detail-body .section-title { font-weight: 600; margin: 1rem 0 0.35rem 0; font-size: 0.9rem; color: var(--neo-muted); }

.bug-detail-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.bug-detail-attachments img,
.bug-detail-attachments video {
    max-width: 100%;
    max-height: 280px;
    border-radius: 8px;
    border: 1px solid var(--neo-border);
}

.bug-detail-comments {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--neo-border);
}

.bug-detail-comments h3 { font-size: 1rem; margin: 0 0 0.75rem 0; }
.bug-comment {
    padding: 0.75rem;
    background: var(--neo-surface);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--neo-border);
}

.bug-comment .comment-meta { font-size: 0.8rem; color: var(--neo-muted); margin-bottom: 0.35rem; }
.bug-comment .comment-body { font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; }

.bug-detail-vote-wrap { margin-top: 1rem; }
.bug-detail-vote-wrap .btn-vote {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    border: 1px solid var(--neo-border);
    background: var(--neo-surface);
    color: var(--neo-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}
.bug-detail-vote-wrap .btn-vote:hover { border-color: var(--neo-primary); background: rgba(99, 102, 241, 0.08); }
.bug-detail-vote-wrap .btn-vote.voted {
    background: linear-gradient(135deg, var(--neo-primary), var(--neo-accent, #8b5cf6));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}
.bug-detail-vote-wrap .btn-vote.voted:hover { opacity: 0.95; }
.bug-detail-vote-wrap .vote-count { transition: transform 0.2s; }
.bug-detail-vote-wrap .vote-count.vote-bump { animation: vote-bump 0.35s ease; }
