/* PXG Feedback Viewer Styles */

.pxg-feedback-wrapper {
    background-color: #333333;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    color: #f4f4f4;
    font-family: 'Inter', 'Roboto', sans-serif;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.pxg-feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #555;
    padding-bottom: 15px;
}

.pxg-feedback-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 1.8rem;
    font-weight: 600;
    font-family: serif;
    /* Match Phoenix header logo text roughly */
}

.pxg-stats-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap; /* Ensure badges wrap on smaller screens */
}

.stat-badge {
    background-color: #ff6600;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(255, 102, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.leader-badge {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    border: 1px solid #ff6600;
    padding: 4px 12px 4px 6px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

.leader-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 102, 0, 0.2);
}

.leader-container {
    position: relative;
    display: inline-flex;
    flex-direction: column;
}

.leader-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    color: #666;
    transition: transform 0.3s ease;
}

.leader-container.expanded .leader-chevron {
    transform: rotate(180deg);
    color: #ff6600;
}

#pxg-global-distribution-popup {
    position: fixed !important;
    z-index: 9999 !important;
    top: -9999px;
    left: -9999px;
    pointer-events: none;
    transform: translateY(-6px);
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, transform 0.25s ease;
}

#pxg-global-distribution-popup.expanded {
    pointer-events: auto;
    transform: translateY(0);
}

.leader-dropdown {
    position: absolute;
    top: calc(100% + 6px); /* Opens downward below the badge */
    left: 0;
    min-width: 220px;
    max-height: 0;
    overflow: hidden;
    background: rgba(30, 30, 30, 0.97);
    border: 1px solid #444;
    border-radius: 12px;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 2000;
    box-sizing: border-box;
}

.leader-container.expanded .leader-dropdown,
#pxg-global-distribution-popup.expanded {
    max-height: 550px; /* Increased for 11+ people */
    overflow-y: auto;
    opacity: 1;
    pointer-events: auto;
    border-color: #ff6600;
}

/* Scrollbar styling for the popup */
#pxg-global-distribution-popup::-webkit-scrollbar {
    width: 6px;
}
#pxg-global-distribution-popup::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 10px;
}
#pxg-global-distribution-popup::-webkit-scrollbar-track {
    background: transparent;
}

/* Restore 14px width for individual 5-pill feedback entries */
.score-pills.individual-pills {
    gap: 4px;
}
.score-pills.individual-pills .pill {
    width: 14px;
}

.leader-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #333;
    transition: background 0.2s ease;
}

.leader-row:last-child {
    border-bottom: none;
}

.leader-row:hover {
    background: rgba(255, 102, 0, 0.1);
}

.leader-rank {
    font-size: 0.7rem;
    font-weight: 800;
    color: #888;
    width: 20px;
}

.leader-row .player-avatar {
    width: 22px;
    height: 22px;
    border: 1px solid #555;
}

.leader-row-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ddd;
    flex: 1;
}

.leader-row-value {
    font-size: 0.8rem;
    font-weight: 800;
    color: #ffd700;
}

.leader-badge .player-avatar {
    width: 28px;
    height: 28px;
    border: 2px solid #ff6600;
}

.leader-badge-content {
    display: flex;
    flex-direction: column;
}

.leader-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #ff6600;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 2px;
}

.leader-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.leader-value {
    color: #ffd700; /* Gold for values */
    font-weight: 800;
    margin-left: 4px;
}

/* DataTables Overrides for Dark Mode */
.pxg-feedback-wrapper table.dataTable tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pxg-feedback-wrapper table.dataTable tbody tr:hover {
    background-color: rgba(255, 102, 0, 0.05) !important;
}

.pxg-feedback-wrapper table.dataTable tbody tr.shown {
    background-color: rgba(255, 102, 0, 0.08) !important;
}

/* Rating Pill Distributions */
.pill-container {
    position: relative;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Removed pill-container:hover to prevent layout thrashing */

.pill-container.active-highlight {
    background: rgba(255, 102, 0, 0.15);
}

.distribution-popup {
    min-width: 200px;
    padding: 10px 0;
}

.distribution-row {
    padding: 6px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.distribution-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #888;
    padding: 0 15px 8px 15px;
    border-bottom: 1px solid #333;
    margin-bottom: 5px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.distribution-score {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ffd700;
    margin-left: auto;
}
.pxg-feedback-wrapper .dataTables_wrapper .dataTables_filter,
.pxg-feedback-wrapper .dataTables_wrapper .dataTables_info,
.pxg-feedback-wrapper .dataTables_wrapper .dataTables_processing,
.pxg-feedback-wrapper .dataTables_wrapper .dataTables_paginate {
    color: #dddddd;
    margin-bottom: 15px;
}

.pxg-feedback-wrapper table.dataTable {
    border-collapse: collapse;
    width: 100% !important;
    background-color: #2b2b2b;
    border-radius: 6px;
    overflow: hidden;
}

.pxg-feedback-wrapper table.dataTable thead th {
    background-color: #1a1a1a;
    color: #ff6600;
    border-bottom: 2px solid #444;
    padding: 12px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    position: relative;
    cursor: pointer;
    white-space: nowrap;
}

/* Hide default DT sort icons */
.pxg-feedback-wrapper table.dataTable thead th.sorting:before,
.pxg-feedback-wrapper table.dataTable thead th.sorting:after,
.pxg-feedback-wrapper table.dataTable thead th.sorting_asc:before,
.pxg-feedback-wrapper table.dataTable thead th.sorting_desc:before {
    display: none !important;
}

/* Custom Sort Labels Base - only for active states */
.pxg-feedback-wrapper table.dataTable thead th.sorting_asc:after,
.pxg-feedback-wrapper table.dataTable thead th.sorting_desc:after {
    display: inline-block !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.62rem;
    margin-left: 8px;
    background: #ff4500;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    text-transform: uppercase;
    font-weight: 800;
    color: #fff;
    border: none;
    opacity: 1;
    position: static;
}

/* Operation, Zeus, PL: A/Z */
.pxg-feedback-wrapper table.dataTable thead th:nth-child(2).sorting_asc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(4).sorting_asc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(5).sorting_asc:after { content: "A-Z"; }

.pxg-feedback-wrapper table.dataTable thead th:nth-child(2).sorting_desc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(4).sorting_desc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(5).sorting_desc:after { content: "Z-A"; }

/* Date: newest/oldest */
.pxg-feedback-wrapper table.dataTable thead th:nth-child(3).sorting_asc:after { content: "Oldest"; }
.pxg-feedback-wrapper table.dataTable thead th:nth-child(3).sorting_desc:after { content: "Newest"; }

/* Linear Feedback Metrics (Fun, Tech, Coord): highest/lowest */
.pxg-feedback-wrapper table.dataTable thead th:nth-child(6).sorting_asc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(7).sorting_asc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(8).sorting_asc:after { content: "Lowest"; }

.pxg-feedback-wrapper table.dataTable thead th:nth-child(6).sorting_desc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(7).sorting_desc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(8).sorting_desc:after { content: "Highest"; }

/* Bell-Curve Feedback Metrics (Pace, Difficulty): best/worst */
.pxg-feedback-wrapper table.dataTable thead th:nth-child(9).sorting_asc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(10).sorting_asc:after { content: "Worst"; }

.pxg-feedback-wrapper table.dataTable thead th:nth-child(9).sorting_desc:after,
.pxg-feedback-wrapper table.dataTable thead th:nth-child(10).sorting_desc:after { content: "Best"; }


.pxg-feedback-wrapper table.dataTable tbody td {
    border-bottom: 1px solid #444;
    padding: 12px;
    background-color: #2b2b2b;
    color: #cccccc;
    vertical-align: middle;
}

.pxg-feedback-wrapper table.dataTable tbody tr:hover td {
    background-color: #3b3b3b;
    color: #ffffff;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Pagination Buttons */
.pxg-feedback-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #dddddd !important;
    border: 1px solid transparent;
    padding: 5px 12px;
    border-radius: 4px;
}

.pxg-feedback-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #444 !important;
    border-color: #555 !important;
    color: white !important;
}

.pxg-feedback-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button.current,
.pxg-feedback-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #ff6600 !important;
    color: white !important;
    border-color: #cc5500 !important;
}

/* Filter Input */
.pxg-feedback-wrapper .dataTables_filter input {
    background-color: #1a1a1a;
    border: 1px solid #555;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    margin-left: 10px;
}

.pxg-feedback-wrapper .dataTables_length select {
    background-color: #1a1a1a;
    border: 1px solid #555;
    color: white;
    padding: 4px;
    border-radius: 4px;
}

/* Custom Visual Upgrades */
.anon-badge {
    color: #999;
    font-style: italic;
    background: #222;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    border: 1px dashed #555;
}

.score-pills {
    display: flex;
    gap: 3px;
    align-items: center;
}

.score-pills .pill {
    width: 12px;
    height: 8px;
    background-color: #444;
    border-radius: 2px;
    display: inline-block;
}

.score-pills .pill.active.pill-color-1 {
    background-color: #ff3b30;
    /* Red */
    box-shadow: 0 0 6px rgba(255, 59, 48, 0.4);
}

.score-pills .pill.active.pill-color-2 {
    background-color: #ff9500;
    /* Orange */
    box-shadow: 0 0 6px rgba(255, 149, 0, 0.4);
}

.score-pills .pill.active.pill-color-3 {
    background-color: #ffcc00;
    /* Yellow */
    box-shadow: 0 0 6px rgba(255, 204, 0, 0.4);
}

.score-pills .pill.active.pill-color-4 {
    background-color: #a4c639;
    /* Light Green */
    box-shadow: 0 0 6px rgba(164, 198, 57, 0.4);
}

.score-pills .pill.active.pill-color-5 {
    background-color: #34c759;
    /* Green */
    box-shadow: 0 0 6px rgba(52, 199, 89, 0.4);
}

.pill-label {
    font-size: 0.65rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bell-curve-gradient {
    width: 100%;
    height: 3px;
    margin-top: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, #ff3b30 0%, #ffcc00 25%, #34c759 50%, #ffcc00 75%, #ff3b30 100%);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* DataTables Child Row Styles */
td.dt-control {
    cursor: pointer;
    text-align: center;
    color: #ff6600;
}

td.dt-control:before {
    content: "\f055";
    /* plus-circle */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 1.1rem;
}

tr.shown td.dt-control:before {
    content: "\f056";
    /* minus-circle */
}

.op-details-panel {
    background: #1a1a1a;
    border-left: 4px solid #ff6600;
    padding: 20px;
    margin: 10px 0;
    border-radius: 0 8px 8px 0;
    color: #eee;
}

.details-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
    font-size: 0.95rem;
}

.details-stats strong {
    color: #ff6600;
}

.details-content {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.details-comments {
    flex: 2;
    min-width: 300px;
}

.details-participants {
    flex: 1;
    min-width: 250px;
}

.op-details-panel h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #ff6600;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.comment-item {
    background: #222;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    border-left: 2px solid #444;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #ddd;
}

.participant-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.participant-pill {
    background: #333;
    color: #bbb;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #444;
}

.participant-pill i {
    margin-right: 5px;
}

@media (max-width: 768px) {
    .details-content {
        flex-direction: column;
        gap: 20px;
    }
}

/* Latest Op Highlight */
.latest-op-row {
    border-left: 4px solid #ff6600 !important;
}

.latest-op-row td:nth-child(2) {
    color: #ff6600 !important;
    font-weight: bold;
}

.latest-op-row td:nth-child(2):after {
    content: "LATEST";
    display: inline-block;
    background: #ff6600;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 10px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

/* Avatar Styles */
.name-with-avatar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    vertical-align: middle;
}

.player-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #333;
    border: 1px solid #555;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, border-color 0.2s ease, opacity 0.3s ease;
    vertical-align: middle;
    opacity: 0.8; /* Slightly faded for initials */
}

.player-avatar.has-pfp {
    opacity: 1;
    border-color: #666;
}

.player-avatar:hover {
    transform: scale(1.2);
    border-color: #ff6600;
    z-index: 10;
}

.comment-item .player-avatar {
    width: 28px;
    height: 28px;
}

.participant-pill .player-avatar {
    width: 18px;
    height: 18px;
    margin-right: -4px;
    margin-left: -4px;
}

.participant-pill {
    display: inline-flex;
    align-items: center;
    padding-left: 6px;
    gap: 8px;
}

/* Password Protection UI */
.pxg-auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 350px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 12px;
    margin: 40px auto;
    max-width: 500px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5);
    font-family: 'Inter', sans-serif;
}

.pxg-auth-box {
    text-align: center;
    padding: 40px;
    width: 100%;
}

.auth-icon {
    font-size: 3rem;
    color: #ff6600;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(255, 102, 0, 0.4));
}

.pxg-auth-box h3 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.pxg-auth-box p {
    color: #999;
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.pxg-auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pxg-auth-form input[type="password"] {
    background: #2b2b2b;
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    padding: 12px 15px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    text-align: center;
}

.pxg-auth-form input[type="password"]:focus {
    border-color: #ff6600;
    outline: none;
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.2);
}

.auth-btn {
    background: #ff6600;
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.auth-btn:hover {
    background: #ff8533;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 102, 0, 0.4);
}

.auth-error {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-top: 15px;
    border: 1px solid rgba(255, 59, 48, 0.3);
}

/* Pending Feedback Styles */
.pending-feedback-container {
    position: relative;
    width: 0;
    height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pending-feedback-note {
    position: absolute;
    white-space: nowrap;
    background: rgba(255, 102, 0, 0.1);
    color: #ff6600;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px dashed rgba(255, 102, 0, 0.3);
    pointer-events: none;
    z-index: 5;
    left: 50%;
    transform: translateX(-50%);
}

.pending-placeholder {
    color: #444;
    font-weight: bold;
}

.pxg-feedback-wrapper table.dataTable tbody tr.pending-op-row td {
    background-color: rgba(0, 0, 0, 0.1) !important;
}