/* project_0/assets/css/playerUI.css */

#player-view-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-l);
    padding: var(--spacing-l);
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-m);
    padding-bottom: var(--spacing-s);
    border-bottom: 1px solid var(--glass-border);
}

.panel-header h3 {
    margin: 0;
    font-size: 1.3em; /* Slightly larger panel titles */
    color: var(--accent-active);
    border-bottom: none;
    padding-bottom: 0;
    font-weight: 600;
}

.panel-content {
    flex-grow: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Hero Section */
.player-hero-section {
    display: grid;
    grid-template-columns: 0.7fr 1.3fr; /* Give more space to core info */
    gap: var(--spacing-l);
    background-color: var(--glass-tint);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-l);
    padding: var(--spacing-l);
    box-shadow: var(--shadow-m);
    flex-shrink: 0; /* Prevent hero section from shrinking too much */
}

.player-visual-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-m);
    padding: var(--spacing-s);
    align-self: stretch;
}

#player-armor-icon {
    display: block;
    max-width: 100%;
    max-height: 280px; /* Adjusted slightly, ensure it fits well */
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-s);
}

.player-info-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#detailed-stats-button.button-link-styled {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-m);
    border-radius: var(--radius-s);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
#detailed-stats-button.button-link-styled:hover {
    color: var(--accent-interactive);
    background-color: rgba(var(--accent-interactive-rgb), 0.1);
    border-color: var(--accent-interactive);
}

/* Core Stats List */
#core-stats-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#core-stats-list .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--spacing-s) 0;
    border-bottom: 1px dotted var(--border-color-subtle);
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}
#core-stats-list .stat-item:last-child { border-bottom: none; }
#core-stats-list .stat-item:hover { background-color: rgba(var(--accent-interactive-rgb), 0.07); }

#core-stats-list .stat-name {
    font-size: 1em; /* Clearer core stat names */
    color: var(--text-secondary);
    margin-right: var(--spacing-m);
    font-weight: 500;
}

#core-stats-list .stat-value, 
#core-stats-list .stat-values-wrapper .stat-value {
    font-size: 1em;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    text-align: right;
    padding: var(--spacing-xs) var(--spacing-s);
    border-radius: var(--radius-s);
    min-width: 60px; /* Ensure minimum width for alignment */
}
#core-stats-list .stat-item:hover .stat-value,
#core-stats-list .stat-item:hover .stat-values-wrapper .stat-value {
    background-color: rgba(0,0,0,0.2);
}

#core-stats-list .stat-values-wrapper {
    display: flex;
    gap: var(--spacing-m); /* More space between combined values */
    align-items: baseline;
}
#core-stats-list .stat-values-wrapper .secondary-stat {
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* Equipment and Detailed Stats Section - Making it more prominent */
.player-equipment-details-section {
    background-color: var(--glass-tint);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-l);
    padding: var(--spacing-l);
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Takes up available vertical space */
    min-height: 300px; /* Ensure it has a decent minimum height */
    box-shadow: var(--shadow-m);
    overflow: hidden; /* Let children handle their own scroll */
}

#detailed-stats-tabs-container {
    margin-bottom: var(--spacing-l);
    flex-shrink: 0;
}

#detailed-stats-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--spacing-s);
    border-bottom: 2px solid var(--accent-interactive);
    padding-bottom: 0;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-interactive) transparent;
}
#detailed-stats-tabs::-webkit-scrollbar { height: 4px; }
#detailed-stats-tabs::-webkit-scrollbar-thumb { background-color: var(--accent-interactive); border-radius: 2px;}

.stat-tab-button {
    padding: var(--spacing-m) var(--spacing-l);
    font-size: 1em; /* Slightly larger tab text */
    font-weight: 500;
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius-m) var(--radius-m) 0 0;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
    white-space: nowrap;
    text-align: center; /* Center text if tabs are stretched */
}

.stat-tab-button:hover {
    color: var(--text-primary);
    background-color: rgba(var(--accent-interactive-rgb), 0.1);
}
.stat-tab-button.active {
    color: var(--accent-interactive);
    font-weight: 700;
    border-bottom-color: var(--accent-interactive);
    background-color: var(--dark-bg-contrast, rgba(0,0,0,0.2));
}

#detailed-stats-content-wrapper {
    flex-grow: 1;
    min-height: 0;
    overflow-y: auto;
    border-radius: var(--radius-m);
    background-color: rgba(0,0,0,0.15); /* Slightly darker background for contrast */
}

#detailed-stats-content {
    padding: var(--spacing-l);
}

.stat-tab-pane { display: none; }
.stat-tab-pane.active { display: block; }

.tab-pane-content-wrapper .equipped-item-name-display {
    font-size: 1.2em; /* More prominent item name */
    color: var(--text-primary);
    margin-bottom: var(--spacing-m);
    padding-bottom: var(--spacing-s);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}
.tab-pane-content-wrapper .equipped-item-name-display.empty {
    font-style: italic;
    color: var(--text-secondary);
    font-weight: 500;
}

.detailed-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Wider columns for detailed stats */
    gap: var(--spacing-l) var(--spacing-m); /* Adjust gap */
}

.detailed-stats-grid .stat-item {
    background-color: rgba(var(--dark-bg-rgb), 0.2); /* Subtle background per item */
    padding: var(--spacing-s);
    border-radius: var(--radius-s);
    border: 1px solid var(--border-color-subtle);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    line-height: 1.5; /* Improved line height */
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
.detailed-stats-grid .stat-item:hover {
    background-color: rgba(var(--accent-interactive-rgb), 0.1);
    border-color: var(--accent-interactive);
}
.detailed-stats-grid .stat-item .stat-name {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin-right: var(--spacing-m);
}
.detailed-stats-grid .stat-item .stat-value {
    font-size: 0.95em;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.no-stats-message, .error-message {
    color: var(--text-secondary);
    font-style: italic;
    padding: var(--spacing-l);
    text-align: center;
    grid-column: 1 / -1; /* Span full width if grid item */
}
.error-message { color: var(--accent-danger); font-weight: 500; }

/* Responsive Adjustments */
@media (max-width: 992px) {
    .player-hero-section {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto; /* Ensure image and core stats stack vertically */
    }
    .player-visual-panel {
        margin-bottom: var(--spacing-l);
        align-self: center;
        max-height: 250px; /* Control image size on stack */
    }
    #player-armor-icon {
        max-height: 220px;
    }
    .player-equipment-details-section {
        min-height: 250px; /* Ensure it still has decent height */
    }
    .detailed-stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    #player-view-container {
        padding: var(--spacing-m);
    }
    .player-hero-section, .player-equipment-details-section {
        padding: var(--spacing-m);
    }
    #player-armor-icon {
        max-height: 180px;
    }
    #detailed-stats-tabs {
        gap: var(--spacing-xs);
    }
    .stat-tab-button {
        padding: var(--spacing-s) var(--spacing-m);
        font-size: 0.9em;
    }
    #detailed-stats-content { padding: var(--spacing-m); }
    .detailed-stats-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 480px) {
    .player-hero-section {
        grid-template-columns: 1fr; /* Already set, but ensure for smallest screens */
    }
    #player-armor-icon {
        max-height: 150px;
    }
    .panel-header h3 { font-size: 1.1em; }
    #detailed-stats-button.button-link-styled { font-size: 0.85em; padding: var(--spacing-xs); }

    #core-stats-list .stat-item, 
    .detailed-stats-grid .stat-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xxs); /* Tighter gap for stacked elements */
        padding: var(--spacing-s); /* More padding for tappability */
    }
    #core-stats-list .stat-name,
    .detailed-stats-grid .stat-item .stat-name {
        margin-right: 0;
        margin-bottom: var(--spacing-xxs);
    }
    #core-stats-list .stat-value, 
    #core-stats-list .stat-values-wrapper .stat-value,
    .detailed-stats-grid .stat-item .stat-value {
        text-align: left;
        width: 100%;
        padding: var(--spacing-xxs) 0; /* Minimal padding for stacked values */
    }
    #core-stats-list .stat-values-wrapper {
        flex-direction: column; /* Stack combined stats vertically */
        align-items: flex-start;
        gap: var(--spacing-xxs);
    }

    .stat-tab-button {
        font-size: 0.85em; /* Ensure tab text is readable */
        padding: var(--spacing-s) var(--spacing-xs); /* Adjust padding for smaller tabs */
        flex-grow: 1; /* Allow tabs to take equal space if few */
    }
    .detailed-stats-grid { 
        grid-template-columns: 1fr; /* Single column for very small screens */
        gap: var(--spacing-s);
    }
}