/* ========================================
   Issues Tab Styles
   ======================================== */

/* Issue Stats in Header */
.issue-stats {
    display: flex;
    gap: 15px;
    align-items: center;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #e5e7eb;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.stat-item span {
    font-weight: 700;
    font-size: 1rem;
}

.stat-item.open span {
    color: #60a5fa;
}

.stat-item.resolved span {
    color: var(--status-pass);
}

/* Add Issue Button */
.add-issue-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.add-issue-btn:hover {
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4) !important;
}

/* Issues Filters */
.issues-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 10px 14px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-elevated);
    background: #18181b;
    transition: all 0.2s ease;
    cursor: pointer;
}

.filter-group select:hover,
.filter-group input:hover {
    border-color: #6366f1;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-group {
    flex: 1;
    min-width: 200px;
}

/* Date Filter */
.date-filter-group {
    min-width: auto;
}

.date-filter-wrapper {
    display: flex;
    align-items: stretch;
    background: #18181b;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.date-filter-wrapper:hover {
    border-color: #6366f1;
}

.date-filter-wrapper:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.date-field-select {
    padding: 8px 10px;
    border: none;
    border-right: 1px solid var(--card-border);
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 105px;
    outline: none;
}

.date-range-inputs {
    display: flex;
    align-items: center;
    gap: 0;
}

.date-input-box {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
}

.date-input-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0.7;
}

.date-input-box input {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 8px 2px;
    cursor: pointer;
    outline: none;
    width: 115px;
}

.date-input-box input.has-value {
    color: var(--text-primary);
    font-weight: 500;
}

.date-input-box input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
    font-style: italic;
}

.date-input-box input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.6);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.date-input-box input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.date-range-arrow {
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.5;
    flex-shrink: 0;
}

.date-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: none;
    border-left: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.5;
}

.date-clear-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    opacity: 1;
}

/* Multi-select Label Filter */
.label-filter-group {
    min-width: 200px;
}

.multi-select-container {
    position: relative;
    min-width: 200px;
}

.multi-select-btn {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--card-border);
    border-radius: 10px;
    font-size: 0.9rem;
    background: var(--bg-elevated);
    color: var(--text-primary);
    color: #1f2937;
    background: #18181b;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    align-items: center;
    transition: all 0.2s ease;
}

.multi-select-btn:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.multi-select-btn:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.multi-select-btn .dropdown-arrow {
    font-size: 0.65rem;
    color: #9ca3af;
    transition: transform 0.2s ease;
    margin-left: 8px;
}

.multi-select-btn.open .dropdown-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 280px;
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-height: 400px;
    overflow: hidden;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.multi-select-dropdown.hidden {
    display: none;
}

.label-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
    background: var(--bg-surface);
}

.label-dropdown-header .match-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #6366f1;
    cursor: pointer;
    font-weight: 500;
}

.label-dropdown-header .match-mode input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #6366f1;
}

.clear-labels-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6366f1;
    background: #18181b;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.clear-labels-btn:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.label-options {
    overflow-y: auto;
    max-height: 320px;
    padding: 8px;
}

.label-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 8px;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.label-option:hover {
    background: var(--bg-overlay);
}

.label-option:has(input:checked) {
    background: var(--primary-bg);
    border: 1px solid var(--primary);
    margin: -1px;
    margin-bottom: 1px;
}

.label-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #6366f1;
    border-radius: 4px;
    flex-shrink: 0;
}

.label-option .label-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.label-option .label-name {
    font-size: 0.875rem;
    color: var(--text-primary);
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.label-option .label-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-light);
    background: var(--bg-overlay);
    padding: 3px 8px;
    border-radius: 12px;
    min-width: 28px;
    text-align: center;
}

/* Selected Labels Tags */
.selected-labels-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.selected-labels-tags:empty {
    display: none;
}

.label-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4338ca;
    border-radius: 20px;
    border: 1px solid #c7d2fe;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.1);
    transition: all 0.15s ease;
}

.label-tag:hover {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
}

.label-tag .tag-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.label-tag .remove-tag {
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: #6366f1;
    opacity: 0.6;
    transition: all 0.15s ease;
    margin-left: 2px;
}

.label-tag .remove-tag:hover {
    opacity: 1;
    color: #dc2626;
}

.label-tag .remove-tag:hover {
    opacity: 1;
}

.search-group input {
    width: 100%;
}

/* Issues Table */
.issues-table {
    width: 100%;
    table-layout: fixed;
}

.issues-table th {
    background: var(--table-header-bg);
    font-size: var(--font-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--table-header-text);
    padding: var(--spacing-md) var(--spacing-sm);
    white-space: nowrap;
    overflow: hidden;
    border: none;
    border-bottom: 1px solid var(--gray-400);
}

.issues-table td {
    padding: 10px 6px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

.issues-table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.issues-table tbody tr:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(139, 92, 246, 0.04) 100%);
}

/* Issue Labels */
.issue-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    max-width: 100%;
    overflow: hidden;
}

.issue-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
}

.author-avatar {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.action-btn.view {
    background: var(--primary);
    color: white;
    width: auto;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 500;
}

.action-btn.view:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Status Badge for Issues Tab */
#issues-tab .status-badge {
    min-width: 85px;
    font-size: 0.7rem;
    padding: 6px 10px;
    min-height: 28px;
}

#issues-tab .status-badge.resolved {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

/* Responsive Styles for Issues Tab */
@media (max-width: 768px) {
    .issues-filters {
        flex-direction: column;
        gap: 12px;
    }

    .filter-group {
        min-width: 100%;
    }

    .date-filter-wrapper {
        flex-wrap: wrap;
    }

    .date-field-select {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
    }

    .date-range-inputs {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }


    .issue-actions {
        flex-direction: column;
        gap: 4px;
    }

    .action-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .issue-stats {
        flex-wrap: wrap;
        gap: 8px;
    }

    .stat-item {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
}

/* ========================================
   Issues Report / Aggregated Dashboard
   ======================================== */

.issues-report {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

.report-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 700;
}

.report-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.report-controls select {
    padding: 8px 14px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-elevated);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.report-controls select:hover {
    border-color: #6366f1;
}

.report-controls select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.report-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Report Summary Cards */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.report-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 20px;
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--card-border);
}

.report-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.report-card .card-icon {
    font-size: 2rem;
    line-height: 1;
}

.report-card .card-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.report-card .card-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.report-card .card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.report-card.summary {
    border-color: rgba(99, 102, 241, 0.3);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), var(--card-bg));
}

.report-card.summary .card-value {
    color: var(--primary-light);
}

.report-card.open {
    border-color: rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), var(--card-bg));
}

.report-card.open .card-value {
    color: var(--running);
}

.report-card.closed {
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), var(--card-bg));
}

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

.report-card.rate {
    border-color: rgba(168, 85, 247, 0.3);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), var(--card-bg));
}

.report-card.rate .card-value {
    color: var(--text-secondary);
}

/* Report Breakdown Section */
.report-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.breakdown-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.breakdown-section h4 {
    margin: 0 0 15px 0;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Top Labels */
.top-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Top label styling (used in Issues Report) */
.top-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-primary) !important;
    border: 1px solid var(--card-border);
    transition: transform 0.2s ease;
    text-decoration: none;
    cursor: pointer;
}

.top-label:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    text-decoration: none;
}

.top-label .count {
    background: var(--primary);
    color: white !important;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 4px;
}

[data-theme="light"] .top-label {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b !important;
}

[data-theme="light"] .top-label .count {
    background: #4f46e5;
    color: white !important;
}

.top-label-placeholder,
.top-contributor-placeholder {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.85rem;
}

/* Top Contributors */
.top-contributors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.contributor-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-overlay);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.contributor-item:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.contributor-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--card-border);
}

.contributor-count {
    background: var(--primary-bg);
    color: var(--primary-light);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ========================================
   Sortable Table Headers
   ======================================== */

.issues-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.2s ease;
}

.issues-table th.sortable:hover {
    background: var(--table-header-hover);
}

.issues-table th.sortable .sort-icon {
    font-size: 0.7rem;
    opacity: 0.5;
    margin-left: 4px;
    transition: all 0.2s ease;
    color: white;
}

.issues-table th.sortable:hover .sort-icon {
    opacity: 0.8;
}

.issues-table th.sortable.sort-asc .sort-icon,
.issues-table th.sortable.sort-desc .sort-icon {
    opacity: 1;
    color: #a5b4fc;
}

.issues-table th.sortable.sort-asc .sort-icon::after {
    content: '↑';
}

.issues-table th.sortable.sort-desc .sort-icon::after {
    content: '↓';
}

.issues-table th.sortable.sort-asc .sort-icon,
.issues-table th.sortable.sort-desc .sort-icon {
    font-size: 0;
}

.issues-table th.sortable.sort-asc .sort-icon::after,
.issues-table th.sortable.sort-desc .sort-icon::after {
    font-size: 0.8rem;
}

/* Responsive for Report */
@media (max-width: 768px) {
    .issues-report {
        padding: 15px;
    }

    .report-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .report-card {
        padding: 12px 15px;
    }

    .report-card .card-icon {
        font-size: 1.5rem;
    }

    .report-card .card-value {
        font-size: 1.4rem;
    }

    .report-breakdown {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Issues Pagination Controls
   ======================================== */

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-info span {
    font-weight: 700;
    color: var(--primary);
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--card-border);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #818cf8;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

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

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 8px;
}

.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--card-border);
    background: var(--bg-surface);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #818cf8;
    transition: all 0.2s ease;
}

.pagination-page:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-page.active {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination-size select {
    padding: 6px 10px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.pagination-size select:focus {
    outline: none;
    border-color: #6366f1;
}

@media (max-width: 768px) {
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
    }

    .pagination-buttons {
        order: -1;
    }
}
