:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --res-color: #00c2ff;
    --enl-color: #03dc03;
    --neu-color: #ffce00;
    --mac-color: #eb2222;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.glass-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.5rem;
}

h1 {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(to right, #60a5fa, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

nav {
    display: flex;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

nav button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

nav button.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
}

.pulse {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

main {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.view.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

/* Map View */
#map {
    width: 100%;
    height: 100%;
    background-color: #0f172a;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.map-overlay {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    z-index: 1000;
    padding: 1.25rem;
    min-width: 300px;
}

.map-overlay h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
}

.stat-item.res .value { color: var(--res-color); }
.stat-item.enl .value { color: var(--enl-color); }
.stat-item.neu .value { color: var(--neu-color); }

.stat-item .label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.stat-item .value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* COMM View */
.comm-container {
    margin: 1rem auto;
    max-width: 800px;
    height: calc(100% - 2rem);
    display: flex;
    flex-direction: column;
}

.comm-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comm-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.comm-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#comm-radius-select {
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(15deg);
}

.comm-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.comm-list::-webkit-scrollbar {
    width: 8px;
}

.comm-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

.comm-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.comm-item {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.comm-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.comm-item:last-child {
    border-bottom: none;
}

.comm-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.comm-player {
    font-weight: 600;
}

.comm-player-clickable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.comm-player-clickable:hover {
    text-decoration-style: solid;
}

.player-RESISTANCE { color: var(--res-color); }
.player-ENLIGHTENED { color: var(--enl-color); }
.player-MAC { color: var(--mac-color); }

.team-res { color: var(--res-color); }
.team-enl { color: var(--enl-color); }
.team-mac { color: var(--mac-color); }
.team-neu { color: var(--neu-color); }

.comm-message {
    font-size: 0.9rem;
    line-height: 1.5;
}

.comm-portal {
    color: var(--accent-hover);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Leaflet Dark Theme Overrides */
.leaflet-container {
    background: #0f172a;
}
.leaflet-bar a {
    background-color: var(--panel-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--panel-border) !important;
}
.leaflet-bar a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Custom Location & Home Control */
.custom-location-control {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    margin-bottom: 10px !important;
}

.custom-location-control a {
    font-size: 1.1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    user-select: none;
}

.custom-location-control a:hover {
    transform: scale(1.08);
    background-color: rgba(59, 130, 246, 0.25) !important;
}

.location-link {
    color: #38bdf8;
    font-weight: 600;
    text-decoration: underline;
    word-break: break-all;
    overflow-wrap: anywhere;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.location-link:hover {
    color: #60a5fa;
}

/* Intel Toast Notification */
.intel-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.intel-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--panel-bg) !important;
    color: var(--text-primary) !important;
    backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
}
.leaflet-popup-content h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}
.leaflet-popup-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Portal Search Layout */
.search-layout {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    height: 100%;
    overflow: hidden;
}

.search-sidebar {
    width: 380px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    height: 100%;
}

.search-box {
    position: relative;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-box input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    padding: 0.75rem 2.2rem 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.search-box input:focus {
    border-color: var(--accent);
}

.search-box button {
    background: var(--accent);
    border: none;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.search-box button:hover {
    background: var(--accent-hover);
}

.search-input-container {
    position: relative;
    flex: 1;
    display: flex;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    font-size: 1.3rem !important;
    padding: 0 !important;
    cursor: pointer;
    box-shadow: none !important;
    z-index: 10;
    transition: color 0.2s, transform 0.2s;
    width: auto !important;
    height: auto !important;
}

.search-clear-btn:hover {
    color: var(--accent) !important;
    background: transparent !important;
}

.search-clear-btn.hidden {
    display: none;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--panel-border);
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
}

.autocomplete-dropdown.hidden {
    display: none;
}

.autocomplete-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.selected {
    background: rgba(255, 255, 255, 0.1);
}

.search-results-container {
    flex: 1;
    overflow-y: auto;
}

.search-results-container::-webkit-scrollbar {
    width: 6px;
}

.search-results-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.search-results-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
}

.fav-star-btn {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    transition: color 0.15s ease, transform 0.15s ease, background 0.15s ease;
    z-index: 2;
}

.fav-star-btn:hover {
    color: #fbbf24;
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.15);
}

.fav-star-btn.is-favorited {
    color: #fbbf24;
}

.fav-star-btn.detail-fav-btn {
    position: static;
    font-size: 1.4rem;
    margin-left: 0.6rem;
    vertical-align: middle;
}

.favorites-columns {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
}

.favorites-column {
    flex: 1;
    max-width: 550px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    height: 100%;
    min-width: 0;
}

.favorites-column h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.search-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent);
}

.search-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.search-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.search-item-level {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.search-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.faction-RESISTANCE { color: var(--res-color); font-weight: 600; }
.faction-ENLIGHTENED { color: var(--enl-color); font-weight: 600; }
.faction-MAC { color: var(--mac-color); font-weight: 600; }
.faction-ENLIGHTENED { color: var(--enl-color); font-weight: 600; }
.faction-NEUTRAL { color: var(--text-secondary); }

.placeholder-text, .detail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.detail-placeholder h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Detail Panel */
.detail-panel {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    max-width: 900px;
    margin: 0 auto;
}

.detail-panel::-webkit-scrollbar {
    width: 8px;
}

.detail-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.detail-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 1.5rem;
    gap: 1.5rem;
}

.detail-title-area h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.detail-subtitle {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.badge {
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    color: white;
}

.badge.L1 { background: #fe0303; }
.badge.L2 { background: #ff5504; }
.badge.L3 { background: #ffaa02; }
.badge.L4 { background: #e0e002; color: black; }
.badge.L5 { background: #96ea02; color: black; }
.badge.L6 { background: #02e602; color: black; }
.badge.L7 { background: #02e6a9; color: black; }
.badge.L8 { background: #028fff; }

.detail-links {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-link:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: var(--text-secondary);
}

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.info-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.info-card.full-width {
    grid-column: span 2;
}

.info-card h4 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.info-card p {
    font-size: 1rem;
    font-weight: 500;
    word-break: break-all;
}

.info-card .owner-name {
    font-weight: 600;
}

/* History Timeline */
.history-timeline-section {
    margin-top: 1rem;
}

.history-timeline-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.timeline {
    position: relative;
    padding-left: 1.75rem;
    border-left: 2px solid var(--panel-border);
    margin-left: 0.5rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.75rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: calc(-1.75rem - 7px);
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 2.5px solid var(--accent);
    z-index: 2;
    transition: all 0.2s ease;
}

.timeline-item.faction-RESISTANCE::before { border-color: var(--res-color); }
.timeline-item.faction-ENLIGHTENED::before { border-color: var(--enl-color); }
.timeline-item.faction-MAC::before { border-color: var(--mac-color); }
.timeline-item.faction-NEUTRAL::before { border-color: var(--text-secondary); }

.timeline-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.timeline-tag {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
}

.timeline-tag.type-history {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-hover);
}

.timeline-tag.type-comm {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* Flip Card Badges (ADA / Jarvis) */
.flip-badge {
    display: inline-block;
    font-size: 0.725rem;
    font-weight: 700;
    padding: 0.12rem 0.4rem;
    border-radius: 0.25rem;
    margin: 0 0.3rem;
    letter-spacing: 0.04em;
    vertical-align: middle;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.flip-badge.badge-ada {
    background: rgba(220, 38, 38, 0.25);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.6);
    text-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.flip-badge.badge-jarvis {
    background: rgba(147, 51, 234, 0.25);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.6);
    text-shadow: 0 0 6px rgba(168, 85, 247, 0.4);
}

.timeline-content {
    font-size: 0.925rem;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.timeline-content .player-name {
    font-weight: 600;
}

/* ==========================================
   Active Players Map Sidebar & Markers Styling
   ========================================== */

/* Active Players Map Sidebar */
.map-sidebar {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    width: 320px;
    height: calc(100% - 4rem);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    overflow: visible;
}

.map-sidebar.collapsed {
    transform: translateX(calc(100% + 2rem));
}

.toggle-sidebar-btn {
    position: absolute;
    left: -48px;
    top: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 1rem 0 0 1rem;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-right: none;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s;
    outline: none;
}

.toggle-sidebar-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.toggle-sidebar-btn .toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.map-sidebar.collapsed .toggle-sidebar-btn .toggle-icon {
    transform: rotate(180deg);
}

.toggle-sidebar-btn .badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    border-radius: 0.5rem;
    background: var(--accent);
    color: white;
    font-weight: 700;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--panel-border);
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-list::-webkit-scrollbar {
    width: 6px;
}

.sidebar-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.10);
    border-radius: 3px;
}

.no-players {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.9rem;
}

.player-item {
    padding: 0.85rem;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.player-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.player-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.player-item-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.player-item-msg {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Active Player Radar Markers on Leaflet Map */
.player-marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

.player-marker::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    animation: pulse-radar 1.5s infinite ease-out;
    opacity: 0;
}

.player-marker-res {
    background-color: var(--res-color);
}

.player-marker-res::after {
    border: 2px solid var(--res-color);
}

.player-marker-enl {
    background-color: var(--enl-color);
}

.player-marker-enl::after {
    border: 2px solid var(--enl-color);
}

.player-marker-neu {
    background-color: #94a3b8;
}

.player-marker-neu::after {
    border: 2px solid #94a3b8;
}

.player-marker-mac {
    background-color: var(--mac-color);
}

.player-marker-mac::after {
    border: 2px solid var(--mac-color);
}

@keyframes pulse-radar {
    0% {
        transform: scale(0.6);
        opacity: 0.8;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

/* IITC Player Tracker Style Markers on Leaflet Map */
.iitc-player-marker {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: opacity 0.3s ease, transform 0.2s ease;
    pointer-events: auto;
    cursor: pointer;
}

.iitc-player-marker:hover {
    transform: scale(1.12);
    z-index: 9999 !important;
}

.iitc-teardrop-wrap {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.iitc-teardrop-svg {
    width: 36px;
    height: 36px;
    overflow: visible;
    filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, 0.7));
}

.iitc-teardrop-path {
    transition: fill 0.2s ease, stroke 0.2s ease;
}

.player-marker-res .iitc-teardrop-path {
    fill: rgba(0, 136, 204, 0.85);
    stroke: #00c8ff;
    stroke-width: 1.6;
}

.player-marker-enl .iitc-teardrop-path {
    fill: rgba(43, 118, 27, 0.85);
    stroke: #03dc00;
    stroke-width: 1.6;
}

.player-marker-neu .iitc-teardrop-path {
    fill: rgba(100, 116, 139, 0.85);
    stroke: #cbd5e1;
    stroke-width: 1.6;
}

.player-marker-mac .iitc-teardrop-path {
    fill: rgba(194, 24, 91, 0.85);
    stroke: #ff4081;
    stroke-width: 1.6;
}

.iitc-teardrop-text {
    font-size: 12px;
    font-weight: 700;
    font-family: system-ui, -apple-system, sans-serif;
    fill: #ffffff;
    text-anchor: middle;
    dominant-baseline: central;
}

/* Pulse ring for active events within 15 minutes */
.iitc-marker-pulse {
    position: absolute;
    top: 10px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    animation: pulse-radar 1.5s infinite ease-out;
    pointer-events: none;
}

.player-marker-res .iitc-marker-pulse { border: 2px solid var(--res-color, #00c8ff); }
.player-marker-enl .iitc-marker-pulse { border: 2px solid var(--enl-color, #03dc00); }
.player-marker-neu .iitc-marker-pulse { border: 2px solid #94a3b8; }
.player-marker-mac .iitc-marker-pulse { border: 2px solid var(--mac-color, #ff0055); }

/* Player Tag pill next to marker */
.iitc-player-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 2px 7px 2px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    color: #f8fafc;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.player-marker-res .iitc-player-tag { border-color: rgba(0, 200, 255, 0.5); }
.player-marker-enl .iitc-player-tag { border-color: rgba(3, 220, 0, 0.5); }
.player-marker-neu .iitc-player-tag { border-color: rgba(148, 163, 184, 0.5); }
.player-marker-mac .iitc-player-tag { border-color: rgba(255, 0, 85, 0.5); }

.iitc-player-name {
    font-weight: 700;
}

.player-marker-res .iitc-player-name { color: var(--res-color, #00c8ff); }
.player-marker-enl .iitc-player-name { color: var(--enl-color, #03dc00); }
.player-marker-neu .iitc-player-name { color: #cbd5e1; }
.player-marker-mac .iitc-player-name { color: var(--mac-color, #ff0055); }

.iitc-player-time {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 4px;
    border-radius: 4px;
}

/* Leaflet Map Flip Event Markers */
.player-marker.flip-marker {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.flip-marker-inner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.8), 0 0 10px currentColor;
    position: relative;
    z-index: 10;
    transition: transform 0.2s ease;
}

.flip-marker:hover .flip-marker-inner {
    transform: scale(1.25);
}

.flip-marker.flip-ada .flip-marker-inner {
    background: linear-gradient(135deg, #ef4444, #991b1b);
    border: 2px solid #f87171;
    color: #ffffff;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.9);
}

.flip-marker.flip-jarvis .flip-marker-inner {
    background: linear-gradient(135deg, #a855f7, #581c87);
    border: 2px solid #c084fc;
    color: #ffffff;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.9);
}

/* Pulsing Sonar Ring for Map Flip Event */
.flip-pulse-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    pointer-events: none;
    animation: flipPulse 2s infinite ease-out;
}

.flip-marker.flip-ada .flip-pulse-ring {
    border: 2px solid rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

.flip-marker.flip-jarvis .flip-pulse-ring {
    border: 2px solid rgba(168, 85, 247, 0.8);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
}

@keyframes flipPulse {
    0% {
        transform: scale(0.6);
        opacity: 1;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Sidebar Flip Item Styling */
.player-item.flip-item {
    background: rgba(30, 41, 59, 0.7);
    border-left: 3px solid var(--accent);
}

.player-item.flip-item.flip-ada {
    border-left: 3px solid #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.player-item.flip-item.flip-jarvis {
    border-left: 3px solid #a855f7;
    background: rgba(168, 85, 247, 0.1);
}

/* Tooltip Styling */
.player-tooltip {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid var(--panel-border) !important;
    color: var(--text-primary) !important;
    border-radius: 0.375rem !important;
    padding: 0.25rem 0.5rem !important;
    font-family: inherit !important;
    font-size: 0.8rem !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

.player-tooltip::before {
    border-top-color: rgba(15, 23, 42, 0.95) !important;
}

/* Popup Styling */
.player-popup {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.25rem;
}

.player-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.25rem;
    gap: 1rem;
}

.player-popup-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.player-popup-msg {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

.player-popup-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

/* ==========================================
   Cybernetic Portal Sizing, Layout, and Glow
   ========================================== */

.search-item-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 0.5rem;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.search-item-thumbnail.fallback {
    border: 1px dashed rgba(255, 255, 255, 0.15);
}

.search-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.search-item:hover .search-item-thumbnail img {
    transform: scale(1.1);
}

.search-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.search-item-address {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.15rem;
}

.search-item-address.unknown {
    color: rgba(255, 255, 255, 0.25);
    font-style: italic;
}

/* Details Panel Banner Card styling */
.portal-image-card {
    width: 100%;
    height: max(450px, 48vh);
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    margin-bottom: 1.5rem;
    border: 1px solid var(--panel-border);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.portal-image-card.fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 50%, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.portal-image-card .portal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: rgba(0,0,0,0.5);
    transition: transform 0.5s ease;
}

.portal-image-card:hover .portal-image {
    transform: scale(1.05);
}

.portal-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0) 60%, rgba(15, 23, 42, 0.8) 100%);
    pointer-events: none;
}

.portal-fallback-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center;
    pointer-events: none;
    z-index: 1;
}

/* Faction Glow and Color Definitions */
.resistance, .faction-resistance {
    --faction-color: var(--res-color);
    --faction-glow-color: rgba(0, 194, 255, 0.4);
}
.enlightened, .faction-enlightened {
    --faction-color: var(--enl-color);
    --faction-glow-color: rgba(3, 220, 3, 0.4);
}
.neutral, .faction-neutral {
    --faction-color: #94a3b8;
    --faction-glow-color: rgba(148, 163, 184, 0.15);
}

/* Animations for Fallbacks */
.cyber-portal-svg {
    width: 120px;
    height: 120px;
    z-index: 2;
    filter: drop-shadow(0 0 8px var(--faction-glow-color));
    animation: portal-spin 20s linear infinite;
}

.cyber-portal-svg-thumb {
    width: 100%;
    height: 100%;
    padding: 10%;
    filter: drop-shadow(0 0 3px var(--faction-glow-color));
    animation: portal-spin-reverse 15s linear infinite;
}

@keyframes portal-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes portal-spin-reverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Make player names look and feel like clickable links to search their profile */
.player-popup-name,
.player-item-name,
.player-name {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    transition: text-decoration-color 0.2s ease;
}

.player-popup-name:hover,
.player-item-name:hover,
.player-name:hover {
    text-decoration-style: solid;
}

/* ==========================================
   Mobile Responsive Adjustments
   ========================================== */
@media (max-width: 768px) {
    .glass-header {
        flex-direction: column;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .status-indicator {
        display: none; /* Hide status indicator to save space on very small screens, or we can keep it */
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    nav button {
        padding: 0.5rem 0.5rem;
        font-size: 0.85rem;
        flex: 1;
        text-align: center;
        min-width: 80px;
    }

    .search-layout {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        height: 100%;
        overflow-y: auto; /* Let the entire layout scroll vertically on mobile */
    }

    .search-sidebar {
        width: 100%;
        height: auto;
        min-height: 250px;
        max-height: 40vh; /* Take up to 40% of the screen for results */
        flex: none;
    }

    .favorites-columns {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        height: 100%;
        max-width: none;
        overflow-y: auto;
    }

    .favorites-column {
        max-width: none;
        height: auto;
        min-height: 250px;
        padding: 1rem;
    }

    .detail-panel {
        width: 100%;
        height: auto;
        flex: none;
        padding: 1.5rem 1rem;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .detail-info-grid {
        grid-template-columns: 1fr; /* 1 column on mobile */
    }

    .info-card.full-width {
        grid-column: span 1;
    }

    /* Active Players Map Sidebar */
    .map-sidebar {
        width: calc(100% - 3rem);
        right: 1.5rem;
        top: 1.5rem;
        height: calc(100% - 3rem);
    }

    /* Elevate Leaflet controls above sidebar & popups on mobile */
    .leaflet-control-container {
        z-index: 1002 !important;
        pointer-events: none;
    }

    .leaflet-control {
        pointer-events: auto;
    }

    .leaflet-bottom.leaflet-right {
        bottom: max(1rem, env(safe-area-inset-bottom, 1rem)) !important;
        right: 0.75rem !important;
    }

    /* Larger, touch-friendly location control buttons on mobile */
    .custom-location-control {
        margin-bottom: 10px !important;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .custom-location-control a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 1.3rem !important;
        background: rgba(15, 23, 42, 0.9) !important;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .leaflet-control-zoom a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 1.25rem !important;
        background: rgba(15, 23, 42, 0.9) !important;
    }

    /* Make player markers larger and more visible on high-DPI mobile screens */
    .player-marker {
        width: 18px !important;
        height: 18px !important;
        border-width: 2.5px !important;
        box-shadow: 0 0 12px rgba(0, 0, 0, 0.8), 0 0 6px var(--accent) !important;
    }

    .player-marker::after {
        top: -8px !important;
        left: -8px !important;
        right: -8px !important;
        bottom: -8px !important;
    }

    #info-player-location, .player-details-table td {
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }

    .player-details-table th {
        width: 35% !important;
        min-width: 90px;
        padding: 10px 8px !important;
        white-space: nowrap;
        font-size: 0.9rem;
    }

    .player-details-table td {
        padding: 10px 8px !important;
        font-size: 0.95rem;
    }
}

/* Player Portals Grid and Cards */
.player-portals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 16px;
    max-height: max(600px, calc(100vh - 260px));
    overflow-y: auto;
    padding: 6px;
}

.player-portal-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 12px;
    align-items: center;
}

.player-portal-card:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.player-portal-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.3);
}

.player-portal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-portal-thumb.fallback {
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0) 70%);
}

.player-portal-info {
    flex: 1;
    min-width: 0;
}

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

.player-portal-header .portal-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.player-portal-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 6px;
    font-size: 0.8rem;
}

.player-portal-meta .meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-portal-meta .meta-label {
    color: var(--text-secondary);
}

.player-portal-meta .meta-val {
    color: var(--text-primary);
    font-family: monospace;
}

.player-portal-meta .meta-val.highlight {
    color: #38bdf8;
    font-weight: 600;
}

/* Player Navigation Tabs (Matches User Image) */
.player-nav-tabs {
    display: flex;
    background: #1e293b;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
    border-bottom: 2px solid var(--panel-border);
    align-items: stretch;
}

.player-nav-name {
    padding: 12px 24px;
    font-weight: 700;
    font-size: 1.1rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-nav-name.faction-RESISTANCE {
    background: #0022aa; /* Dark blue background for Resistance */
}

.player-nav-name.faction-ENLIGHTENED {
    background: #006600; /* Dark green background for Enlightened */
}

.player-nav-name.faction-NEUTRAL {
    background: #475569; /* Gray background for Neutral */
}

.player-nav-tab {
    background: #2e3f56;
    border: none;
    color: #94a3b8;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.player-nav-tab:hover {
    background: #243346;
    color: #ffffff;
}

.player-nav-tab.active {
    background: #000000; /* Active tab is black */
    color: #ffffff;
    font-weight: 700;
}

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

.player-tab-content.hidden {
    display: none;
}

/* Player Details Table Styling */
.player-details-table {
    width: 100%;
    margin-top: 15px;
    border-collapse: collapse;
    font-size: 1.05rem;
    background: rgba(30, 41, 59, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.player-details-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.player-details-table th {
    text-align: left;
    padding: 14px 20px;
    color: var(--text-secondary);
    font-weight: 600;
    width: 220px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.player-details-table td {
    padding: 14px 20px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.player-details-table tr:last-child th,
.player-details-table tr:last-child td {
    border-bottom: none;
}

.player-details-table a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.player-details-table a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ==========================================
   Centered Player Search Landing Page
   ========================================== */
.player-search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    max-width: 800px;
    margin: 3rem auto;
    padding: 3rem;
    border-radius: 1rem;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.search-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.search-hero-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    animation: pulse 2s infinite ease-in-out;
}

.search-hero h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.search-instruction {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.search-box-large {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 600px;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-box-large input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    padding: 1rem 2.8rem 1rem 1.5rem;
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    width: 100%;
}

.search-box-large input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.search-box-large button {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.search-box-large button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

.search-results-wrapper {
    width: 100%;
    max-width: 600px;
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1.5rem;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.player-search-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-search-card:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.player-search-card.active {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.15);
}

.player-search-card .card-icon {
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.player-search-card .card-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.player-search-card .card-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.player-search-card .card-meta {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ==========================================
   Full-Page Player Profile View Layout
   ========================================== */
#view-player-search {
    overflow-y: auto;
}

.player-profile-container {
    display: flex;
    flex-direction: column;
    max-width: 1100px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    min-height: calc(100vh - 12rem);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.player-profile-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
    border-bottom: 2px solid var(--panel-border);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.btn-back {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.player-profile-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-profile-title h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.player-profile-title .badge {
    font-size: 0.8rem;
    padding: 0.35rem 0.8rem;
    border-radius: 0.375rem;
    font-weight: 600;
}

.player-profile-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.3rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 100%;
}

.profile-menu-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 0.85rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}


.profile-menu-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.profile-menu-tab.active {
    background: #000000;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.player-profile-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: opacity 0.2s ease-in-out;
}

.profile-tab-content {
    display: block;
    width: 100%;
}

.profile-tab-content.hidden {
    display: none;
}

#player-comm-list,
#player-chat-list {
    max-height: calc(100vh - 16rem);
    min-height: 200px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

#player-comm-list::-webkit-scrollbar,
#player-chat-list::-webkit-scrollbar {
    width: 6px;
}

#player-comm-list::-webkit-scrollbar-track,
#player-chat-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#player-comm-list::-webkit-scrollbar-thumb,
#player-chat-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#player-comm-list::-webkit-scrollbar-thumb:hover,
#player-chat-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Faction Badge Styling overrides */
.badge.faction-RESISTANCE {
    background: rgba(0, 194, 255, 0.2) !important;
    color: #00c2ff !important;
    border: 1px solid rgba(0, 194, 255, 0.4) !important;
    text-shadow: 0 0 10px rgba(0, 194, 255, 0.5);
}

.badge.faction-ENLIGHTENED {
    background: rgba(3, 220, 3, 0.2) !important;
    color: #03dc03 !important;
    border: 1px solid rgba(3, 220, 3, 0.4) !important;
    text-shadow: 0 0 10px rgba(3, 220, 3, 0.5);
}

.badge.faction-NEUTRAL {
    background: rgba(148, 163, 184, 0.2) !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(148, 163, 184, 0.4) !important;
}

.badge.faction-MAC {
    background: rgba(235, 34, 34, 0.2) !important;
    color: #eb2222 !important;
    border: 1px solid rgba(235, 34, 34, 0.4) !important;
    text-shadow: 0 0 10px rgba(235, 34, 34, 0.5);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .player-profile-header {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        text-align: center;
        justify-items: center;
    }
    
    .player-profile-title {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .player-profile-menu {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .profile-menu-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        flex: 0 1 auto;
        text-align: center;
        white-space: nowrap;
    }
    
    .player-profile-container {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .player-search-container {
        margin: 0.5rem;
        padding: 1.25rem;
    }

    .player-details-table th {
        width: 35% !important;
        min-width: 100px;
        padding: 10px 10px !important;
        font-size: 0.9rem;
        white-space: nowrap;
        vertical-align: middle;
    }

    .player-details-table td {
        padding: 10px 10px !important;
        font-size: 0.95rem;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        vertical-align: middle;
    }
}

/* Global utility class to hide elements */
.hidden {
    display: none !important;
}

/* Player Tracker Controls & Map */
.tracker-filter-btn,
.heatmap-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    padding: 0.4rem 0.9rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tracker-filter-btn:hover,
.heatmap-filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.tracker-filter-btn.active,
.heatmap-filter-btn.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}


.tracker-red-pin-icon {
    background: transparent;
    border: none;
}

/* ==========================================================================
   Welcome & Registration Modal Styles
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeInModal 0.25s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(15, 23, 42, 0.4);
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-title-group .modal-icon {
    font-size: 1.5rem;
}

.modal-title-group h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal-btn:hover {
    color: #ef4444;
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
    min-height: 0;
}

/* DACH Disclaimer Banner */
.dach-disclaimer-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-left: 4px solid var(--accent);
    border-radius: 0.6rem;
    padding: 1rem;
}

.dach-disclaimer-banner .banner-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.dach-disclaimer-banner .banner-content {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.dach-disclaimer-banner p {
    margin: 0.25rem 0 0 0;
    color: var(--text-secondary);
}

/* Modal Tabs */
.welcome-tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.6);
    padding: 0.35rem;
    border-radius: 0.6rem;
    border: 1px solid var(--panel-border);
}

.welcome-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.welcome-tab-btn.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.tab-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Form Styles */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group label .required {
    color: #ef4444;
}

.input-with-icon {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--panel-border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.input-with-icon .input-prefix {
    padding: 0.6rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.95rem;
    border-right: 1px solid var(--panel-border);
}

.input-with-icon input {
    border: none !important;
    background: transparent !important;
    padding: 0.6rem 0.75rem !important;
    flex: 1;
    color: var(--text-primary);
}

.form-group input[type="email"] {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--panel-border);
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    color: var(--text-primary);
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.form-feedback {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.88rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.form-feedback.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.form-feedback.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.btn-large {
    width: 100%;
    padding: 0.8rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-1px);
}

.btn-account {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 0.4rem 0.85rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-account:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
}





/* User Status Card & Logout Styles */
.user-status-container {
    margin-top: 0.5rem;
}

.user-status-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    border-radius: 0.85rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.status-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.status-card-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.status-pill {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.status-pill.status-pending {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #fbbf24;
}

.status-pill.status-approved {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #34d399;
}

.status-pill.status-rejected {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
}

.status-description {
    font-size: 0.925rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0 0 0.85rem 0;
}

.status-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-detail-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.detail-label {
    color: var(--text-secondary);
}

.status-card-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.status-card-actions button {
    flex: 1;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-danger-outline {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.7);
    color: #ffffff;
}


/* Header Logout Button */
.btn-header-logout {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-header-logout:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.7);
    color: #ffffff;
}

/* Player Search Layout & Split View */
#view-player-search .search-sidebar,
#view-search .search-sidebar {
    width: 380px;
    flex-shrink: 0;
}

#view-player-search .player-profile-container,
#view-search .player-profile-container {
    flex: 1;
    margin: 0;
    max-width: none;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    min-height: auto;
}

@media (max-width: 768px) {
    #view-player-search .player-profile-container,
    #view-search .player-profile-container {
        height: auto;
        min-height: 0;
        flex: none;
        overflow-y: visible;
    }
}

.player-profile-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 350px;
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.player-profile-placeholder .placeholder-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.player-profile-placeholder h3 {
    font-size: 1.35rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.player-profile-placeholder p {
    max-width: 460px;
    line-height: 1.6;
    font-size: 0.92rem;
}

.player-profile-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}
