/* Silkroad Online Inventory Component - 2x7 Grid Layout */
.silkroad-inventory-container {
    position: relative;
    width: 100%;
    max-width: 420px; /* increased from 384px to accommodate larger gap */
    margin: 0 auto;
    background: linear-gradient(145deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    border: 2px solid #6366f1;
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(99, 102, 241, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    min-height: 500px;
}

/* Main Inventory Background */
.inventory-background {
    position: relative;
    padding: 16px;
    background-image:
        url('/assets/images/ui/inventory-bg.jpg'),
        radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    background-size: cover, auto, auto;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
    background-blend-mode: overlay, normal, normal;
}

/* Equipment Grid - 2x7 Layout with Separated Columns */
.equipment-grid-2x7 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(7, 1fr);
    gap: 8px 48px; /* vertical gap 8px, horizontal gap 48px for better separation */
    width: 100%;
    max-width: 400px; /* increased to accommodate larger gap */
    margin: 0 auto;
    padding: 16px;
    justify-items: center;
    position: relative;
}

/* Add visual separator between columns */
.equipment-grid-2x7::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px; /* increased from 2px */
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(99, 102, 241, 0.4) 10%,
        rgba(99, 102, 241, 0.7) 50%,
        rgba(99, 102, 241, 0.4) 90%,
        transparent 100%);
    border-radius: 2px;
    z-index: 0;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

/* Individual Inventory Slots */
.inventory-slot {
    position: relative;
    z-index: 1; /* above the separator */
    aspect-ratio: 1;
    background: linear-gradient(145deg, #1e293b 0%, #334155 50%, #1e293b 100%);
    border: 2px solid #475569;
    border-radius: 8px;
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 60px;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inventory-slot:hover {
    border-color: #6366f1;
    box-shadow:
        0 4px 16px rgba(99, 102, 241, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Slot Placeholders */
.slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 8px;
    text-align: center;
    width: 100%;
    background: linear-gradient(145deg, #374151 0%, #4b5563 50%, #374151 100%);
    border-radius: 6px;
}

.slot-placeholder i {
    color: #94a3b8;
    font-size: 1.125rem;
    margin-bottom: 4px;
}

.slot-label {
    font-size: 0.75rem;
    color: #cbd5e1;
    font-weight: 500;
    line-height: 1.25;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* Empty Slot Styling */
.empty-slot .slot-placeholder {
    background-color: #374151;
    opacity: 0.5;
    border: 1px dashed #64748b;
}

.empty-placeholder .slot-label {
    color: #64748b;
    font-style: italic;
}

/* Special Slot Types */
.weapon-slot, .shield-slot {
    border-color: #dc2626;
    background: linear-gradient(145deg, #1e293b 0%, #450a0a 20%, #334155 80%, #1e293b 100%);
}

.weapon-slot:hover, .shield-slot:hover {
    border-color: #ef4444;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.weapon-placeholder, .shield-placeholder {
    color: #f87171;
}

.weapon-placeholder i, .shield-placeholder i {
    color: #f87171;
    font-size: 1.125rem;
}

.accessory-slot, .ring-slot {
    border-color: #7c3aed;
    background: linear-gradient(145deg, #1e293b 0%, #3c1361 20%, #334155 80%, #1e293b 100%);
}

.accessory-slot:hover, .ring-slot:hover {
    border-color: #8b5cf6;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.job-slot {
    border-color: #059669;
    background: linear-gradient(145deg, #1e293b 0%, #064e3b 20%, #334155 80%, #1e293b 100%);
}

.job-slot:hover {
    border-color: #10b981;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.job-placeholder {
    color: #34d399;
}

.job-placeholder i {
    color: #34d399;
}

/* Item Images */
.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.2) saturate(1.1);
}

/* Item Grades */
.normal {
    border: 1px solid #64748b;
}

.rare {
    border: 1px solid #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.epic {
    border: 1px solid #8b5cf6;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

.legendary {
    border: 1px solid #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.mythic {
    border: 1px solid #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.7);
    animation: mythicGlow 2s ease-in-out infinite;
}

@keyframes mythicGlow {
    0%, 100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.7); }
    50% { box-shadow: 0 0 20px rgba(239, 68, 68, 1); }
}

/* Inventory Info Section */
.inventory-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: rgba(30, 41, 59, 0.5);
    border-top: 1px solid #475569;
}

.inventory-title {
    display: flex;
    align-items: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

.character-id {
    font-size: 0.875rem;
}

/* Coming Soon Notice */
.coming-soon-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background-color: rgba(15, 23, 42, 0.5);
    border-top: 1px solid #374151;
}

/* Responsive Design */
@media (max-width: 640px) {
    .equipment-grid-2x7 {
        max-width: 300px; /* increased to accommodate larger gaps */
        gap: 6px 32px; /* vertical 6px, horizontal 32px - maintained proportion */
        padding: 12px;
    }

    .inventory-slot {
        min-height: 50px;
        min-width: 50px;
    }

    .slot-placeholder i {
        font-size: 0.875rem;
    }

    .slot-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .equipment-grid-2x7 {
        max-width: 280px; /* increased from 220px to accommodate larger gaps */
        gap: 4px 24px; /* vertical 4px, horizontal 24px - maintained separation */
        padding: 8px;
    }

    .inventory-slot {
        min-height: 45px;
        min-width: 45px;
    }

    .slot-placeholder {
        padding: 4px;
    }

    .slot-placeholder i {
        font-size: 0.75rem;
        margin-bottom: 0;
    }

    .slot-label {
        font-size: 10px;
    }
}

/* Animation Effects */
@keyframes slotGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 16px rgba(99, 102, 241, 0.6); }
}

.inventory-slot.equipped {
    animation: slotGlow 2s ease-in-out infinite;
}

/* Hover Effects for Better UX */
.inventory-slot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    z-index: 1;
    pointer-events: none;
}

.inventory-slot:hover::before {
    transform: translateX(100%);
}

/* Silkroad-specific styling */
.silkroad-inventory-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(45deg, transparent 49%, rgba(99, 102, 241, 0.1) 50%, transparent 51%),
        linear-gradient(-45deg, transparent 49%, rgba(139, 92, 246, 0.1) 50%, transparent 51%);
    pointer-events: none;
    z-index: 0;
}

.inventory-background {
    position: relative;
    z-index: 1;
}

/* Main Inventory Background */
.inventory-background {
    background-image: url('/assets/images/ui/inventory-bg.jpg'),
                      linear-gradient(145deg,
                        rgba(15, 23, 42, 0.95) 0%,
                        rgba(30, 41, 59, 0.9) 50%,
                        rgba(15, 23, 42, 0.95) 100%);
    background-size: cover, auto;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-blend-mode: overlay;
    border: 3px solid rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    display: grid;
    grid-template-areas:
        "left center right"
        "weapons weapons weapons"
        "accessories accessories accessories"
        "rings rings rings"
        "job job job";
    grid-template-columns: 1fr 1.5fr 1fr;
    grid-template-rows: auto auto auto auto auto;
    gap: 12px;
    min-height: 450px;
    backdrop-filter: blur(4px);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(168, 85, 247, 0.1);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .silkroad-inventory-container {
        max-width: 95%; /* slightly reduced to ensure proper fit with larger gaps */
        margin: 0 auto;
    }

    .inventory-background {
        padding: 15px;
        gap: 8px;
        min-height: 350px;
        grid-template-columns: 1fr 1.2fr 1fr;
    }
}

@media (max-width: 480px) {
    .inventory-background {
        padding: 12px;
        gap: 6px;
        min-height: 300px;
        grid-template-areas:
            "left center right"
            "weapons weapons weapons"
            "accessories accessories accessories"
            "rings rings rings"
            "job job job";
    }
}

/* Grid Areas */
.equipment-left {
    grid-area: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.character-center {
    grid-area: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipment-right {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.weapons-row {
    grid-area: weapons;
    display: flex;
    justify-content: space-around;
    gap: 12px;
}

.accessories-row {
    grid-area: accessories;
    display: flex;
    justify-content: space-around;
    gap: 12px;
}

.rings-row {
    grid-area: rings;
    display: flex;
    justify-content: space-around;
    gap: 12px;
}

.job-item-container {
    grid-area: job;
    display: flex;
    justify-content: center;
}

/* Character Center Area */
.character-avatar-container {
    width: 80px;
    height: 100px;
    background: linear-gradient(145deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(30, 41, 59, 0.2) 50%,
        rgba(0, 0, 0, 0.3) 100%);
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.character-background-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center,
        rgba(168, 85, 247, 0.1) 0%,
        transparent 70%);
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.7;
    }
}

/* Base Inventory Slot Styling */
.inventory-slot {
    width: 50px;
    height: 50px;
    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: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

@media (max-width: 640px) {
    .inventory-slot {
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 480px) {
    .inventory-slot {
        width: 38px;
        height: 38px;
    }
}

/* Special slot sizes */
.weapon-slot, .shield-slot {
    width: 60px;
    height: 60px;
}

@media (max-width: 640px) {
    .weapon-slot, .shield-slot {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .weapon-slot, .shield-slot {
        width: 45px;
        height: 45px;
    }
}

.job-slot {
    width: 55px;
    height: 55px;
}

@media (max-width: 640px) {
    .job-slot {
        width: 48px;
        height: 48px;
    }
}

/* Slot Hover Effects */
.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.05);
}

/* Slot Type Specific Styling */
.equipment-slot:hover {
    border-color: rgba(34, 197, 94, 0.6);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.weapon-slot:hover, .shield-slot:hover {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.accessory-slot:hover, .ring-slot:hover {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.job-slot:hover {
    border-color: rgba(251, 191, 36, 0.6);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

/* Slot Placeholder Styling */
.slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: rgba(148, 163, 184, 0.5);
    font-size: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.slot-placeholder i {
    font-size: 16px;
    margin-bottom: 2px;
}

.slot-placeholder .slot-label {
    font-size: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

@media (max-width: 640px) {
    .slot-placeholder {
        font-size: 10px;
    }

    .slot-placeholder i {
        font-size: 14px;
    }

    .slot-placeholder .slot-label {
        font-size: 7px;
    }
}

@media (max-width: 480px) {
    .slot-placeholder {
        font-size: 9px;
    }

    .slot-placeholder i {
        font-size: 12px;
    }

    .slot-placeholder .slot-label {
        font-size: 6px;
    }
}

/* Special placeholder styling */
.weapon-placeholder i {
    color: rgba(239, 68, 68, 0.6);
}

.shield-placeholder i {
    color: rgba(59, 130, 246, 0.6);
}

.job-placeholder i {
    color: rgba(251, 191, 36, 0.6);
}

/* Inventory Item Styling */
.inventory-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: relative;
}

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

/* Item Grade Effects */
.inventory-item.normal {
    filter: brightness(1);
}

.inventory-item.rare {
    filter: brightness(1.1) hue-rotate(240deg);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
}

.inventory-item.legendary {
    filter: brightness(1.2) hue-rotate(45deg);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
    animation: legendaryGlow 2s ease-in-out infinite;
}

@keyframes legendaryGlow {
    0%, 100% {
        box-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
    }
}

/* Slot Number Indicators */
.inventory-slot::before {
    content: attr(data-slot);
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 8px;
    color: rgba(148, 163, 184, 0.4);
    font-weight: bold;
    line-height: 1;
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 3px;
    border-radius: 2px;
    z-index: 1;
}

@media (max-width: 480px) {
    .inventory-slot::before {
        font-size: 7px;
        padding: 1px 2px;
    }
}

/* Inventory Info Section */
.inventory-info {
    margin-top: 16px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inventory-title {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.character-id {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

@media (max-width: 640px) {
    .inventory-info {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .inventory-title {
        font-size: 13px;
    }

    .character-id {
        font-size: 11px;
    }
}

/* Coming Soon Notice */
.coming-soon-notice {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 6px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Inventory Background Animation */
.inventory-background::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 40%,
        rgba(168, 85, 247, 0.1) 0%,
        transparent 50%);
    border-radius: 12px;
    animation: backgroundShift 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes backgroundShift {
    0%, 100% {
        background: radial-gradient(circle at 30% 40%,
            rgba(168, 85, 247, 0.1) 0%,
            transparent 50%);
    }
    50% {
        background: radial-gradient(circle at 70% 60%,
            rgba(59, 130, 246, 0.1) 0%,
            transparent 50%);
    }
}

/* Equipped Item Indicators */
.inventory-slot.equipped::after {
    content: '★';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    color: rgba(34, 197, 94, 0.8);
    text-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
    z-index: 2;
}

/* Loading State */
.silkroad-inventory-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

.silkroad-inventory-container.loading .inventory-background {
    position: relative;
    overflow: hidden;
}

.silkroad-inventory-container.loading .inventory-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(168, 85, 247, 0.2),
        transparent);
    animation: loadingSweep 2s ease-in-out infinite;
}

@keyframes loadingSweep {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}
