/**
 * Paperdoll Component Styles
 *
 * Visual equipment grid for D&D 5e characters.
 * Compatible with CSS variables from themes.
 */

/* Container */
.paperdoll-container {
    position: relative;
}

.paperdoll-empty {
    padding: 1rem;
    text-align: center;
    color: var(--color-text-muted, #888);
    font-style: italic;
}

/* Header */
.paperdoll-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
    user-select: none;
}

.paperdoll-header:hover {
    opacity: 0.9;
}

.paperdoll-header:active {
    opacity: 0.7;
}

.paperdoll-collapse-btn {
    font-size: 0.65rem;
    color: var(--color-text-muted, #888);
}

.paperdoll-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-accent, #c9a959);
}

/* Layer Switch */
.paperdoll-layer-switch {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.layer-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    background: rgba(40, 35, 30, 0.6);
    border: 1px solid var(--color-border, #555);
    border-radius: 4px;
    color: var(--color-text-muted, #888);
    cursor: pointer;
    transition: all 0.2s ease;
}

.layer-btn:hover {
    background: rgba(60, 50, 40, 0.8);
}

.layer-btn.active {
    background: linear-gradient(135deg, rgba(139, 115, 85, 0.3), rgba(60, 50, 40, 0.8));
    border-color: var(--color-accent, #c9a959);
    color: var(--color-accent, #c9a959);
}

.layer-btn:active {
    transform: scale(0.95);
}

/* Main Grid */
.paperdoll-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(6, auto);
    gap: 0.35rem;
    max-width: 280px;
    margin: 0 auto 0.5rem auto;
    padding: 0.5rem;
    background: linear-gradient(135deg, rgba(30, 25, 20, 0.6), rgba(40, 35, 30, 0.4));
    border: 1px solid var(--color-border, #555);
    border-radius: 8px;
}

/* Slot (Equipment) */
.paperdoll-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(40, 35, 30, 0.6);
    border: 1px dashed rgba(139, 115, 85, 0.3);
    border-radius: 6px;
    padding: 0.35rem;
    min-height: 48px;
    transition: all 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.paperdoll-slot:hover {
    border-color: rgba(139, 115, 85, 0.6);
}

.paperdoll-slot.empty {
    opacity: 0.5;
    cursor: pointer;
}

.paperdoll-slot.empty.has-available {
    opacity: 0.8;
    border-color: rgba(100, 180, 100, 0.5);
    background: rgba(50, 80, 50, 0.3);
}

.paperdoll-available-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    background: #6a6;
    border-radius: 50%;
    box-shadow: 0 0 4px #6a6;
}

.paperdoll-slot.filled {
    border: 1px solid var(--color-accent, #c9a959);
    background: linear-gradient(135deg, rgba(139, 115, 85, 0.15), rgba(60, 50, 40, 0.6));
    box-shadow: 0 0 6px rgba(201, 169, 89, 0.15);
}

.paperdoll-slot.filled:active {
    transform: scale(0.95);
    background: rgba(139, 115, 85, 0.3);
}

/* ============================================
   RARITY COLOR CODING (D&D 5e Style)
   ============================================ */

/* Common - Gray */
.paperdoll-slot.filled.rarity-common,
.paperdoll-ring-slot.filled.rarity-common {
    border-color: #9d9d9d;
    background: linear-gradient(135deg, rgba(120, 120, 120, 0.2), rgba(80, 80, 80, 0.4));
}
.paperdoll-slot.filled.rarity-common .paperdoll-item-name,
.paperdoll-ring-slot.filled.rarity-common .ring-name {
    color: #c0c0c0;
}

/* Uncommon - Green */
.paperdoll-slot.filled.rarity-uncommon,
.paperdoll-ring-slot.filled.rarity-uncommon {
    border-color: #1eff00;
    background: linear-gradient(135deg, rgba(30, 180, 30, 0.2), rgba(20, 100, 20, 0.4));
    box-shadow: 0 0 8px rgba(30, 255, 0, 0.2);
}
.paperdoll-slot.filled.rarity-uncommon .paperdoll-item-name,
.paperdoll-ring-slot.filled.rarity-uncommon .ring-name {
    color: #1eff00;
}

/* Rare - Blue */
.paperdoll-slot.filled.rarity-rare,
.paperdoll-ring-slot.filled.rarity-rare {
    border-color: #0070dd;
    background: linear-gradient(135deg, rgba(0, 100, 200, 0.25), rgba(0, 60, 120, 0.4));
    box-shadow: 0 0 8px rgba(0, 112, 221, 0.3);
}
.paperdoll-slot.filled.rarity-rare .paperdoll-item-name,
.paperdoll-ring-slot.filled.rarity-rare .ring-name {
    color: #0070dd;
}

/* Very Rare - Purple */
.paperdoll-slot.filled.rarity-very-rare,
.paperdoll-ring-slot.filled.rarity-very-rare {
    border-color: #a335ee;
    background: linear-gradient(135deg, rgba(140, 50, 200, 0.25), rgba(80, 30, 120, 0.4));
    box-shadow: 0 0 10px rgba(163, 53, 238, 0.3);
}
.paperdoll-slot.filled.rarity-very-rare .paperdoll-item-name,
.paperdoll-ring-slot.filled.rarity-very-rare .ring-name {
    color: #a335ee;
}

/* Legendary - Gold/Orange */
.paperdoll-slot.filled.rarity-legendary,
.paperdoll-ring-slot.filled.rarity-legendary {
    border-color: #ff8000;
    background: linear-gradient(135deg, rgba(200, 120, 0, 0.3), rgba(120, 70, 0, 0.5));
    box-shadow: 0 0 12px rgba(255, 128, 0, 0.4);
}
.paperdoll-slot.filled.rarity-legendary .paperdoll-item-name,
.paperdoll-ring-slot.filled.rarity-legendary .ring-name {
    color: #ff8000;
    text-shadow: 0 0 4px rgba(255, 128, 0, 0.5);
}

/* Artifact - Red/Crimson (special) */
.paperdoll-slot.filled.rarity-artifact,
.paperdoll-ring-slot.filled.rarity-artifact {
    border-color: #e6cc80;
    background: linear-gradient(135deg, rgba(200, 150, 80, 0.3), rgba(150, 100, 50, 0.5));
    box-shadow: 0 0 15px rgba(230, 204, 128, 0.4);
    animation: artifact-glow 2s ease-in-out infinite alternate;
}
.paperdoll-slot.filled.rarity-artifact .paperdoll-item-name,
.paperdoll-ring-slot.filled.rarity-artifact .ring-name {
    color: #e6cc80;
    text-shadow: 0 0 6px rgba(230, 204, 128, 0.6);
}

@keyframes artifact-glow {
    from { box-shadow: 0 0 10px rgba(230, 204, 128, 0.3); }
    to { box-shadow: 0 0 20px rgba(230, 204, 128, 0.6); }
}

/* Blocked Slot (e.g., offhand when two-handed weapon equipped) */
.paperdoll-slot.blocked {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(180, 80, 80, 0.4);
    background: linear-gradient(135deg, rgba(80, 40, 40, 0.3), rgba(60, 30, 30, 0.4));
}

.paperdoll-slot.blocked:hover {
    border-color: rgba(180, 80, 80, 0.6);
}

.paperdoll-slot.blocked .blocked-icon {
    font-size: 0.9rem;
    opacity: 0.7;
}

.paperdoll-slot.blocked .blocked-text {
    color: rgba(180, 80, 80, 0.8);
    font-size: 0.5rem;
}

.paperdoll-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.paperdoll-item-name {
    font-size: 0.55rem;
    color: var(--color-accent, #c9a959);
    text-align: center;
    margin-top: 0.15rem;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ring Grid */
.paperdoll-ring-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3rem;
    max-width: 280px;
    margin: 0 auto 0.5rem auto;
    padding: 0.4rem;
    background: rgba(30, 25, 20, 0.4);
    border: 1px solid var(--color-border, #555);
    border-radius: 6px;
}

.paperdoll-ring-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(40, 35, 30, 0.5);
    border: 1px dashed rgba(139, 115, 85, 0.3);
    border-radius: 4px;
    padding: 0.25rem;
    min-height: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.paperdoll-ring-slot:hover {
    border-color: rgba(139, 115, 85, 0.6);
}

.paperdoll-ring-slot.empty {
    opacity: 0.5;
}

.paperdoll-ring-slot.empty.has-available {
    opacity: 0.8;
    border-color: rgba(100, 180, 100, 0.5);
}

.paperdoll-ring-slot.filled {
    border: 1px solid var(--color-accent, #c9a959);
    background: linear-gradient(135deg, rgba(139, 115, 85, 0.2), rgba(60, 50, 40, 0.5));
}

.paperdoll-ring-slot .ring-label {
    font-size: 0.55rem;
    color: var(--color-text-muted, #888);
    margin-bottom: 0.1rem;
}

.paperdoll-ring-slot .ring-icon {
    font-size: 1rem;
}

.paperdoll-ring-slot .ring-name {
    font-size: 0.5rem;
    color: var(--color-accent, #c9a959);
    text-align: center;
    margin-top: 0.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Dropdown */
.paperdoll-dropdown {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2a2520, #1a1815);
    border: 1px solid var(--color-accent, #c9a959);
    border-radius: 8px;
    min-width: 200px;
    max-width: 280px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.paperdoll-dropdown.hidden {
    display: none;
}

.dropdown-header {
    padding: 0.5rem 0.75rem;
    background: rgba(139, 115, 85, 0.2);
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--color-accent, #c9a959);
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
}

.dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: rgba(139, 115, 85, 0.2);
}

.dropdown-item:active {
    background: rgba(139, 115, 85, 0.3);
}

.dropdown-item.equipped {
    background: rgba(139, 115, 85, 0.15);
}

.dropdown-item-name {
    font-size: 0.8rem;
    color: var(--color-text-primary, #e0d6c8);
    flex: 1;
}

.dropdown-item-action {
    font-size: 0.65rem;
    color: var(--color-accent, #c9a959);
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--color-accent, #c9a959);
    border-radius: 3px;
    margin-left: 0.5rem;
}

.dropdown-divider {
    height: 1px;
    background: rgba(139, 115, 85, 0.3);
    margin: 0.25rem 0;
}

.dropdown-empty {
    padding: 0.75rem;
    font-size: 0.75rem;
    color: var(--color-text-muted, #888);
    text-align: center;
    font-style: italic;
}

/* Cosmetic Badge */
.cosmetic-badge-sm {
    display: inline-block;
    background: #5b4a73;
    color: #d4c4f0;
    font-size: 0.5rem;
    padding: 0.05rem 0.2rem;
    border-radius: 2px;
    margin-left: 0.2rem;
    vertical-align: middle;
}

/* Dropdown Section Labels */
.dropdown-section-label {
    font-size: 0.65rem;
    color: var(--color-text-muted, #888);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid rgba(139, 115, 85, 0.2);
}

.dropdown-section-label:first-of-type {
    border-top: none;
}

/* Dropdown Loading State */
.dropdown-loading {
    padding: 1rem;
    text-align: center;
    color: var(--color-text-muted, #888);
    font-style: italic;
    font-size: 0.75rem;
}

/* SRD Items List (Scrollable) */
.dropdown-srd-list {
    max-height: 220px;
    overflow-y: auto;
    border-top: 1px solid rgba(139, 115, 85, 0.2);
}

.dropdown-srd-list::-webkit-scrollbar {
    width: 6px;
}

.dropdown-srd-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.dropdown-srd-list::-webkit-scrollbar-thumb {
    background: rgba(139, 115, 85, 0.4);
    border-radius: 3px;
}

.dropdown-srd-list::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 115, 85, 0.6);
}

/* SRD Item Dropdown Entry */
.dropdown-srd-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid rgba(139, 115, 85, 0.1);
}

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

.dropdown-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.dropdown-item-info {
    font-size: 0.65rem;
    color: var(--color-text-muted, #888);
    margin-top: 0.15rem;
}

/* Tooltip */
.paperdoll-tooltip {
    position: fixed;
    z-index: 1000;
    background: linear-gradient(135deg, #2a2520, #1a1815);
    border: 1px solid var(--color-accent, #c9a959);
    border-radius: 8px;
    padding: 0.75rem;
    max-width: 280px;
    min-width: 180px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    display: none;
}

.tooltip-header {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--color-accent, #c9a959);
    margin-bottom: 0.4rem;
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
    padding-bottom: 0.3rem;
}

.tooltip-meta {
    font-size: 0.7rem;
    color: var(--color-text-muted, #888);
    margin-bottom: 0.3rem;
}

.tooltip-cost {
    color: #d4af37;
}

.tooltip-weight {
    color: #a0a0a0;
}

.tooltip-ac {
    font-size: 0.75rem;
    color: #7cb3e0;
    background: rgba(100, 150, 200, 0.15);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    margin-bottom: 0.3rem;
}

.tooltip-damage {
    font-size: 0.75rem;
    color: #e07c7c;
    background: rgba(200, 100, 100, 0.15);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    margin-bottom: 0.3rem;
}

.tooltip-properties {
    font-size: 0.65rem;
    color: #a0d0a0;
    font-style: italic;
    margin-bottom: 0.3rem;
}

.tooltip-desc {
    font-size: 0.7rem;
    color: var(--color-text-primary, #e0d6c8);
    line-height: 1.35;
    margin-top: 0.3rem;
    border-top: 1px solid rgba(139, 115, 85, 0.2);
    padding-top: 0.3rem;
}

.tooltip-cosmetic {
    font-size: 0.65rem;
    color: #d4c4f0;
    background: rgba(91, 74, 115, 0.3);
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    margin-top: 0.3rem;
    text-align: center;
}

/*
 * Light Theme Support - DISABLED
 * Theme is controlled by app's theme-switcher, not system preferences.
 * Removed @media (prefers-color-scheme: light) to prevent system override.
 */
