/* ========== SKILL TREE ACTIVITY STYLES ========== */
/* Horizontal skill tree UI for Discord Activity */

:root {
    --bg-dark: #1a1a2e;
    --bg-darker: #16213e;
    --bg-card: #1f2937;
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --text: #f8fafc;
    --text-dim: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --locked: #4b5563;
    --unlocked: #22c55e;
    --available: #7c3aed;
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    max-width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.status-banner {
    margin: 1rem 2rem 0;
    padding: 0.85rem 1rem;
    border-radius: 0.8rem;
    border: 1px solid rgba(245, 158, 11, 0.45);
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.95) 0%, rgba(17, 24, 39, 0.95) 100%);
    color: #fde68a;
    font-size: 0.95rem;
    line-height: 1.4;
}

.status-banner.error {
    border-color: rgba(239, 68, 68, 0.45);
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.95) 0%, rgba(17, 24, 39, 0.95) 100%);
    color: #fecaca;
}

.status-banner.hidden {
    display: none;
}

/* ========== HEADER ========== */
.header {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(124, 58, 237, 0.3);
}

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

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.player-details h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.level {
    color: var(--accent-light);
    font-weight: 600;
}

.skill-points {
    color: var(--success);
    font-weight: 600;
}

/* ========== TREE TABS ========== */
.tree-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.2);
    overflow-x: auto;
}

.tree-tab {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    background: var(--bg-card);
    border: 1px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tree-tab:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: var(--accent);
}

.tree-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ========== SKILL TREE CONTAINER ========== */
.skill-tree-container {
    flex: 1;
    overflow: auto;
    padding: 2rem;
}

.debug-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 2rem 1.25rem;
    background: rgba(0, 0, 0, 0.18);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.debug-open-btn,
.debug-refresh-btn {
    background: linear-gradient(135deg, #0f766e 0%, #164e63 100%);
    color: var(--text);
    border: 1px solid rgba(125, 211, 252, 0.35);
    border-radius: 0.65rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
}

.debug-summary {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.skill-tree {
    display: flex;
    flex-direction: row;
    gap: 3rem;
    align-items: flex-start;
    min-width: max-content;
    padding-bottom: 2rem;
}

/* ========== SKILL TIER (Horizontal Column) ========== */
.skill-tier {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    min-width: 120px;
}

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

/* ========== SKILL NODE ========== */
.skill-node {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 3px solid transparent;
}

.skill-node.locked {
    background: var(--bg-card);
    border-color: var(--locked);
    opacity: 0.6;
}

.skill-node.available {
    background: linear-gradient(135deg, #2d1f4e 0%, #1f2937 100%);
    border-color: var(--available);
    animation: pulse 2s infinite;
}

.skill-node.unlocked {
    background: linear-gradient(135deg, #065f46 0%, #1f2937 100%);
    border-color: var(--unlocked);
}

.skill-node:hover {
    transform: scale(1.1);
    z-index: 10;
}

.skill-node.locked:hover {
    transform: scale(1.05);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(124, 58, 237, 0); }
}

.skill-icon {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.skill-name {
    font-size: 0.6rem;
    text-align: center;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.skill-node.locked .skill-icon {
    filter: grayscale(1);
}

/* ========== CONNECTION LINES ========== */
.skill-connections {
    position: absolute;
    pointer-events: none;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.connection-line {
    stroke: var(--locked);
    stroke-width: 2;
    fill: none;
}

.connection-line.active {
    stroke: var(--unlocked);
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    position: relative;
    border: 1px solid var(--accent);
}

.debug-modal-content {
    max-width: 1100px;
    width: min(96vw, 1100px);
    min-height: 78vh;
    padding: 1.25rem;
}

.debug-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.debug-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.debug-header p {
    color: var(--text-dim);
    font-size: 0.95rem;
}

.debug-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.debug-filters label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.debug-filters select,
.debug-filters input {
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.55rem;
    padding: 0.7rem 0.75rem;
}

.debug-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
}

.debug-stat-card {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 0.8rem;
    padding: 0.85rem 1rem;
}

.debug-stat-card strong {
    display: block;
    font-size: 1.2rem;
    margin-top: 0.3rem;
}

.debug-log-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: auto;
    min-height: 320px;
    max-height: 48vh;
    padding-right: 0.2rem;
}

.debug-log-entry {
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0.9rem;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.debug-log-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.debug-log-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.debug-badge {
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    background: rgba(148, 163, 184, 0.16);
}

.debug-badge.spike { background: rgba(239, 68, 68, 0.22); color: #fecaca; }
.debug-badge.api { background: rgba(59, 130, 246, 0.22); color: #bfdbfe; }
.debug-badge.local { background: rgba(16, 185, 129, 0.22); color: #bbf7d0; }
.debug-badge.fallback { background: rgba(245, 158, 11, 0.22); color: #fde68a; }
.debug-badge.error,
.debug-badge.silent_fail { background: rgba(239, 68, 68, 0.22); color: #fecaca; }

.debug-log-path {
    color: var(--text-dim);
    font-size: 0.86rem;
}

.debug-log-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.45rem;
}

.debug-breakdown-item {
    background: rgba(255, 255, 255, 0.035);
    border-radius: 0.65rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
}

.debug-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-dim);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dim);
}

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

.skill-detail {
    text-align: center;
}

.skill-icon-large {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.skill-detail h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.skill-description {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.skill-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
}

.stat-label {
    color: var(--text-dim);
}

.stat-value {
    color: var(--accent-light);
    font-weight: 600;
}

/* ========== BUTTONS ========== */
.unlock-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.unlock-btn:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.unlock-btn:disabled {
    background: var(--locked);
    cursor: not-allowed;
    transform: none;
}

.unlock-btn.unlocked {
    background: var(--unlocked);
    cursor: default;
}

/* ========== LOADING ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .status-banner {
        margin: 1rem 1rem 0;
    }

    .header {
        padding: 1rem;
    }
    
    .skill-tree-container {
        padding: 1rem;
    }

    .debug-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }

    .debug-modal-content {
        width: 98vw;
        min-height: 90vh;
        padding: 1rem;
    }
    
    .skill-node {
        width: 60px;
        height: 60px;
    }
    
    .skill-icon {
        font-size: 1.25rem;
    }
    
    .skill-name {
        font-size: 0.5rem;
    }
}
