:root {
    --primary-color: #3b82f6;        /* Blue */
    --primary-light: #eff6ff;        /* Very light blue */
    --secondary-color: #10b981;      /* Emerald green */
    --secondary-light: #d1fae5;      /* Very light green */
    --danger-color: #be123c;         /* Red */
    --danger-bg: #fef2f2;            /* Light red */
    --success-color: #10b981;        /* Green */
    --success-bg: #f0fdf4;           /* Light green */
    --border-color: #e5e7eb;         /* Gray */

    --bg-primary: #f9fafb;           /* Off-white */
    --bg-secondary: #ffffff;         /* White */
    --text-primary: #111827;         /* Dark gray */
    --text-secondary: #6b7280;       /* Medium gray */
}

html.dark {
    --primary-color: #3b82f6;        /* Darker blue (same as light mode) */
    --primary-light: #1e3a8a;        /* Dark blue */
    --secondary-color: #059669;      /* Darker emerald */
    --secondary-light: #022c22;      /* Very dark emerald */
    --danger-color: #f43f5e;         /* Light red */
    --danger-bg: #4c0519;            /* Dark red */
    --success-color: #34d399;        /* Light green */
    --success-bg: #14532d;           /* Dark green */
    --border-color: #374151;         /* Dark gray */

    --bg-primary: #111827;           /* Dark background */
    --bg-secondary: #1f2937;         /* Slightly lighter dark */
    --text-primary: #f9fafb;         /* Light text */
    --text-secondary: #9ca3af;       /* Medium light text */
}

body {
    font-family: "Inter", sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    padding: 2rem;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1400px;
    width: 100%;
    background-color: var(--bg-secondary);
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    transition: background-color 0.3s;
}

.main-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.squad-logo {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.75rem;
}

.header-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.main-header h1 {
    padding: 0 3.5rem;
}

/* --- LANGUAGE SWITCHER --- */
.lang-switcher {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
}

.lang-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
    transition: all 0.2s;
}

.lang-btn.active,
.lang-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.theme-toggle-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.theme-toggle-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.theme-toggle-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.tabs-container {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.tab-content {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- MODERN PR METRICS TAB --- */
.pr-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-controls-left {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
    background-color: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-btn .filter-count {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.filter-btn:hover {
    background-color: var(--primary-light);
}

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

.filter-btn.active .filter-count {
    color: rgba(255, 255, 255, 0.8);
}

.control-input {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: all 0.2s;
}

.control-input:hover {
    border-color: var(--primary-color);
}

#pr-search {
    width: 280px;
}

#author-filter,
#assignee-filter,
#analytics-developer-filter,
#analytics-week-filter {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    cursor: pointer;
}

.pr-table-header {
    display: grid;
    grid-template-columns: 3fr 1.5fr 1fr 1fr auto;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    background-color: #f9fafb;
    border-bottom: 1px solid var(--border-color);
}

html.dark .pr-table-header {
    background-color: #374151;
}

.sortable-header {
    cursor: pointer;
    position: relative;
    padding-right: 1.25rem;
    transition: color 0.2s;
    user-select: none;
}

.sortable-header:hover {
    color: var(--text-primary);
}

.sortable-header::before,
.sortable-header::after {
    content: "";
    position: absolute;
    right: 0;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.2;
    transition: opacity 0.2s;
}

.sortable-header::before {
    /* Up arrow */
    border-bottom: 5px solid currentColor;
    top: calc(50% - 7px);
}

.sortable-header::after {
    /* Down arrow */
    border-top: 5px solid currentColor;
    top: calc(50% + 2px);
}

.sortable-header.sorted-asc::before,
.sortable-header.sorted-desc::after {
    opacity: 1;
    /* Active state */
}

.pr-row {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-color);
}

.pr-row-main {
    display: grid;
    grid-template-columns: 3fr 1.5fr 1fr 1fr auto;
    gap: 1rem;
    padding: 1rem 1.5rem;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pr-row-main:hover {
    background-color: var(--primary-light);
}

.pr-info-cell .pr-title a {
    font-weight: 600;
    text-decoration: none;
    color: var(--text-primary);
}

.pr-info-cell .pr-title a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.pr-info-cell .pr-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.pr-info-cell .pr-sub-meta {
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.pr-sub-meta.status-merged-text {
    color: var(--primary-color);
}

.pr-sub-meta.status-closed-text {
    color: var(--danger-color);
}

.pr-author-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pr-author-cell .avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
}

.pr-status-badge {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    border-radius: 9999px;
    text-align: center;
}

.status-merged {
    background-color: #e0e7ff;
    color: var(--primary-color);
}

.status-closed {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-pending,
.status-reopened {
    background-color: #fef3c7;
    color: #92400e;
}

.status-approved {
    background-color: #dcfce7;
    color: #166534;
}

html.dark .status-merged {
    background-color: var(--primary-color);
    color: #e0e7ff;
}

html.dark .status-closed {
    background-color: #9f1239;
    color: #fecaca;
}

html.dark .status-pending,
html.dark .status-reopened {
    background-color: #78350f;
    color: #fef3c7;
}

html.dark .status-approved {
    background-color: #14532d;
    color: #dcfce7;
}

.pr-details-toggle {
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.pr-row.details-expanded .pr-details-toggle {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.pr-row-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    background-color: #f9fafb;
}

html.dark .pr-row-details {
    background-color: #111827;
}

.pr-row.details-expanded .pr-row-details {
    max-height: 1000px;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.detail-section h4 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

.timeline-marker {
    position: absolute;
    left: 0;
    top: 5px;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: var(--border-color);
    border: 2px solid var(--bg-secondary);
}

.timeline-item:last-child .timeline-line {
    display: none;
}

.timeline-line {
    position: absolute;
    left: 5px;
    top: 12px;
    bottom: -8px;
    width: 2px;
    background-color: var(--border-color);
    transform: translateX(-50%);
}

.timeline-item[data-status="merged"] .timeline-marker {
    background-color: var(--primary-light);
}

.timeline-item[data-status="approved"] .timeline-marker {
    background-color: #4ade80;
}

.timeline-item[data-status="created"] .timeline-marker {
    background-color: #9ca3af;
}

.approvals-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.approvals-list .avatar {
    width: 2rem;
    height: 2rem;
}

.approver-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}

.approver-link:hover {
    background-color: var(--primary-light);
}

.approver-link:hover span {
    color: var(--primary-color);
    text-decoration: underline;
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-item .added {
    color: #22c55e;
    font-weight: 600;
}

.stats-item .removed {
    color: #ef4444;
    font-weight: 600;
}

.stats-item .changed {
    color: #0ea5e9;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.metric-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.metric-item svg {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-secondary);
    margin-top: 2px;
    flex-shrink: 0;
}

/* --- WEEKLY GROUPING & COLLAPSE STYLES --- */
.pr-week-group {
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
}

.pr-week-header {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-primary);
    position: relative;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.pr-week-title {
    flex-grow: 1;
}

.pr-week-count {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.75rem;
    border-radius: 9999px;
    margin-right: 1.5rem;
    white-space: nowrap;
}

html.dark .pr-week-count {
    background-color: var(--bg-secondary);
    border-color: #4b5563;
}

.pr-week-group.collapsed .pr-week-header {
    border-bottom-color: transparent;
}

.pr-week-header::after {
    content: '';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    width: 0.75rem;
    height: 0.75rem;
    border-style: solid;
    border-color: var(--text-secondary);
    border-width: 0 2px 2px 0;
    transform: translateY(-50%) rotate(45deg);
    transition: transform 0.3s ease-out;
}

.pr-week-group.collapsed .pr-week-header::after {
    transform: translateY(-50%) rotate(-45deg);
}

.pr-week-group.collapsed .pr-week-content {
    display: none;
}

/* --- ANALYTICS & FEEDBACK --- */
.analytics-filter-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-primary);
    border-radius: 0.75rem;
}

.panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.2s;
}

.panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

html.dark .panel-header {
    background-color: #374151;
}

.panel-title {
    font-weight: 700;
    font-size: 1.15rem;
    flex-grow: 1;
}

.panel-body {
    padding: 1.5rem;
}

.kpi-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.kpi-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    color: #fff;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.kpi-value .added {
    color: #22c55e;
}

.kpi-value .removed {
    color: #ef4444;
}

.spotlight-card .kpi-value {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.spotlight-card .kpi-label {
    font-size: 0.8rem;
}

.spotlight-card .avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
}

.chart-container {
    height: 350px;
}

.chart-container-sm {
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Health Indicator */
.health-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.health-indicator .icon {
    width: 1.5rem;
    height: 1.5rem;
}

.health-indicator.info {
    background-color: #eff6ff;
    color: #3b82f6;
}

html.dark .health-indicator.info {
    background-color: #1e40af;
    color: #bfdbfe;
}

.health-indicator.warning {
    background-color: var(--danger-bg);
    color: var(--danger-color);
}

.health-indicator.success {
    background-color: var(--success-bg);
    color: var(--success-color);
}

/* --- STYLES: Daily Breakdown Weekly Grouping --- */
.daily-week-group {
    margin-bottom: 2rem;
}

.daily-week-group:last-child {
    margin-bottom: 0;
}

.daily-week-header {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 1.5rem 0.75rem 0.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.daily-week-header::after {
    content: '';
    position: absolute;
    right: 0.25rem;
    top: 50%;
    width: 0.5rem;
    height: 0.5rem;
    border-style: solid;
    border-color: var(--text-secondary);
    border-width: 0 2px 2px 0;
    transform: translateY(-50%) rotate(45deg);
    transition: transform 0.3s ease-out;
}

.daily-week-group.collapsed .daily-week-header::after {
    transform: translateY(-50%) rotate(-45deg);
}

.daily-week-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.daily-week-group.collapsed .daily-week-content {
    max-height: 0;
}

/* Daily Breakdown Grid (Now nested inside week groups) */
.daily-breakdown-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}

.day-card {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.day-card:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-4px);
}

.day-card.today {
    border-color: var(--primary-color);
    border-width: 2px;
}

.day-card.today .day-label {
    font-weight: 800;
}

.day-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.day-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
    margin: 0.25rem 0;
}

.day-stats {
    font-size: 0.7rem;
}

.day-stat-item.created {
    color: var(--primary-color);
}

.day-stat-item.merged {
    color: #16a34a;
}

.day-stat-item.approvals {
    color: #0ea5e9;
}

.day-stat-item strong {
    font-weight: 700;
}

/* Chart Tooltip */
.chart-tooltip {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translate(-50%, -120%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    border-radius: 0.5rem;
    padding: 0.75rem;
    transition: opacity 0.2s;
    z-index: 10;
    min-width: 180px;
}

.chart-tooltip-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.chart-tooltip .avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    margin-right: 0.75rem;
}

.chart-tooltip strong {
    font-size: 1.1rem;
}

.chart-tooltip-body {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Styles for PR Types */
.pr-type-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;
}

.pr-type-card {
    transition: background-color 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.pr-type-card:hover {
    background-color: var(--bg-primary);
}

.pr-type-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pr-type-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pr-type-title {
    font-weight: 600;
    color: var(--text-primary);
    flex-grow: 1;
}

.pr-type-bar {
    background-color: var(--border-color);
    border-radius: 999px;
    height: 6px;
    margin-top: 0.25rem;
    overflow: hidden;
}

html.dark .pr-type-bar {
    background-color: #4b5563;
}

.pr-type-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease-out;
}

.pr-type-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.capitalize {
    text-transform: capitalize;
}

/* Collaboration Styles */
.collaboration-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.collaboration-list li:last-child {
    border-bottom: none;
}

.reviewer-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.reviewer-summary a {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reviewer-summary a:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

.reviewer-summary .avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
}

.collaborator-avatar-stack {
    display: flex;
    padding-left: 0.5rem;
}

.collaborator-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    transition: transform 0.2s ease-in-out;
}

.collaborator-avatar-stack a:hover .collaborator-avatar {
    transform: translateY(-3px) scale(1.1);
    z-index: 1;
}

.collaborator-avatar-stack a:not(:first-child) {
    margin-left: -12px;
}

.collaboration-count {
    font-weight: 700;
    color: var(--primary-color);
    text-align: right;
}

/* --- RATINGS TAB STYLES --- */
.ratings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.rating-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: box-shadow 0.3s ease-in-out;
}

.rating-card.expanded {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.rating-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.rating-card:not(.expanded):hover .rating-card-header {
    background-color: var(--primary-light);
}

.rating-card.expanded .rating-card-header {
    border-bottom: 1px solid var(--border-color);
}

.rating-card-header::after {
    content: '';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    width: 0.75rem;
    height: 0.75rem;
    border-style: solid;
    border-color: var(--text-secondary);
    border-width: 0 2px 2px 0;
    transform: translateY(-50%) rotate(45deg);
    /* Default state: Points DOWN (v) */
    transition: transform 0.3s ease-out;
}

.rating-card:not(.expanded) .rating-card-header::after {
    transform: translateY(-50%) rotate(-45deg);
    /* Collapsed state: Points RIGHT (>) */
}

.rating-card-header .avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

.mentee-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mentee-login {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.rating-card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}

.rating-card.expanded .rating-card-details {
    max-height: 2000px;
    /* Large value to allow expansion */
}

.details-wrapper {
    padding: 1.5rem;
    background-color: var(--bg-secondary);
}

.details-grid-ratings {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto auto auto;
    /* Define rows for proper layout */
    gap: 1.5rem;
}

.rating-panel {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

html.dark .rating-panel {
    background-color: var(--bg-secondary);
}

.rating-panel h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-header-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--primary-color);
}

.average-score {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.trend {
    font-weight: 600;
}

.trend-up {
    color: var(--success-color);
}

.trend-down {
    color: var(--danger-color);
}

.tagline {
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 1rem;
}

.chart-container-radar {
    min-height: 200px;
    margin-top: auto;
    /* Pushes chart to bottom */
    padding-top: 1rem;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-item-title {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.category-item-bar {
    height: 8px;
    background-color: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
}

.category-item-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease-out;
}

.comment-notes-panel {
    grid-column: 1 / -1;
    /* Span full width */
}

.comment-notes-list {
    list-style-type: none;
    padding: 0;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 300px;
}

/* Custom Scrollbar */
.comment-notes-list::-webkit-scrollbar {
    width: 8px;
}

.comment-notes-list::-webkit-scrollbar-track {
    background: transparent;
}

.comment-notes-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
    border: 2px solid var(--bg-primary);
}

.comment-notes-list::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

.comment-notes-list li {
    position: relative;
    padding: 0.75rem 1rem 0.75rem 2rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

#ratings-content[dir="rtl"] .comment-notes-list li {
    padding: 0.75rem 2rem 0.75rem 1rem;
}


.comment-notes-list li::before {
    content: '“';
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

#ratings-content[dir="rtl"] .comment-notes-list li::before {
    left: auto;
    right: 0.75rem;
}


.tips-box {
    padding: 1rem;
    background-color: var(--primary-light);
    border-left: 4px solid var(--primary-color);
    border-radius: 0.5rem;
}

.tip-content {
    transition: opacity 0.4s ease-in-out;
}

.tip-content.is-swapping {
    opacity: 0;
}

#ratings-content[dir="rtl"] .tips-box {
    border-left: none;
    border-right: 4px solid var(--primary-color);
}

.tips-box strong {
    color: var(--primary-color);
}

.tips-box p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

html.dark .tips-box {
    color: #c7d2fe;
}

html.dark .tips-box p {
    color: #9ca3af;
}

.full-span {
    grid-column: 1 / -1;
}

/* Feedback Styles */
#feedback-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feedback-topic-card .content-pair {
    display: flex;
    flex-direction: row;
}

.feedback-section {
    width: 50%;
    padding: 1.5rem 2rem;
}

.problem-section {
    background-color: var(--danger-bg);
    border-right: 1px solid var(--danger-color);
}

.solution-section {
    background-color: var(--success-bg);
}

.feedback-section h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.problem-section h3 svg {
    color: var(--danger-color);
}

.solution-section h3 svg {
    color: var(--success-color);
}

.feedback-section .icon {
    width: 1.75rem;
    height: 1.75rem;
}

.feedback-section ul {
    list-style-type: none;
    padding: 0;
    color: var(--text-secondary);
}

.feedback-section li {
    padding-right: 1.5rem;
    position: relative;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.problem-section li::before {
    content: "–";
    position: absolute;
    right: 0;
    color: var(--danger-color);
    font-size: 1.25rem;
    font-weight: bold;
    top: -3px;
}

.solution-section li::before {
    content: "✓";
    position: absolute;
    right: 0;
    color: var(--success-color);
    font-weight: bold;
    top: -1px;
}

.feedback-summary {
    background-color: var(--primary-light);
    color: var(--primary-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    border-left: 4px solid var(--primary-color);
}

#feedback-content[dir="rtl"] .feedback-summary {
    border-left: none;
    border-right: 4px solid var(--primary-color);
}


html.dark .feedback-summary {
    color: #c7d2fe;
}


/* --- GENERAL & RESPONSIVE --- */
.hidden {
    display: none !important;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}

.spinner {
    border: 4px solid rgba(120, 120, 120, 0.2);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (min-width: 768px) {
    .pr-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .pr-table-header {
        display: none;
    }

    /* New mobile layout for PR rows */
    .pr-row-main {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        row-gap: 0.75rem;
        column-gap: 1.25rem;
        padding: 1rem;
    }

    .pr-info-cell {
        flex-grow: 1;
        /* Allow title to take up space */
        flex-basis: 60%;
        /* Ensure it has enough base width */
        order: 1;
        /* Ensure it's the first item */
    }

    .pr-details-toggle {
        order: 2;
        /* Ensure toggle is next */
        margin-left: auto;
        /* Push it to the right */
    }

    .pr-author-cell,
    .pr-status-badge,
    .stats-item {
        order: 3;
        /* These items will wrap to the next line */
    }

    .pr-author-cell {
        gap: 0.5rem;
        /* Reduce gap on mobile */
    }

    .pr-author-cell .avatar {
        width: 1.75rem;
        height: 1.75rem;
    }

    .details-grid-ratings {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }

    .container {
        padding: 1rem;
    }

    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    .main-header h1 {
        font-size: 1.75rem;
        padding: 0;
    }

    .theme-toggle-btn,
    .lang-switcher {
        position: static;
        transform: none;
        margin: 0 auto;
    }

    .lang-switcher {
        margin-bottom: 0.75rem;
    }

    .pr-controls {
        flex-direction: column;
        align-items: stretch;
    }

    #pr-search {
        width: 100%;
        /* Make search bar full width */
    }

    .pr-row.details-expanded .pr-row-details {
        padding: 1.5rem 1rem;
    }

    .collaboration-list li,
    .discussed-prs-list li {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .reviewer-summary,
    .discussed-pr-summary {
        min-width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .collaboration-count,
    .discussed-pr-count {
        width: 100%;
        text-align: right;
    }

    .feedback-topic-card .content-pair {
        flex-direction: column;
    }

    .feedback-section {
        width: 100%;
        padding: 1.5rem 1rem;
    }

    .problem-section {
        border-right: none;
        border-bottom: 1px solid var(--danger-color);
    }

    .pr-week-header {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* --- PROJECTS TAB (MARKDOWN) STYLES --- */
.markdown-body {
    padding: 1rem 1.5rem;
    line-height: 1.7;
}

.projects-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.projects-header-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.projects-header-action:hover {
    color: var(--primary-color);
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

.projects-header-action svg {
    width: 1.1rem;
    height: 1.1rem;
}


.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-body h1 {
    font-size: 2.25rem;
}

.markdown-body h2 {
    font-size: 1.75rem;
}

.markdown-body h3 {
    font-size: 1.25rem;
}

.markdown-body p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.markdown-body a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body ul,
.markdown-body ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    list-style: revert;
    /* Use browser default list styles */
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body code {
    background-color: var(--primary-light);
    color: var(--primary-color);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
    font-family: monospace;
}

.markdown-body pre {
    background-color: var(--bg-primary);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.markdown-body pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

.markdown-body blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.markdown-body th {
    background-color: var(--bg-primary);
    font-weight: 600;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

/* --- KUDOS TAB STYLES --- */
.kudos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.kudos-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kudos-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.kudos-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.kudos-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
}

.kudos-user:hover {
    color: var(--primary-color);
}

.kudos-header .avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    border: 3px solid var(--border-color);
}

.kudos-arrow {
    color: var(--primary-color);
    flex-shrink: 0;
}

.kudos-message {
    flex-grow: 1;
    position: relative;
    padding: 1rem 1rem 1rem 2rem;
    margin-bottom: 1rem;
    background-color: var(--bg-primary);
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary-color);
}

.kudos-message p {
    color: var(--text-secondary);
    font-style: italic;
}

.kudos-message::before {
    content: '“';
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    opacity: 0.5;
}

.kudos-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: auto;
}

/* --- PR DETAILS PARTICIPANTS SECTION --- */
.participants-sections {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.participant-group h5 {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.participants-list {
    display: flex;
    flex-direction: column;
    /* This ensures Assignees and Approvers are listed vertically */
    gap: 0.5rem;
}

/* FIX: Added this rule to correctly size avatars in the Assignee/Approver lists */
.participants-list .avatar {
    width: 2rem;
    height: 2rem;
}

.participants-list.avatar-stack {
    flex-direction: row;
    /* Overrides for the horizontal commenter stack */
    align-items: center;
    flex-wrap: wrap;
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
}

/* Reusing collaborator avatar stack styles for commenters */
.participants-list.avatar-stack a {
    transition: transform 0.2s ease-in-out;
}

.participants-list.avatar-stack a:hover {
    transform: translateY(-3px) scale(1.1);
    z-index: 1;
}

.participants-list.avatar-stack a:not(:first-child) {
    margin-left: -10px;
}

.participants-list.avatar-stack img {
    border: 2px solid var(--bg-secondary);
}

.details-grid {
    /* Adjust grid for potentially 4 columns on large screens */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.commenter-item {
    position: relative;
    display: block;
}

.commenter-count {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-secondary);
}

/* --- Styles for Most Discussed PRs list --- */
.discussed-prs-list {
    list-style: none;
    padding: 0;
}

.discussed-prs-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.discussed-prs-list li:last-child {
    border-bottom: none;
}

.discussed-pr-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-grow: 1;
    min-width: 0;
    /* Crucial for text truncation in flexbox */
}

.discussed-pr-link {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

.discussed-pr-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.discussed-pr-count {
    font-weight: 700;
    color: var(--primary-color);
    flex-shrink: 0;
}

/* --- MEMBERS (ORG CHART) TAB STYLES --- */

#members-content {
    background-color: var(--bg-primary);
    position: relative;
}

/* --- Base container and chart setup --- */
.org-chart-container {
    padding: 0;
    overflow-x: auto;
    border-radius: 0.75rem;
    cursor: grab;
    user-select: none;

    /* Center the content */
    display: flex;
    justify-content: center;

    /* --- HIDE THE SCROLLBAR --- */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* For Chrome, Safari, and Opera */
.org-chart-container::-webkit-scrollbar {
    display: none;
}

.org-chart-container.grabbing {
    cursor: grabbing;
}

.org-chart {
    display: inline-block;
    min-width: max-content;
    /* Changed from 100% to max-content */
    padding: 0;
    transform-origin: top center;
    transition: transform 0.3s ease-out;
    margin: 0 auto;
    /* Center horizontally */
}

/* --- Core Tree Structure (ul/li) --- */
.org-chart ul,
.org-chart li {
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
}

/* Root level UL - ensure it's centered */
.org-chart>ul {
    display: flex;
    justify-content: center;
    padding-top: 20px;
    /* Reduced from 60px for better spacing */
}

/* This creates the vertical space between levels */
.org-chart ul {
    display: flex;
    justify-content: center;
    padding-top: 60px;
}

/* This creates the horizontal space between siblings */
.org-chart li {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 15px;
}

/* --- Connector Lines --- */

/* Vertical line GOING UP from a child to the horizontal bar */
.org-chart li::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 30px;
    background-color: var(--border-color);
}

/* Horizontal line CONNECTING SIBLINGS */
.org-chart li::after {
    content: '';
    position: absolute;
    top: -30px;
    height: 2px;
    width: 100%;
    background-color: var(--border-color);
    left: 0;
}

/* --- Hiding/Adjusting Unnecessary Connectors --- */

/* The very top root node doesn't need any lines above it */
.org-chart>ul>li::before,
.org-chart>ul>li::after {
    display: none;
}

/* A node that is the ONLY child doesn't need a horizontal line */
.org-chart li:only-child::after {
    display: none;
}

/* The FIRST child's horizontal line should only go to the right */
.org-chart li:first-child:not(:only-child)::after {
    left: 50%;
    width: 50%;
}

/* The LAST child's horizontal line should only go to the left */
.org-chart li:last-child:not(:only-child)::after {
    right: 50%;
    width: 50%;
}

/* Vertical line GOING DOWN from a parent */
.has-children>.member-card::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 30px;
    background-color: var(--border-color);
}

html.dark .org-chart li::before,
html.dark .org-chart li::after,
html.dark .has-children>.member-card::after {
    background-color: #374151;
}


/* --- Member Card Styling --- */
.member-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 160px;
    height: 180px;
    position: relative;
    z-index: 10;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
}

.member-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.member-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    object-fit: cover;
}

.member-info {
    text-align: center;
}

.member-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.member-role {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    text-transform: capitalize;
}

.role-mentor {
    background-color: var(--primary-color);
    color: #ffffff;
}

.role-mentee {
    background-color: var(--secondary-color);
    color: #ffffff;
}

/* --- ZOOM CONTROLS STYLES --- */
.zoom-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    backdrop-filter: blur(4px);
}

html.dark .zoom-controls {
    background-color: rgba(31, 41, 55, 0.8);
}


.zoom-controls button {
    width: 36px;
    height: 36px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.zoom-controls button:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

.zoom-controls button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}