/* ============================================
   SKILL TREE & PLAYER STATS STYLES
   ============================================ */

/* Page Container */
.page-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    z-index: 9000;
    overflow-y: auto;
    display: none;
}

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

/* Modal Container */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    pointer-events: all;
}

.modal-content {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #475569;
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}

.modal-close:hover {
    background: #64748b;
}

/* ============================================
   PLAYER STATS PAGE
   ============================================ */

.player-stats-container {
    padding: 20px;
    color: var(--text);
}

.stats-page-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 12px;
    margin-bottom: 30px;
    border: 2px solid #334155;
}

.player-avatar {
    font-size: 80px;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.5));
}

.player-info {
    flex: 1;
}

.player-info h1 {
    margin: 0 0 15px 0;
    color: #60a5fa;
    font-size: 32px;
}

.xp-progress {
    margin-top: 10px;
}

.xp-bar-container-large {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 8px;
    height: 30px;
    position: relative;
    overflow: hidden;
}

.xp-bar-fill-large {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 6px;
}

.xp-bar-text-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stats-section {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 12px;
    padding: 20px;
}

.stats-section h2 {
    margin: 0 0 15px 0;
    color: #60a5fa;
    font-size: 20px;
    border-bottom: 2px solid #334155;
    padding-bottom: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #334155;
}

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

.stat-label {
    color: #94a3b8;
}

.stat-value {
    color: #e2e8f0;
    font-weight: bold;
}

.stat-value-large {
    color: #fbbf24;
    font-size: 24px;
    font-weight: bold;
}

.skill-points-section {
    background: linear-gradient(135deg, #1e293b 0%, #312e81 100%);
    border-color: #4f46e5;
}

.stat-item.highlight {
    background: rgba(251, 191, 36, 0.1);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #fbbf24;
}

.skill-tree-link-button {
    width: 100%;
    padding: 15px;
    margin-top: 15px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.skill-tree-link-button:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.close-page-btn {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background: #475569;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

.close-page-btn:hover {
    background: #64748b;
}

/* ============================================
   SKILL TREE PAGE
   ============================================ */

.skill-tree-page {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0f172a;
}

.skill-tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    background: #1e293b;
    border-bottom: 2px solid #334155;
}

.skill-tree-header h1 {
    margin: 0;
    color: #60a5fa;
    font-size: 28px;
}

.close-btn {
    background: #475569;
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

.close-btn:hover {
    background: #64748b;
}

.skill-points-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.sp-label {
    color: #0f172a;
    font-weight: bold;
}

.sp-value {
    color: #0f172a;
    font-size: 24px;
    font-weight: bold;
}

/* Tree Tabs */
.tree-tabs {
    display: flex;
    gap: 10px;
    padding: 15px 30px;
    background: #1e293b;
    border-bottom: 2px solid #334155;
    overflow-x: auto;
}

.tree-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #0f172a;
    border: 2px solid #475569;
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.tree-tab:hover {
    background: #1e293b;
    border-color: #60a5fa;
}

.tree-tab.active {
    background: #1e293b;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tree-icon {
    font-size: 20px;
}

.tree-name {
    font-size: 14px;
}

/* Canvas Container */
.skill-tree-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #0f172a;
}

#skillTreeCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    touch-action: none;
}

#skillTreeCanvas:active {
    cursor: grabbing;
}

/* Tree Controls */
.tree-controls {
    position: absolute;
    bottom: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-btn {
    width: 50px;
    height: 50px;
    background: rgba(30, 41, 59, 0.9);
    border: 2px solid #475569;
    border-radius: 8px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.control-btn:hover {
    background: #1e293b;
    border-color: #60a5fa;
    transform: scale(1.1);
}

/* Tree Instructions */
.tree-instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.9);
    border: 2px solid #475569;
    border-radius: 8px;
    padding: 10px 20px;
    color: #94a3b8;
    font-size: 14px;
}

/* Footer */
.skill-tree-footer {
    padding: 20px 30px;
    background: #1e293b;
    border-top: 2px solid #334155;
}

.respec-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.respec-btn:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

/* ============================================
   SKILL DETAIL MODAL
   ============================================ */

.skill-modal {
    max-width: 500px;
}

.skill-modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 30px;
    text-align: center;
    border-bottom: 2px solid #334155;
    position: relative;
}

.skill-modal-header.unlocked {
    background: linear-gradient(135deg, #166534 0%, #14532d 100%);
}

.skill-icon-large {
    font-size: 64px;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.5));
}

.skill-modal-header h2 {
    margin: 0;
    color: #60a5fa;
    font-size: 24px;
}

.unlocked-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 15px;
    background: #22c55e;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.maxed-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 15px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0f172a;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.skill-modal-header.maxed {
    background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
}

.skill-modal-header.maxed h2 {
    color: #fbbf24;
}

/* Stackable Skill Stack Display */
.skill-stacks {
    margin-bottom: 20px;
}

.skill-stacks h4 {
    color: #a78bfa;
    margin: 0 0 10px 0;
}

.stack-progress {
    height: 20px;
    background: #1e293b;
    border: 2px solid #475569;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.stack-bar {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    transition: width 0.3s ease;
    border-radius: 8px;
}

.stack-count {
    display: block;
    text-align: center;
    margin-top: 8px;
    color: #a78bfa;
    font-weight: bold;
    font-size: 14px;
}

.skill-modal-body {
    padding: 30px;
}

.skill-description {
    color: #cbd5e1;
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.skill-effects h4,
.skill-prerequisites h4 {
    color: #60a5fa;
    margin: 15px 0 10px 0;
}

.skill-effects ul,
.skill-prerequisites ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.skill-effects li {
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.1);
    margin-bottom: 5px;
    border-radius: 6px;
    color: #e2e8f0;
}

.skill-prerequisites li {
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 6px;
}

.skill-prerequisites li.unlocked {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.skill-prerequisites li.locked {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.skill-cost {
    margin-top: 20px;
    padding: 15px;
    background: rgba(251, 191, 36, 0.1);
    border: 2px solid #fbbf24;
    border-radius: 8px;
    text-align: center;
    color: #fbbf24;
    font-size: 18px;
}

.skill-modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #334155;
}

.unlock-skill-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.unlock-skill-btn:hover:not(.disabled) {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.unlock-skill-btn.disabled {
    background: #475569;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   RESPEC MODAL
   ============================================ */

.respec-modal {
    max-width: 450px;
}

.respec-modal-header {
    background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%);
    padding: 30px;
    text-align: center;
    border-bottom: 2px solid #991b1b;
}

.respec-icon {
    font-size: 64px;
    margin-bottom: 10px;
}

.respec-modal-header h2 {
    margin: 0;
    color: #fca5a5;
    font-size: 24px;
}

.respec-modal-body {
    padding: 30px;
}

.respec-modal-body > p {
    color: #cbd5e1;
    margin-bottom: 20px;
}

.respec-info {
    background: rgba(59, 130, 246, 0.1);
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    color: #e2e8f0;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid #334155;
}

.warning {
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid #ef4444;
    border-radius: 8px;
    padding: 12px;
    color: #fca5a5;
    margin-top: 15px;
    text-align: center;
}

.respec-cooldown {
    background: rgba(251, 191, 36, 0.2);
    border-color: #fbbf24;
    color: #fde047;
}

.respec-modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #334155;
    display: flex;
    gap: 15px;
}

.btn-cancel {
    flex: 1;
    padding: 15px;
    background: #475569;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.btn-cancel:hover {
    background: #64748b;
}

.btn-respec {
    flex: 2;
    padding: 15px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-respec:hover:not(.disabled) {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.btn-respec.disabled {
    background: #475569;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   LOADING STATE
   ============================================ */

.skill-tree-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: #94a3b8;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #334155;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-page-header {
        flex-direction: column;
        text-align: center;
    }

    .player-info h1 {
        font-size: 24px;
    }

    .tree-tabs {
        padding: 10px 15px;
    }

    .tree-tab {
        padding: 8px 12px;
    }

    .tree-name {
        display: none;
    }

    .skill-tree-header h1 {
        font-size: 20px;
    }

    .tree-controls {
        bottom: 60px;
        right: 10px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .tree-instructions {
        font-size: 12px;
        padding: 8px 15px;
    }
}
