/**
 * Common CSS styles for data viewing pages
 * Shared between crashes.html, issues.html, and failures.html
 */

/* ===== Controls Section ===== */

.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 20px;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.status-text {
    font-size: 14px;
    color: #666;
    margin: 0;
    padding: 0;
    vertical-align: baseline;
}

.historical-button {
    padding: 6px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}

.historical-button:hover {
    background: #45a049;
}

.historical-button.active {
    background: #2196F3;
}

.historical-button.active:hover {
    background: #0b7dda;
}

/* ===== Search Box ===== */

.search-container {
    position: relative;
    display: inline-block;
}

.search-box {
    padding: 8px 30px 8px 12px;
    width: 300px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    flex-shrink: 0;
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #999;
    padding: 0;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
}

.search-clear:hover {
    color: #666;
}

/* ===== No Data Message ===== */

.no-data {
    padding: 40px;
    text-align: center;
    color: #666;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ===== Row Styles (for tree/list views) ===== */

.row-container {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-row {
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    padding: 4px 10px;
    min-height: 28px;
}

.data-row:hover {
    background-color: #f5f5f5;
}

.data-row.expanded {
    background-color: #f0f8ff;
}

.data-row.non-clickable {
    cursor: default;
}

/* ===== Stats Display ===== */

.stats-container {
    display: flex;
    gap: 30px;
    font-size: 13px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    min-width: 60px;
}

.stat-label {
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
}

.stat-value {
    font-weight: bold;
    color: #333;
}

.stat-value.fail {
    color: #d00;
}

.stat-value.crash {
    color: #d00;
}

.stat-value.orange {
    color: #ff8c00;
}

.stat-value.yellow {
    color: #c9a500;
}

.stat-value.skip,
.stat-value.zero {
    color: #888;
}

.stat-value.timeout {
    color: #f60;
}

/* Reduce opacity for zero-valued stats */
.stat-item.hideable-zero {
    opacity: 0.15;
    transition: opacity 0.2s ease;
}

/* Show all stats on row hover */
.data-row:hover .stat-item.hideable-zero {
    opacity: 1;
}

/* ===== Sort Header ===== */

.sort-header {
    background: #f8f9fa;
    border-bottom: 2px solid #ddd;
    padding: 0 10px;
    display: flex;
    align-items: center;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sort-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    margin: 0 -10px;
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    border-radius: 3px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    width: 100%;
    white-space: nowrap;
}

.sort-button:hover {
    background-color: #e9ecef;
}

.sort-button.active {
    color: #007bff;
    background-color: #e7f3ff;
}

.sort-arrow {
    font-size: 10px;
    margin-right: 2px;
    width: 8px;
    display: inline-block;
    text-align: left;
}

/* ===== Total Row ===== */

.total-row {
    background-color: #f8f9fa;
    border-bottom: 2px solid #ddd;
    font-weight: bold;
}

.total-row:hover {
    background-color: #f8f9fa;
}

/* ===== Historical Charts ===== */

.historical-chart {
    margin: 10px 0 10px 20px;
    padding: 0;
}

.historical-chart-canvas {
    max-height: 100px;
    height: 100px;
    width: 100%;
}

/* ===== Action Buttons ===== */

.action-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    margin-left: 6px;
    font-size: 11px;
    color: #666;
    border-radius: 3px;
    transition: background-color 0.2s;
    opacity: 0;
    vertical-align: middle;
    text-decoration: none;
    display: inline-block;
}

.data-row:hover .action-button,
.test-row:hover .action-button {
    opacity: 1;
}

.action-button:hover {
    background-color: #e9ecef;
    color: #333;
}

.action-button:active {
    background-color: #007bff;
    color: white;
}

/* ===== Shared Hierarchical Row Styles ===== */

.path-row {
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    padding: 4px 10px 4px 30px;
    min-height: 28px;
    background: #fafafa;
}

.path-row:hover {
    background-color: #f0f0f0;
}

.path-row.expanded {
    background-color: #e8f4f8;
}

.test-row {
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    padding: 4px 10px 4px 50px;
    min-height: 28px;
    background: #f5f5f5;
}

.test-row.direct-child {
    padding-left: 30px;
}

.test-row:hover {
    background-color: #ebebeb;
}

.test-row.expanded {
    background-color: #ddeeff;
}

.test-name {
    flex: 1;
    font-family: monospace;
    font-size: 13px;
}

/* ===== Instance Row Styles ===== */

.crash-instance-row,
.failure-instance-row {
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    padding: 4px 10px 4px 70px;
    min-height: 28px;
    background: #fafafa;
    cursor: pointer;
}

.crash-instance-row:hover,
.failure-instance-row:hover {
    background-color: #e8f4ff;
}

.crash-job-name,
.failure-job-name {
    flex: 1;
    font-family: monospace;
    font-size: 12px;
}

.crash-time,
.failure-time {
    color: #666;
    font-size: 12px;
    margin-right: 20px;
}

.crash-link,
.failure-link {
    color: #007bff;
    text-decoration: none;
    font-size: 12px;
}

.crash-link:hover,
.failure-link:hover {
    text-decoration: underline;
}

.view-links {
    font-size: 12px;
    word-spacing: 3px;
}

.view-links > a {
    color: #007bff;
    text-decoration: none;
}

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

.test-crash-count,
.test-failure-count {
    color: #666;
    font-size: 13px;
    min-width: 60px;
    text-align: right;
}

/* ===== Header Styles ===== */

.header {
    margin-bottom: 20px;
}
