/*
 * Artifact Browser Styles
 */

#artifact-browser-container {
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
}

/* ==========================================
   Statistics Dashboard
   ========================================== */

#stats-panel {
    flex-shrink: 0;
}

#stats-panel .panel {
    margin-bottom: 10px;
}

#stats-panel .panel-heading {
    padding: 8px 15px;
}

#stats-panel .panel-heading .panel-title {
    font-size: 14px;
    line-height: 30px;
}

#stats-panel .panel-body {
    padding: 15px 10px;
}

.stat-card {
    min-height: 240px;
    padding: 5px 10px;
}

.stat-chart-title {
    display: block;
    text-align: center;
    margin-bottom: 5px;
    font-size: 12px;
    color: #555;
}

.stat-chart-container {
    min-height: 180px;
}

.stat-total {
    padding-top: 20px;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: #0088ce;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: #777;
    margin-top: 5px;
}

#btn-toggle-stats {
    color: #555;
    font-size: 14px;
    padding: 5px 8px;
}

/* ==========================================
   Browser Panels
   ========================================== */

#browser-row {
    display: flex;
    flex: 1;
    min-height: 0;
    float: none;
}

#browser-row::before,
#browser-row::after {
    display: none;
}

/* Tree Panel */
#tree-panel {
    float: none;
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

#tree-panel > .panel:first-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    min-height: 0;
}

#tree-panel > .panel:first-child > .panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Tree View */
#tree-view {
    margin-bottom: 0;
}

.tree-node {
    margin: 0;
}

.tree-item {
    padding: 8px 10px;
    cursor: pointer;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    transition: background-color 0.15s ease;
}

.tree-item:hover {
    background-color: #f5f5f5;
}

.tree-item.active {
    background-color: #def3ff;
    border-left-color: #0088ce;
}

.tree-toggle {
    width: 16px;
    margin-right: 5px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-item .badge {
    margin-left: 5px;
    font-size: 10px;
}

.tree-children {
    margin-left: 15px;
    border-left: 1px dashed #ccc;
}

/* Product node styling */
.product-node > .tree-item {
    font-weight: 600;
    background-color: #f9f9f9;
}

.product-node > .tree-item:hover {
    background-color: #f0f0f0;
}

/* Run item level */
.run-item {
    padding-left: 10px !important;
    font-size: 13px;
}

.run-item .pficon-running {
    color: #3f9c35;
    margin-right: 5px;
}

/* Runs with no attachments */
.run-item.no-attachments {
    opacity: 0.5;
}

.run-item.no-attachments .pficon-running {
    color: #999;
}

.no-att-icon {
    color: #cc0000;
    font-size: 10px;
    margin-left: 5px;
}

/* Bug Tree Panel */
#bug-tree-panel {
    margin-top: 0;
}

#bug-tree-panel .panel-heading {
    padding: 8px 15px;
}

#bug-tree-panel .panel-body {
    overflow-y: auto;
    max-height: 300px;
    padding: 10px;
}

.bug-item {
    padding-left: 10px !important;
    font-size: 13px;
}

.bug-item .fa-bug {
    margin-right: 5px;
}

.bug-icon-open {
    color: #cc0000;
}

.bug-icon-closed {
    color: #999;
}

.bug-status-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 5px;
}

.bug-status-open {
    background-color: #cc0000;
    color: #fff;
}

.bug-status-closed {
    background-color: #d1d1d1;
    color: #555;
}

/* Detail Panel */
#detail-panel {
    float: none;
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

#detail-panel .panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

#detail-panel .panel-body {
    flex: 1;
    overflow-y: auto;
}

#detail-placeholder {
    color: #999;
}

#detail-placeholder .fa {
    display: block;
    margin-bottom: 20px;
}

/* Folder icons */
.pficon-folder-close,
.pficon-folder-open {
    margin-right: 5px;
    color: #f0ab00;
}

/* ==========================================
   Attachment Groups
   ========================================== */

.attachment-group {
    margin-bottom: 15px;
}

.attachment-group .panel-heading {
    padding: 8px 15px;
    cursor: pointer;
}

.attachment-group .panel-heading:hover {
    background-color: #f0f0f0;
}

.attachment-group .group-toggle {
    margin-right: 8px;
    transition: transform 0.2s ease;
}

.attachment-group .group-title {
    font-weight: 600;
    font-size: 13px;
}

.attachment-group .group-count {
    margin-left: 8px;
}

.attachment-group .status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    margin-left: 8px;
}

/* Attachment table */
.attachment-table {
    font-size: 13px;
    margin-bottom: 0;
}

.attachment-table th {
    font-size: 12px;
    white-space: nowrap;
}

.attachment-table .att-checkbox {
    width: 30px;
    text-align: center;
}

.attachment-table .att-filename {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-table .att-filename a {
    cursor: pointer;
    color: #0088ce;
}

.attachment-table .att-filename a:hover {
    text-decoration: underline;
}

.attachment-table .att-icon {
    margin-right: 5px;
    color: #555;
}

.attachment-table .att-actions .btn {
    padding: 2px 6px;
    font-size: 12px;
}

.attachment-table .att-source {
    font-size: 11px;
    color: #888;
}

/* Select All in group */
.group-select-all {
    font-size: 12px;
    font-weight: normal;
    color: #555;
    margin-left: 15px;
}

/* ==========================================
   Search Results
   ========================================== */

#search-results-table {
    font-size: 13px;
}

#search-results-table .clickable-row {
    cursor: pointer;
}

/* ==========================================
   C3 Chart Tooltip Fix
   ========================================== */

.c3-arc, .c3-bar {
    cursor: pointer;
}

.c3-tooltip {
    background: #393f44;
    box-shadow: none;
    opacity: 0.9;
}

.c3-tooltip th {
    background: transparent;
    font-size: 12px;
    padding: 5px 10px 0;
    border-bottom: 2px solid #030303;
    color: #fff;
}

.c3-tooltip td {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 12px;
    padding: 5px 10px;
}

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 991px) {
    #artifact-browser-container {
        height: auto;
    }

    #browser-row {
        flex-direction: column;
    }

    #tree-panel,
    #detail-panel {
        min-height: 300px;
        max-height: 50vh;
    }

    .stat-card {
        min-height: auto;
        margin-bottom: 15px;
    }

    .stat-chart-container {
        height: 150px;
    }
}

/* ==========================================
   Filter section
   ========================================== */

#tree-panel .form-group {
    margin-bottom: 10px;
}

#attachment-toolbar {
    margin-bottom: 10px;
}

#attachment-summary {
    margin-bottom: 10px;
}

.bug-linked-panel {
    margin-bottom: 15px;
}

.bug-linked-panel .panel-heading {
    padding: 8px 15px;
    font-weight: 600;
    font-size: 13px;
    background-color: #f5f5f5;
}

.bug-linked-panel .panel-body {
    padding: 10px 15px;
}

.bug-linked-row {
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.8;
}

.bug-linked-row + .bug-linked-row {
    border-top: 1px solid #eee;
}

.bug-linked-label {
    font-weight: 600;
    color: #555;
    margin-right: 5px;
}

.bug-linked-row a {
    color: #0088ce;
    white-space: nowrap;
}

.bug-linked-row a:hover {
    text-decoration: underline;
}
