/* Modals CSS - Modal overlay and content styles */

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.visible {
    display: flex;
}

/* Modal content */
.modal-content {
    background: linear-gradient(145deg, var(--bg-dark-5) 0%, var(--bg-dark-3) 100%);
    border: 1px solid rgba(66, 99, 235, 0.3);
    border-radius: 12px;
    max-width: 900px;
    height: 80vh;
    width: 90%;
    overflow: hidden;
    padding: 30px;
    position: relative;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(66, 99, 235, 0.1);
    display: flex;
    flex-direction: column;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--text-primary);
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(66, 99, 235, 0.3);
}

/* Modal close button */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Modal body */
#modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Loading state */
.modal-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Zone modal (compact) */
.modal-overlay.zone-modal .modal-content {
    height: auto;
    max-height: 80vh;
    max-width: 450px;
    overflow-y: auto;
}

/* Modal table styles (shared by partials) */
.modal-table {
    width: 100%;
    border-collapse: collapse;
}

.modal-table th,
.modal-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-table td.n {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.modal-table th {
    background: rgba(66, 99, 235, 0.15);
    color: var(--text-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(66, 99, 235, 0.3);
}

.modal-table tbody tr {
    background: transparent;
    transition: background 0.2s ease;
}

.modal-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.modal-table tbody tr:hover {
    background: rgba(66, 99, 235, 0.1);
}

.modal-table td {
    color: var(--text-secondary);
}

/* Players table - compact padding */
.modal-table.players th,
.modal-table.players td {
    padding: 10px 8px;
}

/* Fixed rank column width */
.modal-table .col-rank {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    text-align: center !important;
}

/* Sortable column headers */
th[data-sort-key] {
    cursor: pointer;
    user-select: none;
}

th[data-sort-key]:hover {
    background: rgba(66, 99, 235, 0.25);
}

th[data-sort-key]::before {
    font-size: 10px;
    margin-right: 4px;
    opacity: 0.4;
    content: '\2195';
}

th[data-sort-key].sort-asc::before {
    content: '\2191';
    opacity: 1;
}

th[data-sort-key].sort-desc::before {
    content: '\2193';
    opacity: 1;
}

/* Icon headers - centered with tooltip */
.modal-table th.col-icon {
    text-align: center;
    cursor: help;
    position: relative;
}

.modal-table th.col-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1d23;
    color: #e2e8f0;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.modal-table th.col-icon:hover::after,
.modal-table th.col-icon.tooltip-active::after {
    opacity: 1;
}

/* Value cell tooltips */
.modal-table td[data-tooltip] {
    position: relative;
    cursor: help;
}

.modal-table td[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1d23;
    color: #e2e8f0;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.modal-table td[data-tooltip]:hover::after,
.modal-table td[data-tooltip].tooltip-active::after {
    opacity: 1;
}

/* Player name links */
.modal-table td a {
    color: inherit;
    text-decoration: none;
}

.modal-table td a:hover {
    color: #fbbf24;
    text-decoration: none;
}

/* Player rankings - podium colors (only for players table) */
.modal-table.players tbody tr:first-child td {
    color: #fbbf24;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.modal-table.players tbody tr:nth-child(2) td {
    color: #94a3b8;
}

.modal-table.players tbody tr:nth-child(3) td {
    color: #cd7c32;
}

/* Ejected pilots table header */
.modal-table.ejected th {
    background: rgba(230, 126, 34, 0.15);
    border-bottom: 1px solid rgba(230, 126, 34, 0.3);
}

.modal-table.ejected tbody tr:hover {
    background: rgba(230, 126, 34, 0.1);
}

/* Reset podium colors for ejected table */
.modal-table.ejected tbody tr:first-child td,
.modal-table.ejected tbody tr:nth-child(2) td,
.modal-table.ejected tbody tr:nth-child(3) td {
    color: var(--text-secondary);
    font-weight: normal;
    text-shadow: none;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

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

.tab-btn.blue.active {
    color: var(--color-blue);
    border-bottom-color: var(--color-blue);
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.4);
}

.tab-btn.neutral.active {
    color: var(--color-neutral);
    border-bottom-color: var(--color-neutral);
}

.tab-btn.red.active {
    color: var(--color-red);
    border-bottom-color: var(--color-red);
    text-shadow: 0 0 10px rgba(248, 113, 113, 0.4);
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.tab-btn.blue .tab-badge {
    background: linear-gradient(145deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    box-shadow: 0 2px 8px rgba(66, 99, 235, 0.4);
}

.tab-btn.neutral .tab-badge {
    background: linear-gradient(145deg, var(--color-neutral-dark) 0%, #4b5563 100%);
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.4);
}

.tab-btn.red .tab-badge {
    background: linear-gradient(145deg, var(--color-red-dark) 0%, var(--color-danger-dark) 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.tab-content {
    display: none;
}

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

/* Modal header (fixed) */
.modal-header-fixed {
    flex-shrink: 0;
}

/* Scrollable tab content */
.tab-content-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Container flex layout */
.zones-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Progress bar */
.progress-container {
    margin-bottom: 24px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-value {
    font-size: 14px;
    color: var(--color-blue);
    font-weight: 600;
}

.progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-blue) 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.running {
    background: linear-gradient(145deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

.status-badge.stopped {
    background: rgba(107, 114, 128, 0.3);
    color: #9ca3af;
}

/* Type badges */
.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.type-badge.escort {
    background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.type-badge.attack {
    background: linear-gradient(145deg, var(--color-red-dark) 0%, var(--color-danger-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Ejected header */
.ejected-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.ejected-header i {
    color: var(--color-warning);
    font-size: 24px;
}

.ejected-header h2 {
    margin: 0;
}

.coords {
    font-family: monospace;
    font-size: 12px;
}

/* Pilot modal */
.pilot-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.pilot-modal-header i {
    font-size: 24px;
}

.pilot-modal-header h2 {
    margin: 0;
}

.pilot-coords {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.pilot-coords h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #888;
    text-transform: uppercase;
}

.pilot-coords-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-family: monospace;
}

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

.pilot-coords-label {
    color: #888;
}

.pilot-coords-value {
    color: var(--text-primary);
}
