/* QA Ticket Tracker — Dashboard styling */

:root {
    --primary: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --text: #334155;
    --text-light: #94a3b8;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--light);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header */
header {
    background: var(--dark);
    color: white;
    padding: 1rem 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

header h1 a {
    color: white;
}

header h1 a:hover {
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #94a3b8;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    margin-bottom: 2rem;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

h3 {
    font-size: 1rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--text);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--light);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f1f5f9;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
}

.data-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table th.highlight,
.data-table td.highlight {
    background: #fef3c7;
    font-weight: 700;
}

.data-table .totals td {
    background: #f1f5f9;
    border-top: 2px solid var(--dark);
}

.data-table tr.reopened {
    background: #fef2f2;
}

.data-table tr:hover {
    background: #f8fafc;
}

/* Meta table (issue detail) */
.meta-table {
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.meta-table th {
    text-align: right;
    padding: 0.5rem 1rem 0.5rem 0;
    color: var(--text-light);
    font-weight: 500;
    white-space: nowrap;
}

.meta-table td {
    padding: 0.5rem 0;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Cards */
.trend-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.card-value.positive {
    color: var(--success);
}

.card-value.negative {
    color: var(--danger);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-open {
    background: #dcfce7;
    color: #166534;
}

.badge-closed {
    background: #f1f5f9;
    color: var(--text-light);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding: 0.75rem 0;
    padding-left: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.55rem;
    top: 1.1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}

.timeline-item.opened::before { background: var(--primary); }
.timeline-item.resolved::before { background: var(--success); }
.timeline-item.reopened::before { background: var(--danger); }
.timeline-item.status_changed::before { background: var(--warning); }

.timeline-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.timeline-content {
    font-size: 0.9rem;
}

/* External link */
.external-link {
    display: inline-block;
    background: #e2e8f0;
    color: var(--text);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.3rem;
}

.external-link:hover {
    background: var(--primary);
    color: white;
    text-decoration: none;
}

/* Status messages */
.status-info,
.status-success,
.status-error {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.status-info { background: #dbeafe; color: #1e40af; }
.status-success { background: #dcfce7; color: #166534; }
.status-error { background: #fef2f2; color: #991b1b; }

.hidden { display: none; }

/* Chart */
.chart-section canvas {
    max-height: 400px;
}

/* Drag & drop */
.drag-col {
    width: 30px;
}

.drag-handle {
    cursor: grab;
    color: var(--text-light);
    text-align: center;
    user-select: none;
    width: 30px;
    padding-left: 0.5rem !important;
    padding-right: 0 !important;
}

.drag-handle:active {
    cursor: grabbing;
}

tr.dragging {
    opacity: 0.4;
}

tr.drag-over {
    border-top: 2px solid var(--primary);
}

/* Summary header with comparison selector */
.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.summary-header h2 {
    margin-bottom: 0;
}

.comparison-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comparison-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Percentage badges */
.pct-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.pct-up {
    background: #fef2f2;
    color: var(--danger);
}

.pct-down {
    background: #dcfce7;
    color: #166534;
}

.pct-same {
    background: #f1f5f9;
    color: var(--text-light);
}

/* Chart tabs */
.chart-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.chart-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Empty state */
.empty {
    color: var(--text-light);
    padding: 2rem;
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.8rem;
}

/* Details */
details summary {
    cursor: pointer;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
