/*
    EVE Target Intel - Results Display and Cards
    
    Copyright (C) 2025 moregh (https://github.com/moregh/)
    Licensed under AGPL License.
*/

.results-section {
    opacity: 0;
    transform: translateY(27px);
    transition: all 0.54s ease;
    position: relative;
    z-index: 50;
    display: none
}

.results-section.show {
    opacity: 1;
    transform: translateY(0);
    display: block
}

.stats-dashboard {
    padding: 0.8rem 2rem;
    margin-bottom: 1rem
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.8rem
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--white-02);
    border-radius: 13.5px;
    border-left: 3.6px solid;
    transition: all var(--transition-normal) ease
}

.stat-card:hover {
    transform: translateY(-2px);
    background: var(--white-05)
}

.stat-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 9px currentColor)
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    display: block
}

.stat-label {
    font-size: 0.81rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.045em
}

.stat-sublabel {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.2rem;
    line-height: 1
}

.total-stat,
.total-stat .stat-number {
    border-left-color: var(--primary-color);
    color: var(--primary-color)
}

.eligible-stat,
.eligible-stat .stat-number {
    border-left-color: var(--secondary-color);
    color: var(--secondary-color)
}

.ineligible-stat,
.ineligible-stat .stat-number {
    border-left-color: var(--danger-color);
    color: var(--danger-color)
}

.performance-stat,
.performance-stat .stat-number {
    border-left-color: var(--warning-color);
    color: var(--warning-color)
}

.api-stat,
.api-stat .stat-number {
    border-left-color: var(--primary-color);
    color: var(--primary-color)
}

.alliance-stat,
.alliance-stat .stat-number {
    border-left-color: var(--warning-color);
    color: var(--warning-color)
}

.corporation-stat,
.corporation-stat .stat-number {
    border-left-color: var(--danger-color);
    color: var(--danger-color)
}

.cache-stat,
.cache-stat .stat-number {
    border-left-color: var(--secondary-color);
    color: var(--secondary-color)
}


.results-container {
    display: flex;
    flex-direction: column;
    gap: 2rem
}

.tabbed-results-container {
    padding: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
    min-width: 0;
}

.tabs-header {
    display: flex;
    align-items: flex-end;
    padding: 0;
    background: var(--white-02);
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.tabs-nav {
    display: flex;
    gap: 0;
    flex: 1;
}

.tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem 0.8rem 1.5rem;
    background: var(--white-03);
    border: 2px solid var(--border-color);
    border-bottom: none;
    border-radius: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium) ease;
    position: relative;
    margin-right: -1px;
    z-index: 1;
    flex: 1;
}

.tab-btn:first-child {
    margin-left: 0;
    border-top-left-radius: 18px;
}

.tab-btn:last-child {
    margin-right: 0;
    border-top-right-radius: 18px;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    transition: background 0.3s ease;
}

.tab-btn:hover {
    background: var(--white-08);
    border-color: var(--white-3);
    color: var(--text-primary);
    transform: translateY(-2px);
    z-index: 2;
}

.tab-btn:hover::after {
    background: var(--white-3);
}

.tab-btn.active {
    background: var(--white-08);
    border-color: var(--primary-color);
    color: var(--primary-color);
    z-index: 3;
    box-shadow: 0 0 20px rgba(64, 168, 255, 0.2);
}

.tab-btn.active::after {
    background: var(--white-08);
}

.tab-btn.active:hover {
    transform: translateY(-1px);
    color: var(--primary-light);
    border-color: var(--primary-light);
    box-shadow: 0 0 25px rgba(64, 168, 255, 0.3);
}

.tab-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 4px currentColor);
}

.tab-label {
    font-weight: 600;
}

.tab-count {
    background: var(--white-2);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-large);
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 1.5rem;
    text-align: center;
}

.tab-btn.active .tab-count {
    background: var(--white-3);
}



.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Alliance and Corporation specific grid styles - Override any conflicting summary styles */
.tab-content .result-grid.alliance-grid,
.tab-content .result-grid.corporation-grid,
.result-grid.alliance-grid,
.result-grid.corporation-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 1.35rem !important;
    padding: 1.8rem;
    flex-direction: unset !important;
    align-items: unset !important;
    /* Let the JavaScript handle height and overflow for scrolling */
    contain: layout style paint;
    overflow-anchor: none;
}

/* Entity Card Styles (for corporations and alliances) */
.alliance-grid .entity-card,
.corporation-grid .entity-card,
.entity-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 1rem;
    background: var(--white-03);
    border-radius: 13.5px;
    padding: 1.35rem;
    border-left: 3.6px solid var(--secondary-color);
    transition: all var(--transition-normal) ease;
    animation: slideIn 0.45s ease forwards;
    position: relative;
    overflow: hidden;
    min-height: 120px;
    width: 100%;
    box-sizing: border-box;
    will-change: transform, opacity;
    transform: translateZ(0);
    contain: layout style paint;
}

.corporation-card {
    border-left-color: var(--danger-color);
}

.alliance-card {
    border-left-color: var(--warning-color);
}

.entity-card:hover {
    transform: translateY(-4.5px) translateZ(0);
    background: var(--white-08);
    box-shadow: 0 9px 27px rgba(0, 0, 0, 0.2);
    contain: layout;
    will-change: transform;
}

.entity-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.entity-logo {
    width: 64px;
    height: 64px;
    border-radius: 10.8px;
    object-fit: cover;
    border: 1.8px solid var(--white-1);
    background: var(--gradient-highlight);
    transition: all var(--transition-normal) ease;
    flex-shrink: 0;
    contain: layout;
    transform: translateZ(0);
}

.entity-card:hover .entity-logo {
    border-color: var(--white-2);
    transform: scale(1.05);
}

.entity-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.entity-name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.entity-type-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 4px currentColor);
    flex-shrink: 0;
}

.corporation-card .entity-name {
    color: var(--danger-color);
}

.alliance-card .entity-name {
    color: var(--warning-color);
}

.entity-name a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.18s ease;
    position: relative;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.entity-name a::after {
    content: '';
    position: absolute;
    bottom: -1.8px;
    left: 0;
    width: 0;
    height: 1.8px;
    background: var(--primary-color);
    transition: width var(--transition-normal) ease;
}

.entity-name a:hover {
    color: var(--primary-light);
}

.entity-name a:hover::after {
    width: 100%;
}

.entity-details {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.entity-count {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
}

.count-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
    background: rgba(74, 222, 128, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-medium);
    min-width: 2rem;
    text-align: center;
}

.count-label {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

/* Entity logo image loading states */
.entity-logo:not([src]),
.entity-logo:not([src*="https"]) {
    opacity: 0.3;
}

.entity-logo[src*="https"] {
    opacity: 1;
}

/* Backward compatibility for old summary items if still used elsewhere */
.alliance-grid .summary-item,
.corporation-grid .summary-item {
    background: var(--white-03);
    border-radius: 13.5px;
    padding: 1.35rem;
    border-left: 3.6px solid var(--secondary-color);
    transition: all var(--transition-normal) ease;
    animation: slideIn 0.45s ease forwards;
    position: relative;
    overflow: hidden;
    min-height: 4rem;
    will-change: transform, opacity;
    transform: translateZ(0);
    contain: layout style paint;
}

.corporation-grid .summary-item {
    border-left-color: var(--danger-color);
}

.alliance-grid .summary-item:hover,
.corporation-grid .summary-item:hover {
    transform: translateY(-4.5px) translateZ(0);
    background: var(--white-08);
    box-shadow: 0 9px 27px rgba(0, 0, 0, 0.2);
    contain: layout;
    will-change: transform;
}

.result-column {
    padding: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
    min-width: 0
}

.result-column.full-width {
    flex: 1;
    max-width: 100%;
}

/* War Eligibility Badges */
.war-eligible-badge {
    display: inline-block;
    background: var(--gradient-war);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-medium);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 6px;
    box-shadow: 0 2px 6px rgba(255, 71, 87, 0.3);
    border: 1px solid var(--white-2);
    animation: warPulse 2s infinite;
    vertical-align: middle;
}

@keyframes warPulse {
    0%, 100% {
        box-shadow: 0 2px 6px rgba(255, 71, 87, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 2px 10px rgba(255, 71, 87, 0.5);
        transform: scale(1.05);
    }
}

/* Highlight war-eligible items */
.result-item.war-eligible {
    border: 1px solid rgba(255, 71, 87, 0.3);
    background: var(--gradient-war-subtle);
}

.column-header {
    padding: 1rem 1.8rem;
    border-bottom: 0.9px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white-02)
}

.column-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0
}

.eligible .column-header h3 {
    color: var(--secondary-color)
}

.ineligible .column-header h3 {
    color: var(--danger-color)
}

.status-icon {
    font-size: 1.17rem;
    filter: drop-shadow(0 0 4.5px currentColor)
}

.column-controls {
    display: flex;
    gap: 0.8rem
}

.result-grid {
    padding: 1.8rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
    gap: 1.35rem;
    min-height: 180px;
    transition: all var(--transition-normal) ease;
    contain: layout style paint;
    overflow-anchor: none;
}

.result-grid.list-view {
    grid-template-columns: 1fr
}

.result-grid.list-view .result-item {
    max-width: none
}

.result-item {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    background: var(--white-03);
    border-radius: 13.5px;
    padding: 1.35rem;
    border-left: 3.6px solid;
    transition: all var(--transition-normal) ease;
    animation: slideIn 0.45s ease forwards;
    opacity: 0;
    transform: translateY(18px);
    position: relative;
    overflow: hidden;
    min-height: 4rem;
    will-change: transform, opacity;
    transform: translateZ(0);
    contain: layout style paint;
}

.result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-transparent);
    opacity: 0;
    transition: opacity var(--transition-normal) ease;
    pointer-events: none
}

.result-item:hover {
    transform: translateY(-4.5px) translateZ(0);
    background: var(--white-08);
    box-shadow: 0 9px 27px rgba(0, 0, 0, 0.2);
    contain: layout;
    will-change: transform;
}

.result-item:hover::before {
    opacity: 1;
    pointer-events: none
}

.eligible .result-item {
    border-left-color: var(--secondary-color)
}

.ineligible .result-item {
    border-left-color: var(--danger-color)
}

.result-item.list-view {
    flex-direction: row;
    align-items: center;
    gap: 1.35rem;
    padding: 0.8rem 1.35rem;
    min-height: 90px;
}

.character-avatar {
    flex-shrink: 0;
    width: 57.6px;
    height: 57.6px;
    border-radius: 10.8px;
    object-fit: cover;
    border: 1.8px solid var(--white-1);
    transition: all var(--transition-normal) ease;
    background: var(--gradient-highlight);
    contain: layout;
    transform: translateZ(0);
    transition: opacity 0.2s ease;
}

.result-item:hover .character-avatar {
    border-color: var(--white-2);
    transform: scale(1.05)
}

.list-view .character-avatar {
    width: 43.2px;
    height: 43.2px
}

.character-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.character-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
}

.character-name {
    font-size: 0.99rem;
    font-weight: 600;
    line-height: 1.2;
    min-height: 1.2em;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.eligible .character-name {
    color: var(--secondary-color)
}

.ineligible .character-name {
    color: var(--danger-color)
}

.character-name a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.18s ease;
    position: relative
}

.character-name a::after {
    content: '';
    position: absolute;
    bottom: -1.8px;
    left: 0;
    width: 0;
    height: 1.8px;
    background: var(--primary-color);
    transition: width var(--transition-normal) ease
}

.character-name a:hover {
    color: var(--primary-light)
}

.character-name a:hover::after {
    width: 100%
}

.character-details {
    font-size: 0.81rem;
    color: var(--text-secondary);
    line-height: 1.26;
}

.corp-alliance-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-height: auto;
}

.list-view .corp-alliance-info {
    flex-direction: row;
    gap: 0.9rem;
    align-items: center;
    min-height: auto;
}

.org-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: auto;
    flex-shrink: 0;
}

.org-logo {
    width: 21.6px;
    height: 21.6px;
    border-radius: 3.6px;
    object-fit: cover;
    border: 0.9px solid var(--white-1);
    background: var(--gradient-highlight);
    transition: opacity 0.3s ease;
    flex-shrink: 0;
    contain: layout;
    transform: translateZ(0);
}

.character-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.18s ease;
    font-weight: 500
}

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

.character-avatar:not([src]),
.org-logo:not([src]) {
    opacity: 0.5
}

.character-avatar:not([src*="https"]),
.org-logo:not([src*="https"]) {
    opacity: 0.3;
}

.character-avatar[src*="https"],
.org-logo[src*="https"] {
    opacity: 1;
}


.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.7rem 1.8rem;
    color: var(--text-muted);
    min-height: 180px
}

.no-results-icon {
    font-size: 2.7rem;
    margin-bottom: 0.9rem;
    opacity: 0.5
}

.no-results-text {
    font-size: 0.99rem;
    font-style: italic
}