/* Player Modal Styles */
.player-modal-overlay {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.6);
}

.player-modal-content {
    background: linear-gradient(135deg,
        rgba(15, 23, 42, 0.95) 0%,
        rgba(88, 28, 135, 0.9) 50%,
        rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(147, 51, 234, 0.3);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 30px rgba(147, 51, 234, 0.2);
    max-height: 95vh;
    overflow-y: auto;
}

/* Responsive modal sizing */
@media (max-width: 640px) {
    .player-modal-content {
        margin: 0.5rem;
        max-height: 98vh;
    }
}

/* Job Badge Styles */
.job-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: fit-content;
    white-space: nowrap;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.job-badge:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

/* Specific job badge animations */
.job-badge.bg-green-500\/20 {
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.job-badge.bg-violet-500\/20 {
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.job-badge.bg-blue-500\/20 {
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.job-badge.bg-gray-500\/20 {
    box-shadow: 0 0 10px rgba(107, 114, 128, 0.2);
}

/* Silkroad-style Inventory Grid */
.silkroad-inventory-container {
    width: 100%;
    max-width: 100%;
}

.silkroad-inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 16px;
    background: linear-gradient(145deg,
        rgba(30, 41, 59, 0.8) 0%,
        rgba(51, 65, 85, 0.6) 50%,
        rgba(30, 41, 59, 0.8) 100%);
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(4px);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Responsive inventory grid */
@media (max-width: 640px) {
    .silkroad-inventory-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
        padding: 12px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .silkroad-inventory-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
        padding: 14px;
    }
}

@media (min-width: 1025px) {
    .silkroad-inventory-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding: 16px;
    }
}

/* Inventory slot styling */
.inventory-slot {
    aspect-ratio: 1;
    background: linear-gradient(145deg,
        rgba(15, 23, 42, 0.9) 0%,
        rgba(30, 41, 59, 0.7) 50%,
        rgba(15, 23, 42, 0.9) 100%);
    border: 2px solid rgba(148, 163, 184, 0.4);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 48px;
    max-height: 80px;
}

/* Responsive slot sizing */
@media (max-width: 640px) {
    .inventory-slot {
        min-height: 40px;
        max-height: 60px;
        border-radius: 6px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .inventory-slot {
        min-height: 44px;
        max-height: 70px;
        border-radius: 7px;
    }
}

.inventory-slot:hover {
    background: linear-gradient(145deg,
        rgba(30, 41, 59, 0.9) 0%,
        rgba(51, 65, 85, 0.8) 50%,
        rgba(30, 41, 59, 0.9) 100%);
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow:
        0 0 15px rgba(168, 85, 247, 0.3),
        inset 0 2px 4px rgba(168, 85, 247, 0.1);
    transform: scale(1.02);
}

.inventory-slot::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: linear-gradient(45deg,
        transparent 30%,
        rgba(168, 85, 247, 0.1) 50%,
        transparent 70%);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.inventory-slot:hover::before {
    opacity: 1;
}

/* Item placeholder styling */
.inventory-item-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: rgba(148, 163, 184, 0.4);
    font-size: 1rem;
    transition: all 0.3s ease;
}

@media (max-width: 640px) {
    .inventory-item-placeholder {
        font-size: 0.875rem;
    }
}

.inventory-slot:hover .inventory-item-placeholder {
    color: rgba(168, 85, 247, 0.6);
    transform: scale(1.1);
}

/* Future inventory item styling */
.inventory-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.inventory-item:hover {
    transform: scale(1.05);
    filter: brightness(1.1) drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
}

/* Empty slot indication */
.inventory-slot[data-slot]::after {
    content: attr(data-slot);
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 10px;
    color: rgba(148, 163, 184, 0.3);
    font-weight: bold;
    line-height: 1;
}

@media (max-width: 640px) {
    .inventory-slot[data-slot]::after {
        font-size: 8px;
        top: 1px;
        left: 1px;
    }
}

/* Special slot highlighting for equipped items */
.inventory-slot.equipped {
    background: linear-gradient(145deg,
        rgba(34, 197, 94, 0.2) 0%,
        rgba(22, 163, 74, 0.3) 50%,
        rgba(34, 197, 94, 0.2) 100%);
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.inventory-slot.rare {
    background: linear-gradient(145deg,
        rgba(168, 85, 247, 0.2) 0%,
        rgba(147, 51, 234, 0.3) 50%,
        rgba(168, 85, 247, 0.2) 100%);
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

.inventory-slot.legendary {
    background: linear-gradient(145deg,
        rgba(251, 191, 36, 0.2) 0%,
        rgba(245, 158, 11, 0.3) 50%,
        rgba(251, 191, 36, 0.2) 100%);
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

/* Clickable elements styles */
.player-avatar-clickable,
.player-name-clickable {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.player-avatar-clickable {
    border-radius: 50%;
    overflow: hidden;
}

.player-avatar-clickable:hover {
    transform: scale(1.05);
    filter: brightness(1.1) drop-shadow(0 0 15px rgba(187, 134, 252, 0.5));
}

.player-avatar-clickable::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(45deg, transparent, rgba(187, 134, 252, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-avatar-clickable:hover::after {
    opacity: 1;
}

.player-name-clickable:hover {
    color: #bb86fc !important;
    text-shadow: 0 0 8px rgba(187, 134, 252, 0.6);
    transform: translateY(-1px);
}

/* Small avatar specific styles */
.player-small-avatar-clickable {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
}

.player-small-avatar-clickable:hover {
    transform: scale(1.1);
    filter: brightness(1.15) drop-shadow(0 0 10px rgba(187, 134, 252, 0.4));
}

/* Modal animation improvements */
.modal-enter {
    animation: modalEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-leave {
    animation: modalLeave 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Modal content specific styles */
.player-modal-avatar {
    border: 4px solid rgba(147, 51, 234, 0.5);
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.3);
}

.player-modal-close-btn {
    background: rgba(239, 68, 68, 0.08);
    border: 1.5px solid rgba(239, 68, 68, 0.25);
    color: rgba(239, 68, 68, 0.85);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.player-modal-close-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.15));
    opacity: 0;
    border-radius: inherit;
    transition: opacity 0.3s ease;
}

@media (min-width: 640px) {
    .player-modal-close-btn {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }
}

/* RTL support */
[dir="rtl"] .player-modal-close-btn svg {
    transform: scaleX(-1);
}

.player-modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    color: rgba(239, 68, 68, 1);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.25),
                0 2px 10px rgba(239, 68, 68, 0.15);
}

.player-modal-close-btn:hover::before {
    opacity: 1;
}

.player-modal-close-btn:active {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.1s;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.player-modal-close-btn:focus {
    outline: none;
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* SVG icon specific styles */
.player-modal-close-btn svg {
    z-index: 1;
    position: relative;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.player-modal-close-btn:hover svg {
    filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.4));
}

/* Enhanced animations and interactions */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.5), 0 0 30px rgba(239, 68, 68, 0.2);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px) rotate(-1deg); }
    75% { transform: translateX(2px) rotate(1deg); }
}

.player-modal-close-btn:hover {
    animation: pulse-glow 2s ease-in-out infinite;
}

.player-modal-close-btn:focus-visible {
    animation: shake 0.5s ease-in-out;
}

/* Responsive improvements */
@media (max-width: 640px) {
    .player-modal-close-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        top: 8px;
        right: 8px;
    }

    [dir="rtl"] .player-modal-close-btn {
        right: auto;
        left: 8px;
    }
}

/* Better touch targets on mobile */
@media (hover: none) and (pointer: coarse) {
    .player-modal-close-btn {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .player-modal-close-btn:active {
        background: rgba(239, 68, 68, 0.2);
        transform: scale(0.95);
    }
}

/* RTL specific positioning */
[dir="rtl"] .absolute.top-3.right-3,
[dir="rtl"] .absolute.top-4.right-4 {
    right: auto;
    left: 0.75rem;
}

[dir="rtl"] .absolute.top-3.sm\\:top-4.right-3.sm\\:right-4 {
    right: auto;
    left: 0.75rem;
}

@media (min-width: 640px) {
    [dir="rtl"] .absolute.top-3.sm\\:top-4.right-3.sm\\:right-4 {
        left: 1rem;
    }
}

/* Enhanced accessibility */
.player-modal-close-btn:focus-visible {
    outline: 2px solid rgba(239, 68, 68, 0.8);
    outline-offset: 2px;
}

.player-modal-close-btn .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Scrollbar styling for modal */
.player-modal-content::-webkit-scrollbar {
    width: 6px;
}

.player-modal-content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 3px;
}

.player-modal-content::-webkit-scrollbar-thumb {
    background: rgba(147, 51, 234, 0.5);
    border-radius: 3px;
}

.player-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(147, 51, 234, 0.7);
}

/* Inventory grid animations */
@keyframes inventoryGlow {
    0%, 100% {
        box-shadow:
            inset 0 2px 4px rgba(0, 0, 0, 0.2),
            0 4px 12px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow:
            inset 0 2px 4px rgba(0, 0, 0, 0.2),
            0 4px 12px rgba(0, 0, 0, 0.3),
            0 0 20px rgba(168, 85, 247, 0.1);
    }
}

.silkroad-inventory-grid:hover {
    animation: inventoryGlow 2s ease-in-out infinite;
}

/* Responsive layout adjustments */
@media (max-width: 1024px) {
    .player-modal-content {
        max-width: 95vw;
    }
}

@media (max-height: 600px) {
    .player-modal-content {
        max-height: 90vh;
    }
}
