/* ═══════════════════════════════════════════════════════════════════
   Bug Tracker — BOL
   ═══════════════════════════════════════════════════════════════════ */

.bugs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ── Top bar ── */
.bugs-container .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.bugs-container .page-header h2 { margin: 0; }
.bugs-container .header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Filter bar ── */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
.filter-bar input,
.filter-bar select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.9em;
}
.filter-bar input { flex: 1; min-width: 200px; }
.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Stats row ── */
.stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.stat-pill {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.85em;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s;
}
.stat-pill:hover,
.stat-pill.active {
    border-color: var(--accent);
    color: var(--accent);
}
.stat-pill .count {
    font-weight: 700;
    color: var(--text-primary);
    margin-left: 4px;
}

/* ── Table ── */
.table-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.bug-table {
    width: 100%;
    border-collapse: collapse;
}
.bug-table th,
.bug-table td {
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9em;
    vertical-align: middle;
}
.bug-table th {
    background: var(--bg-primary);
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}
.bug-table tr:last-child td { border-bottom: none; }
.bug-table tr:hover { background: var(--bg-elevated); }

.bug-title-cell { max-width: 280px; }
.bug-title-cell .title { font-weight: 500; color: var(--text-primary); }
.bug-title-cell .env { font-size: 0.8em; color: var(--text-muted); margin-top: 2px; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* severity */
.sev-low      { background: rgba(40,167,69,0.15);  color: #5cb85c; }
.sev-medium   { background: rgba(255,193,7,0.15);  color: #f0ad4e; }
.sev-high     { background: rgba(255,120,20,0.15); color: #ff7814; }
.sev-critical { background: rgba(220,53,69,0.2);   color: #ff4d5e; }

/* status */
.st-open        { background: rgba(220,53,69,0.15);  color: #ff6b78; }
.st-in_progress { background: rgba(255,193,7,0.15);  color: #f0c040; }
.st-fixed       { background: rgba(78,161,255,0.15); color: #4ea1ff; }
.st-verified    { background: rgba(40,167,69,0.15);  color: #5cb85c; }
.st-wont_fix    { background: rgba(108,117,125,0.2); color: #868e96; }
.st-reopened    { background: rgba(255,120,20,0.15); color: #ff9043; }

/* test result */
.test-pass { color: #5cb85c; }
.test-fail { color: #ff4d5e; }
.test-none { color: var(--text-muted); }

/* ── Tag chips ── */
.tag-chip {
    display: inline-block;
    background: rgba(76,201,240,0.1);
    color: var(--accent);
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 0.75em;
    margin: 1px 2px;
}

/* ── Actions ── */
.action-btns { display: flex; gap: 4px; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 2.5em; margin-bottom: 12px; display: block; }

/* ── Modal ── */
.bug-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    align-items: flex-start;
    justify-content: center;
}
.bug-modal-content {
    background: var(--bg-surface);
    margin: 4% auto;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 90%;
    max-width: 680px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 18px;
}
.modal-header h3 { margin: 0; }
.modal-close {
    color: var(--text-muted);
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }

/* ── Form ── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-grid .full-width { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.85em; color: var(--text-secondary); font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 70px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

/* ── Test output panel ── */
.test-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 12px;
    font-family: monospace;
    font-size: 0.85em;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* ── Spinner ── */
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bug-spin 0.7s linear infinite;
}
@keyframes bug-spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .full-width { grid-column: 1; }
    .bug-table th:nth-child(5),
    .bug-table td:nth-child(5),
    .bug-table th:nth-child(6),
    .bug-table td:nth-child(6) { display: none; }
}
