﻿/* main.css - Cleaned Version */

/* ===== BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Add app-container for SQL pages */
.app-container {
    max-width: 100%;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== LOGIN SCREEN ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 85vh;
}

.login-box {
    background: white;
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 480px;
    animation: fadeInUp 0.6s ease-out;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.2em;
    font-weight: 700;
}

.login-box p {
    text-align: center;
    color: #666;
    margin-bottom: 35px;
    font-size: 1em;
}

.login-tabs {
    display: flex;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 5px;
}

.login-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #666;
    font-weight: 600;
    transition: all 0.3s;
    border-radius: 8px;
    font-size: 0.95em;
}

.login-tab:hover {
    color: #667eea;
}

.login-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.login-content {
    display: none;
}

.login-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
    background: white;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

/* ===== BUTTONS ===== */
.sso-button {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s;
    margin-bottom: 15px;
}

.sso-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.sso-button.github {
    border-color: #333;
    color: #333;
}

.sso-button.github:hover {
    background: #333;
    color: white;
}

.submit-btn, .btn-primary, .btn-success, .btn-secondary {
    padding: 14px 30px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.submit-btn, .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.submit-btn:hover:not(:disabled), 
.btn-primary:hover, 
.btn-success:hover, 
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.logout-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-weight: 600;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header Top Row - Navigation and User Info */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Header Title - Centered Below Navigation */
.header-title {
    text-align: center;
    width: 100%;
}

.header h1 {
    color: white;
    margin: 0;
    font-size: 2em;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.header h1 i {
    font-size: 0.9em;
}

/* User Info Section */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#userName {
    color: white;
    font-weight: 600;
    font-size: 15px;
}

/* ===== FILTER SECTION ===== */
.filter-section {
    background: white;
    padding: 30px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.filter-section h2 {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.4em;
    font-weight: 700;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.filter-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.filter-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.filter-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* ===== MAIN SECTION ===== */
.main-section {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0;
}

.tab {
    padding: 15px 25px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab:hover {
    color: #667eea;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.tab-content h2 {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.5em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== DASHBOARD TABS ===== */
.dashboard-tabs {
    display: flex;
    gap: 10px;
    margin: 30px 0 20px 0;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0;
}

.dashboard-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-tab:hover {
    color: #667eea;
}

.dashboard-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.dashboard-tab-content {
    display: none;
}

.dashboard-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 16px;
    color: white;
    text-align: center;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 36px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.stat-card h3 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.stat-card p {
    font-size: 0.9em;
    opacity: 0.9;
}

/* ===== CHARTS ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    min-height: 400px;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-card canvas {
    max-height: 300px !important;
    width: 100% !important;
    height: 300px !important;
}

.chart-card > div {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ===== DATA GRID ===== */
.data-grid-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-top: 20px;
}

.data-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.data-grid-title {
    font-weight: 600;
    color: #495057;
    font-size: 16px;
}

.data-grid-search {
    position: relative;
}

.data-grid-search input {
    padding: 8px 12px 8px 36px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    font-size: 14px;
    width: 250px;
}

.data-grid-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.data-grid-table-container {
    overflow-x: auto;
}

.data-grid-table, .data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-grid-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.data-grid-table th {
    padding: 16px 12px;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s;
}

.data-grid-table th:hover {
    background: rgba(255, 255, 255, 0.1);
}

.data-grid-table th.sortable:after {
    content: '↕';
    margin-left: 8px;
    opacity: 0.7;
    font-size: 12px;
}

.data-grid-table th.sort-asc:after {
    content: '↑';
    opacity: 1;
}

.data-grid-table th.sort-desc:after {
    content: '↓';
    opacity: 1;
}

.data-grid-table tbody tr, .data-table tr {
    transition: all 0.2s;
}

.data-grid-table tbody tr:hover, .data-table tr:hover {
    background: #f8f9fa;
}

.data-grid-table td, .data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
    font-size: 14px;
}

.data-grid-table tbody tr:last-child td, .data-table tr:last-child td {
    border-bottom: none;
}

.data-grid-table a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.data-grid-table a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.data-grid-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.data-grid-pagination {
    display: flex;
    gap: 8px;
    align-items: center;
}

.data-grid-pagination button {
    background: white;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.data-grid-pagination button:hover:not(:disabled) {
    background: #e9ecef;
}

.data-grid-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.data-grid-pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.data-grid-info {
    font-size: 14px;
    color: #6c757d;
}

/* ===== DATA TABLE (History Tables) ===== */
.data-table {
    margin-top: 20px;
    background-color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th {
    background-color: #f7f7f7;
    color: #444;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

/* ===== STATUS BADGES & ICONS ===== */
.status, .status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.status-success, .status-badge.completed {
    background-color: #d4edda;
    color: #155724;
}

.status-fail, .status-badge.failed {
    background-color: #f8d7da;
    color: #721c24;
}

.status-badge.queued {
    background: #fff3cd;
    color: #856404;
}

.status-badge.running {
    background: #d1ecf1;
    color: #0c5460;
}

.status-success-icon {
    color: #28a745 !important;
}

.status-failure-icon, .status-red {
    color: #ff4d4d !important;
}

.status-loading-icon {
    color: #0078d4;
}

.status-icon {
    font-size: 1.5em;
    margin-left: 10px;
}

/* ===== VIEW RESULTS BUTTON ===== */
.view-results-btn {
    background-color: #0078d4;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
}

.view-results-btn:hover {
    background-color: #005a9e;
    color: white;
}

.view-results-btn.status-red {
    border: 1px solid #ff4d4d;
    background-color: rgba(255, 77, 77, 0.1);
}

.view-results-btn.status-red:hover {
    background-color: #ff4d4d;
    color: white !important;
}

.build-status-cell {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* ===== FORM SECTIONS ===== */
.create-branch-container, .quick-build-container {
    max-width: 1200px;
    margin: 0 auto;
}

.form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.form-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== RADIO AND CHECKBOX GROUPS ===== */
.radio-group, .checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.radio-option, .checkbox-option {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.radio-option:hover, .checkbox-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.radio-option input, .checkbox-option input {
    width: auto;
    margin-right: 10px;
    cursor: pointer;
}

.radio-option input:checked + span,
.checkbox-option input:checked + span {
    color: #667eea;
    font-weight: 600;
}

/* ===== MULTI-SELECT CONTAINER ===== */
.multi-select-container {
    background: white;
    border-radius: 8px;
    padding: 15px;
}

.multi-select-header, #pipelineTreeSearch {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.multi-select-header .search-input, 
#pipelineTreeSearch .search-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.multi-select-header .search-input:focus, 
#pipelineTreeSearch .search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
}

.checkbox-list label {
    display: block;
    padding: 8px 10px;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.checkbox-list label:hover {
    background: #f8f9fa;
}

.checkbox-list input {
    width: auto;
    margin-right: 10px;
}

.selected-count {
    margin-top: 10px;
    padding: 10px;
    background: #e7f3ff;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    color: #0066cc;
}

/* ===== FORM ACTIONS ===== */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* ===== PREVIEW AND RESULTS ===== */
.preview-box, .results-box {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.preview-item {
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.result-success {
    padding: 10px;
    margin-bottom: 8px;
    background: #d4edda;
    border-left: 4px solid #28a745;
    border-radius: 4px;
    color: #155724;
}

.result-error {
    padding: 10px;
    margin-bottom: 8px;
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    border-radius: 4px;
    color: #721c24;
}

/* ===== LOADING INDICATORS ===== */
.loading-indicator, .loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading-indicator i, .loading i {
    font-size: 24px;
    color: #667eea;
}

.loading {
    padding: 40px;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* ===== MESSAGES ===== */
.message {
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    font-size: 15px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* ===== LOGIN MESSAGE ===== */
.login-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.login-message.info {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    color: #0066cc;
}

.login-message.error {
    background-color: #ffe7e7;
    border: 1px solid #ffb3b3;
    color: #cc0000;
}

.login-message.success {
    background-color: #e7ffe7;
    border: 1px solid #b3ffb3;
    color: #00cc00;
}

/* ===== PIPELINE TREE ===== */
.pipeline-tree {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    max-height: 600px;
    overflow-y: auto;
}

.tree-folder {
    margin-bottom: 5px;
}

.tree-folder-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
    font-weight: 500;
    color: #333;
}

.tree-folder-header:hover {
    background: #f8f9fa;
}

.tree-folder-header i.fa-chevron-right {
    margin-right: 8px;
    transition: transform 0.2s;
    color: #6c757d;
    font-size: 12px;
}

.tree-folder-header i.fa-folder,
.tree-folder-header i.fa-folder-open {
    margin-right: 8px;
    color: #ffc107;
    font-size: 16px;
}

.tree-folder.expanded > .tree-folder-header i.fa-chevron-right {
    transform: rotate(90deg);
}

.tree-folder-content {
    display: none;
    padding-left: 24px;
    margin-top: 5px;
}

.tree-folder.expanded > .tree-folder-content {
    display: block;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 3px;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
    color: #495057;
}

.tree-item:hover {
    background: #e7f3ff;
    color: #0066cc;
}

.tree-item i.fa-file-code {
    margin-right: 8px;
    color: #667eea;
    font-size: 14px;
}

.tree-item .pipeline-name {
    flex: 1;
    font-size: 14px;
}

.tree-item .pipeline-id {
    font-size: 12px;
    color: #6c757d;
    margin-left: 10px;
    font-family: 'Courier New', monospace;
}

.tree-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.tree-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.tree-checkbox {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ===== SELECTED BUILDS ===== */
#selectedBuildsSection {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

#selectedBuildsSection h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.selected-builds-counter {
    background: #667eea;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

.selected-builds-list {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.selected-build-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 6px;
    transition: all 0.2s;
}

.selected-build-item:hover {
    background: #e7f3ff;
}

.selected-build-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.selected-build-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.selected-build-id {
    font-family: 'Courier New', monospace;
    color: #6c757d;
    font-size: 12px;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 4px;
}

.remove-build-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.remove-build-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.no-selected-builds {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

.no-selected-builds i {
    font-size: 36px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ===== SELECTION ACTIONS ===== */
.selection-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.selection-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.select-all-btn {
    background: #667eea;
    color: white;
}

.clear-selection-btn {
    background: #6c757d;
    color: white;
}

.invert-selection-btn {
    background: #17a2b8;
    color: white;
}

.selection-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== BUILD ACTIONS ===== */
.build-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.build-action-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.trigger-build-btn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.trigger-build-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.cancel-builds-btn {
    background: linear-gradient(135deg, #dc3545 0%, #f06a6a 100%);
    color: white;
}

.build-action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* ===== BUILD RESULTS ===== */
#buildResults {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

#buildResults h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.build-results-list {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.build-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.build-results-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.refresh-all-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.refresh-all-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

.build-result-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
    border-left: 4px solid transparent;
}

.build-result-item:last-child {
    border-bottom: none;
}

.build-result-item:hover {
    background: #f8f9fa;
}

.build-result-item.success,
.build-result-item.completed {
    border-left-color: #28a745;
}

.build-result-item.error,
.build-result-item.failed {
    border-left-color: #dc3545;
}

.build-result-item.queued {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.build-result-item.running {
    background: #cfe2ff;
    border-left-color: #0d6efd;
}

.build-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.build-loading-indicator {
    margin-top: 8px;
    font-size: 13px;
    color: #0d6efd;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.build-polling-indicator {
    background: #e7f3ff;
    border: 1px solid #b3d7ff;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #0066cc;
    font-weight: 500;
}

.build-polling-indicator i {
    color: #0066cc;
}

.build-result-outcome {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.build-result-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

.build-action-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.build-action-button:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.no-builds {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

.no-builds i {
    font-size: 36px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ===== BUILD LOGS ===== */
.logs-container, #build-logs-container {
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', monospace;
    border: 1px solid #333;
    max-height: 600px;
    overflow-y: auto;
    font-size: 13px;
    padding: 0;
}

#build-logs-container {
    margin-top: 0;
    border-top: none;
    border-radius: 0 0 5px 5px;
}

.logs-header {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
}

.build-logs-container {
    background: #1e1e1e;
    border-radius: 8px;
    margin: 10px 0 20px 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.build-logs-header {
    background: #2d2d2d;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}

.build-logs-header h4 {
    margin: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-logs-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.refresh-logs-btn:hover {
    background: #764ba2;
}

.build-logs-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    background: #1e1e1e;
}

.logs-list {
    color: #d4d4d4;
}

.loading-logs,
.logs-empty,
.logs-error {
    text-align: center;
    padding: 40px 20px;
    color: #858585;
}

.loading-logs i {
    font-size: 24px;
    margin-bottom: 10px;
    color: #667eea;
}

.logs-empty i {
    font-size: 36px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.logs-error {
    color: #f48771;
}

.logs-error i {
    font-size: 24px;
    margin-bottom: 10px;
}

/* Log Grouping */
.log-group, details.log-group {
    margin-bottom: 5px;
    border: 1px solid #333;
    border-radius: 4px;
    background-color: #1e1e1e;
    border-bottom: 1px solid #2d2d2d;
}

.log-group-header, summary.log-group-header {
    background-color: #252526;
    padding: 8px 15px;
    cursor: pointer;
    font-weight: 600;
    color: #0078d4; /* Azure Blue */
    list-style: none; /* Removes default triangle */
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    outline: none;
}

.log-group-header:hover, summary.log-group-header:hover {
    background-color: #37373d;
}

summary.log-group-header::-webkit-details-marker {
    display: none;
}

.group-icon {
    font-size: 10px;
    color: #cccccc;
    margin-right: 10px;
    transition: transform 0.2s ease;
}

.log-group[open] .group-icon,
details[open] > summary .group-icon {
    transform: rotate(90deg);
}

.group-title {
    color: #cccccc; /* White text for task name */
    font-weight: bold;
}

/* --- Log Lines --- */
.log-group-body {
    padding: 5px 0;
    background-color: #1e1e1e;
}

.log-line {
    display: flex;
    padding: 2px 12px;
    font-family: 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.log-line:hover {
    background-color: #262626;
}

.log-time {
    flex-shrink: 0;
    width: 85px; /* Fixed width for timestamp alignment */
    text-align: right;
    margin-right: 15px;
    color: #858585; /* Dimmed gray */
    font-size: 12px;
    padding-left: 10px;
}

.log-msg {
    white-space: pre-wrap; /* Wrap long text */
    word-break: break-word;
    color: #d4d4d4;
    padding-right: 10px;
}

/* Scrollbar styling for logs */
.build-logs-content::-webkit-scrollbar,
#build-logs-container::-webkit-scrollbar {
    width: 10px;
}

.build-logs-content::-webkit-scrollbar-track,
#build-logs-container::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.build-logs-content::-webkit-scrollbar-thumb,
#build-logs-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 5px;
}

.build-logs-content::-webkit-scrollbar-thumb:hover,
#build-logs-container::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .login-box, .main-section, .filter-section {
        padding: 25px 20px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .header-title h1 {
        font-size: 1.3em;
    }

    .user-avatar {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    #userName {
        font-size: 13px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-card canvas {
        height: 250px !important;
    }

    #pipelineTreeSearch {
        flex-direction: column;
        gap: 10px;
    }

    #pipelineTreeSearch .search-input {
        width: 100%;
    }

    .selection-actions {
        flex-wrap: wrap;
    }

    .build-actions {
        flex-direction: column;
    }

    .build-action-btn {
        width: 100%;
        justify-content: center;
    }

    .data-grid-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .data-grid-search input {
        width: 100%;
    }

    .data-grid-footer {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .data-grid-table {
        font-size: 12px;
    }

    .data-grid-table th, .data-grid-table td {
        padding: 12px 8px;
    }
}

