/* Unified Public Profile Panel - Economy Hub V2 Style */
/* Matches Morrhollow Security Terminal design */

:root {
    --profile-green-glow: #4ade80;
    --profile-green-accent: #10b981;
    --profile-gold-accent: rgba(212, 175, 55, 0.9);
    --profile-gold-border: rgba(212, 175, 55, 0.4);
    --profile-bg-dark: rgba(15, 15, 25, 0.95);
    --profile-bg-darker: rgba(8, 8, 15, 0.98);
}

/* Modal Backdrop */
.public-profile-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.public-profile-backdrop.show {
    opacity: 1;
}

/* Main Panel */
.public-profile-panel {
    width: min(900px, 90vw);
    max-height: 85vh;
    background: transparent;
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 40px rgba(74, 222, 128, 0.15),
        0 0 20px rgba(212, 175, 55, 0.1);
    border: 1px solid var(--profile-gold-border);
    font-family: 'RemiliaMincho', serif;
    font-size: 12px;
    color: #E5E7EB;
    animation: profile-slide-in 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.public-profile-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg,
        var(--profile-bg-dark) 0%,
        var(--profile-bg-darker) 50%,
        var(--profile-bg-dark) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: -1;
}

@keyframes profile-slide-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Header */
.profile-panel-header {
    background: linear-gradient(180deg,
        rgba(30, 41, 59, 0.95) 0%,
        rgba(51, 65, 85, 0.98) 100%);
    min-height: 40px;
    border-bottom: 1px solid var(--profile-gold-border);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 10px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(74, 222, 128, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    flex-shrink: 0;
}

.profile-panel-header h2 {
    font-size: 14px;
    color: var(--profile-gold-accent);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    text-shadow:
        0 0 10px rgba(74, 222, 128, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.8);
}

.header-actions {
    display: flex;
    gap: 6px;
}

.refresh-btn,
.close-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 4px;
    color: rgba(186, 166, 116, 0.8);
    font-family: 'RemiliaMincho', serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover,
.close-btn:hover {
    background: rgba(74, 222, 128, 0.1);
    border-color: var(--profile-green-glow);
    color: var(--profile-green-glow);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

.refresh-btn.spinning {
    animation: spin 1s linear;
}

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

/* Tabs */
.profile-tabs {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.2) 100%);
    border-bottom: 1px solid var(--profile-gold-border);
    flex-shrink: 0;
}

.profile-tab {
    flex: 1;
    padding: 8px 12px;
    background: linear-gradient(135deg,
        rgba(30, 41, 59, 0.3) 0%,
        rgba(51, 65, 85, 0.4) 100%);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 4px;
    color: rgba(186, 166, 116, 0.8);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.profile-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(74, 222, 128, 0.15),
        transparent);
    transition: left 0.5s ease;
}

.profile-tab:hover {
    background: linear-gradient(135deg,
        rgba(30, 41, 59, 0.5) 0%,
        rgba(51, 65, 85, 0.6) 100%);
    border-color: var(--profile-green-glow);
    color: #ffffff;
    box-shadow:
        0 0 10px rgba(74, 222, 128, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.profile-tab:hover::before {
    left: 100%;
}

.profile-tab.active {
    background: linear-gradient(135deg,
        rgba(74, 222, 128, 0.15) 0%,
        rgba(74, 222, 128, 0.25) 100%);
    border-color: var(--profile-green-glow);
    color: var(--profile-green-glow);
    box-shadow:
        0 0 15px rgba(74, 222, 128, 0.4),
        inset 0 0 10px rgba(74, 222, 128, 0.1);
}

.tab-icon {
    font-size: 16px;
}

/* Body */
.profile-panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
}

.profile-panel-body.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.loading-spinner {
    font-size: 32px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Overview Content */
.overview-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Profile Header Section */
.profile-header-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg,
        var(--profile-bg-dark) 0%,
        var(--profile-bg-darker) 100%);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 6px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 12px rgba(74, 222, 128, 0.1);
}

.profile-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--profile-green-glow);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

.level-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--profile-green-accent), var(--profile-green-glow));
    border: 2px solid var(--profile-bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #000;
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.6);
}

.profile-identity {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-username {
    font-size: 24px;
    font-weight: 700;
    color: var(--profile-gold-accent);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.verify-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.verify-badge.official {
    background: rgba(74, 222, 128, 0.2);
    border: 1px solid var(--profile-green-glow);
    color: var(--profile-green-glow);
}

.verify-badge.admin {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.6);
    color: rgba(239, 68, 68, 0.9);
}

.verify-badge.contributor {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.6);
    color: rgba(139, 92, 246, 0.9);
}

.verify-badge.verified {
    background: rgba(96, 165, 250, 0.2);
    border: 1px solid rgba(96, 165, 250, 0.6);
    color: rgba(96, 165, 250, 0.9);
}

.profile-rank-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--profile-green-glow);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    align-self: flex-start;
}

.profile-meta-info {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: rgba(186, 166, 116, 0.7);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Quick Stats Grid */
.quick-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.quick-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg,
        var(--profile-bg-dark) 0%,
        var(--profile-bg-darker) 100%);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 6px;
    transition: all 0.2s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 8px rgba(74, 222, 128, 0.05);
}

.quick-stat-card:hover {
    border-color: var(--profile-green-glow);
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 15px rgba(74, 222, 128, 0.2);
}

.quick-stat-card.shard-balance {
    border-color: rgba(139, 92, 246, 0.4);
}

.quick-stat-card.shard-balance:hover {
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 15px rgba(139, 92, 246, 0.3);
}

.stat-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--profile-green-glow);
    line-height: 1;
}

.shard-balance .stat-value {
    color: rgba(139, 92, 246, 1);
}

.stat-label {
    font-size: 11px;
    color: rgba(186, 166, 116, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-sublabel {
    font-size: 10px;
    color: rgba(186, 166, 116, 0.5);
}

/* Section Headers */
.section-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(74, 222, 128, 0.2);
}

.section-header h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--profile-green-glow);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.stat-card {
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 6px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--profile-green-glow);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.2);
}

.stat-card .stat-value {
    font-size: 28px;
    margin-bottom: 8px;
}

.stat-card .stat-label {
    font-size: 11px;
}

/* Shards Content */
.shards-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.shard-balance-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    background: linear-gradient(135deg,
        rgba(139, 92, 246, 0.15) 0%,
        rgba(139, 92, 246, 0.25) 100%);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 6px;
    box-shadow:
        0 0 20px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.balance-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.balance-amount {
    font-size: 36px;
    font-weight: 700;
    color: rgba(139, 92, 246, 1);
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
}

.balance-currency {
    font-size: 14px;
    color: rgba(186, 166, 116, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.global-rank {
    text-align: right;
}

.rank-label {
    font-size: 11px;
    color: rgba(186, 166, 116, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rank-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--profile-gold-accent);
}

/* Shard Stats Grid */
.shard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.shard-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.shard-stat-card:hover {
    border-color: var(--profile-green-glow);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.2);
}

.shard-stat-card.earned {
    border-color: rgba(74, 222, 128, 0.3);
}

.shard-stat-card.spent {
    border-color: rgba(239, 68, 68, 0.3);
}

.shard-stat-card.burned {
    border-color: rgba(251, 146, 60, 0.3);
}

.shard-stat-icon {
    font-size: 28px;
}

.shard-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--profile-green-glow);
    font-family: 'Courier New', monospace;
}

.shard-stat-card.earned .shard-stat-value {
    color: var(--profile-green-glow);
}

.shard-stat-card.spent .shard-stat-value {
    color: rgba(239, 68, 68, 0.9);
}

.shard-stat-card.burned .shard-stat-value {
    color: rgba(251, 146, 60, 0.9);
}

.shard-stat-label {
    font-size: 10px;
    color: rgba(186, 166, 116, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Breakdown Section */
.breakdown-section {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(74, 222, 128, 0.15);
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.breakdown-item:hover {
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.1);
}

.breakdown-label {
    flex-shrink: 0;
    min-width: 140px;
    font-size: 11px;
    color: rgba(186, 166, 116, 0.8);
}

.breakdown-bar {
    flex: 1;
    height: 18px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 9px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.breakdown-fill {
    height: 100%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px currentColor;
}

.breakdown-fill.earned {
    background: linear-gradient(90deg, var(--profile-green-accent), var(--profile-green-glow));
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

.breakdown-fill.spent {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.8), rgba(239, 68, 68, 0.9));
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.breakdown-value {
    flex-shrink: 0;
    min-width: 90px;
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.breakdown-value.earned {
    color: var(--profile-green-glow);
}

.breakdown-value.spent {
    color: rgba(239, 68, 68, 0.9);
}

/* Shard Feed */
.shard-feed-section {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(74, 222, 128, 0.15);
}

.shard-feed-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(30, 41, 59, 0.3);
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.feed-item:hover {
    background: rgba(51, 65, 85, 0.4);
    border-color: rgba(74, 222, 128, 0.2);
}

.feed-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.feed-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feed-action {
    font-size: 12px;
    color: rgba(186, 166, 116, 0.9);
}

.feed-time {
    font-size: 10px;
    color: rgba(186, 166, 116, 0.5);
}

.feed-amount {
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    font-family: 'Courier New', monospace;
}

.feed-item.earned .feed-amount {
    color: var(--profile-green-glow);
}

.feed-item.spent .feed-amount {
    color: rgba(239, 68, 68, 0.9);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(186, 166, 116, 0.5);
}

.empty-state.small {
    padding: 20px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-text {
    font-size: 13px;
    font-style: italic;
}

/* Recent Activity Section */
.recent-activity-section {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(74, 222, 128, 0.15);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(30, 41, 59, 0.3);
    border-radius: 4px;
}

.activity-icon {
    font-size: 16px;
}

.activity-text {
    font-size: 12px;
    color: rgba(186, 166, 116, 0.8);
}

/* Scrollbar Styling */
.profile-panel-body::-webkit-scrollbar,
.shard-feed-list::-webkit-scrollbar {
    width: 6px;
}

.profile-panel-body::-webkit-scrollbar-track,
.shard-feed-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.profile-panel-body::-webkit-scrollbar-thumb,
.shard-feed-list::-webkit-scrollbar-thumb {
    background: rgba(74, 222, 128, 0.3);
    border-radius: 3px;
}

.profile-panel-body::-webkit-scrollbar-thumb:hover,
.shard-feed-list::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 222, 128, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .public-profile-panel {
        width: 95vw;
        max-height: 90vh;
    }

    .profile-header-section {
        flex-direction: column;
        text-align: center;
    }

    .profile-identity {
        align-items: center;
    }

    .quick-stats-grid,
    .shard-stats-grid {
        grid-template-columns: 1fr;
    }

    .tab-text {
        display: none;
    }

    .shard-balance-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .global-rank {
        text-align: center;
    }
}
