/* Battle for Pissotha - Player Viewer Styles */

:root {
    --bg-dark: #0f0f14;
    --bg-card: #1a1a24;
    --bg-card-hover: #22222e;
    --accent-primary: #7c5cff;
    --accent-secondary: #ff6b4a;
    --accent-gold: #ffd700;
    --accent-gem: #00d4aa;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --border-color: #2a2a3a;
    --success: #4ade80;
    --warning: #facc15;
    --error: #f87171;

    --faction-gaiera: #4ade80;
    --faction-faventia: #ffd700;
    --faction-occultia: #a855f7;
    --faction-niebessna: #60a5fa;
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

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

.header {
    background: linear-gradient(135deg, var(--bg-card) 0%, #1f1f2e 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
    animation: none;
}

.status-dot.error {
    background: var(--error);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 320px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

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

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.player-count {
    background: var(--accent-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
}

.search-box {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-box input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

.search-box input::placeholder {
    color: var(--text-muted);
}

.player-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.player-item:hover {
    background: var(--bg-card-hover);
}

.player-item.active {
    background: rgba(124, 92, 255, 0.15);
    border: 1px solid var(--accent-primary);
}

.player-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}

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

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

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

.detail-panel {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.hidden {
    display: none !important;
}

.player-detail {
    max-width: 900px;
    margin: 0 auto;
}

.player-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    flex-shrink: 0;
}

.player-info h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.player-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.meta-icon {
    font-size: 1.2rem;
}

.last-seen {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.character-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.character-main {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.character-sprite {
    width: 96px;
    height: 96px;
    image-rendering: pixelated;
    background: #cccccc2a;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.character-details {
    flex: 1;
    min-width: 0;
}

.character-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.faction-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.35rem;
}

.faction-gaiera { background: rgba(74, 222, 128, 0.15); color: var(--faction-gaiera); border: 1px solid rgba(74, 222, 128, 0.3); }
.faction-faventia { background: rgba(255, 215, 0, 0.15); color: var(--faction-faventia); border: 1px solid rgba(255, 215, 0, 0.3); }
.faction-occultia { background: rgba(168, 85, 247, 0.15); color: var(--faction-occultia); border: 1px solid rgba(168, 85, 247, 0.3); }
.faction-niebessna { background: rgba(96, 165, 250, 0.15); color: var(--faction-niebessna); border: 1px solid rgba(96, 165, 250, 0.3); }

.character-level {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.character-creature-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.armor-info {
    font-size: 0.8rem;
    color: var(--accent-gold);
}

.armor-info.armor-empty {
    color: var(--text-muted);
}

.companion-display {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.companion-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.companion-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.companion-sprite {
    width: 96px;
    height: 96px;
    image-rendering: pixelated;
    background: #cccccc2a;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.companion-details { flex: 1; }
.companion-name { font-weight: 600; font-size: 1rem; margin-bottom: 0.2rem; }
.companion-level { font-size: 0.85rem; color: var(--text-secondary); }

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.team-slot {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.team-slot:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.team-slot.empty {
    opacity: 0.5;
    border-style: dashed;
}

.team-slot-sprite-wrapper {
    width: 96px;
    height: 96px;
    margin-bottom: 0.5rem;
}

.team-slot-sprite {
    width: 96px;
    height: 96px;
    image-rendering: pixelated;
    background: #cccccc2a;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    display: block;
}

.team-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    width: 100%;
}

.team-slot-name { font-weight: 600; font-size: 1rem; }

.team-slot-level {
    background: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.team-slot-index {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.team-slot-power {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--accent-gold);
}

.creature-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.creature-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.creature-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 140px;
}

.creature-item-sprite-wrapper {
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.3rem;
}

.creature-item-sprite {
    width: 96px;
    height: 96px;
    image-rendering: pixelated;
    background: #cccccc2a;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    display: block;
}

.creature-item-stats {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    white-space: nowrap;
    text-align: center;
}

.creature-item-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.creature-item-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 768px) {
    .main-content { flex-direction: column; }
    .sidebar { width: 100%; max-height: 300px; border-right: none; border-bottom: 1px solid var(--border-color); }
    .detail-panel { padding: 1rem; }
    .team-grid { grid-template-columns: 1fr 1fr; }
    .creature-stats { flex-wrap: wrap; gap: 1rem; }
}
