/**
 * Vertical Column Layout for Elements
 * Restructures element display from horizontal to vertical columns
 */

/* Main container for all element columns - FULL WIDTH */
.element-columns-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    height: calc(100vh - 100px);
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
    z-index: 50;
}

/* Hide old horizontal layout */
.elements-container {
    display: none !important;
}

.element-group {
    display: none !important;
}

/* Individual element column */
.element-column {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0;
    border-right: 2px solid rgba(255, 255, 255, 0.1);
    overflow: visible; /* Changed from hidden to allow spinners to show */
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.element-column:last-child {
    border-right: none;
}

/* Background image overlay */
.element-column::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.6;
    z-index: 0;
    pointer-events: none;
}

/* Active zone overlay - sparkly golden frame when zone is energized */
.element-column::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background-image: url('../images/zones/active_zone.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
}

/* Show active overlay when column has active class */
.element-column.active::after {
    opacity: 1;
}

/* Fire column styling with background */
.element-column.fire-column {
    border-color: rgba(255, 87, 34, 0.5);
    background-color: rgba(20, 10, 5, 0.8);
}

/* Zone backgrounds are dynamically set by JavaScript based on tier progression */
.element-column.fire-column::before {
    background-image: url('../images/zones/fire-zone-1.png');
}

/* Water column styling with background */
.element-column.water-column {
    border-color: rgba(33, 150, 243, 0.5);
    background-color: rgba(5, 10, 20, 0.8);
}

.element-column.water-column::before {
    background-image: url('../images/zones/water-zone-1.png');
}

/* Earth column styling with background */
.element-column.earth-column {
    border-color: rgba(139, 69, 19, 0.5);
    background-color: rgba(15, 10, 5, 0.8);
}

.element-column.earth-column::before {
    background-image: url('../images/zones/earth-zone-1.png');
}

/* Air column styling with background */
.element-column.air-column {
    border-color: rgba(150, 200, 255, 0.5);
    background-color: rgba(10, 15, 25, 0.8);
}

.element-column.air-column::before {
    background-image: url('../images/zones/air-zone-1.png');
}

/* Dynamic zone level classes for progression */
.element-column.zone-level-2::before {
    transition: background-image 1s ease-in-out;
}

.element-column.fire-column.zone-level-2::before {
    background-image: url('../images/zones/fire-zone-2.png');
}

.element-column.water-column.zone-level-2::before {
    background-image: url('../images/zones/water-zone-2.png');
}

.element-column.earth-column.zone-level-2::before {
    background-image: url('../images/zones/earth-zone-2.png');
}

.element-column.air-column.zone-level-2::before {
    background-image: url('../images/zones/air-zone-2.png');
}

.element-column.zone-level-3::before {
    background-image: url('../images/zones/fire-zone-3.png');
}

.element-column.fire-column.zone-level-3::before {
    background-image: url('../images/zones/fire-zone-3.png');
}

.element-column.water-column.zone-level-3::before {
    background-image: url('../images/zones/water-zone-3.png');
}

.element-column.earth-column.zone-level-3::before {
    background-image: url('../images/zones/earth-zone-3.png');
}

.element-column.air-column.zone-level-3::before {
    background-image: url('../images/zones/air-zone-3.png');
}

/* Zone Level 4 */
.element-column.zone-level-4::before {
    transition: background-image 1s ease-in-out;
}

.element-column.fire-column.zone-level-4::before {
    background-image: url('../images/zones/fire-zone-4.png');
}

.element-column.water-column.zone-level-4::before {
    background-image: url('../images/zones/water-zone-4.png');
}

.element-column.earth-column.zone-level-4::before {
    background-image: url('../images/zones/earth-zone-4.png');
}

.element-column.air-column.zone-level-4::before {
    background-image: url('../images/zones/air-zone-4.png');
}

/* Zone Level 5 */
.element-column.zone-level-5::before {
    transition: background-image 1s ease-in-out;
}

.element-column.fire-column.zone-level-5::before {
    background-image: url('../images/zones/fire-zone-5.png');
}

.element-column.water-column.zone-level-5::before {
    background-image: url('../images/zones/water-zone-5.png');
}

.element-column.earth-column.zone-level-5::before {
    background-image: url('../images/zones/earth-zone-5.png');
}

.element-column.air-column.zone-level-5::before {
    background-image: url('../images/zones/air-zone-5.png');
}

/* Core element - AT TOP of zone */
.column-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0 30px 0;
    z-index: 10;
    background: none;
    border: none;
    margin-bottom: 10px;
}

/* Tier badge - top right of each column */
.tier-badge {
    position: absolute;
    top: 55px;
    right: 15px;
    background: linear-gradient(135deg, rgba(40, 40, 50, 0.95), rgba(30, 30, 40, 0.95));
    border: 2px solid rgba(255, 215, 0, 0.6);
    border-radius: 8px;
    padding: 10px 16px;
    font-family: 'Cinzel', serif;
    font-size: 1.4em;
    font-weight: bold;
    color: rgba(255, 215, 0, 1);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.3);
    z-index: 15;
    pointer-events: none;
}

.column-header .core-element-integrated {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    position: relative;
    z-index: 10; /* Ensure core element and its circles render above column background */
    width: 180px; /* Fixed square size */
    height: 180px;
    background: none !important; /* No background */
    border: none !important; /* No border */
}

.column-header .core-element-integrated:active {
    cursor: grabbing;
}

.column-header .core-element-integrated img {
    width: 180px !important;
    height: 180px !important;
    border-radius: 50%;
    border: none !important;
    box-shadow: none !important; /* No border or shadow effects */
    transition: all 0.3s ease;
    background: transparent !important;
    object-fit: contain !important; /* Fit entire image within circle without cropping */
    object-position: center; /* Center the image within the circle */
}

.column-header .core-element-integrated:hover img {
    transform: scale(1.15);
    box-shadow: none !important; /* No glow on hover */
}

/* Hide the element name text */
.column-header .core-element-name {
    display: none !important;
}

/* Also hide any stray element names */
.core-element-name {
    display: none !important;
}

/* Scrollable element grid - arranged in rows */
.column-elements {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 25px; /* Increased padding for better buffer from borders */
    padding-bottom: 130px; /* Extra padding for spinners at bottom */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); /* Increased from 100px to accommodate larger elements */
    gap: 25px; /* Increased gap for better spacing */
    align-content: start;
    justify-items: center; /* Horizontally center items in grid cells */
    position: relative;
    z-index: 1;
    max-height: calc(100% - 120px); /* Reserve space for spinners */
}

/* Custom scrollbar for columns */
.column-elements::-webkit-scrollbar {
    width: 8px;
}

.column-elements::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.column-elements::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.column-elements::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Individual element items as circular icons */
.column-element-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.3s ease;
    position: relative;
    aspect-ratio: 1;
    width: 95px; /* Increased from 80px for better visibility */
    height: 95px;
    border-radius: 50%;
    border: 2px solid transparent;
}

/* Family-colored backgrounds for elements */
.fire-column .column-element-item {
    background: radial-gradient(circle, rgba(255, 87, 34, 0.25) 0%, rgba(255, 87, 34, 0.1) 50%, transparent 100%);
    border-color: rgba(255, 87, 34, 0.3);
}

.water-column .column-element-item {
    background: radial-gradient(circle, rgba(33, 150, 243, 0.25) 0%, rgba(33, 150, 243, 0.1) 50%, transparent 100%);
    border-color: rgba(33, 150, 243, 0.3);
}

.earth-column .column-element-item {
    background: radial-gradient(circle, rgba(139, 69, 19, 0.3) 0%, rgba(139, 69, 19, 0.15) 50%, transparent 100%);
    border-color: rgba(139, 69, 19, 0.35);
}

.air-column .column-element-item {
    background: radial-gradient(circle, rgba(150, 200, 255, 0.25) 0%, rgba(150, 200, 255, 0.1) 50%, transparent 100%);
    border-color: rgba(150, 200, 255, 0.3);
}

.column-element-item:hover {
    transform: scale(1.15);
    z-index: 5;
}

/* Enhance borders on hover with family color glow */
.fire-column .column-element-item:hover {
    border-color: rgba(255, 87, 34, 0.7);
    box-shadow: 0 0 15px rgba(255, 87, 34, 0.5);
}

.water-column .column-element-item:hover {
    border-color: rgba(33, 150, 243, 0.7);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
}

.earth-column .column-element-item:hover {
    border-color: rgba(139, 69, 19, 0.7);
    box-shadow: 0 0 15px rgba(139, 69, 19, 0.5);
}

.air-column .column-element-item:hover {
    border-color: rgba(150, 200, 255, 0.7);
    box-shadow: 0 0 15px rgba(150, 200, 255, 0.5);
}

.column-element-item:active {
    cursor: grabbing;
}

/* Progress circles container - stacked vertically on right side */
.element-progress-circles {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
    z-index: 2;
}

/* Individual progress circle indicator - larger and more visible */
.progress-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(80, 80, 80, 0.8);
    border: 2px solid rgba(150, 150, 150, 0.9);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

/* Filled circle (combination discovered) - bright golden with pulse animation */
.progress-circle.filled {
    background: rgba(255, 215, 0, 1);
    border-color: rgba(255, 235, 0, 1);
    box-shadow: 0 0 12px rgba(255, 215, 0, 1), 0 0 20px rgba(255, 215, 0, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.5);
    animation: progressCircleGlowPulse 2s ease-in-out infinite;
}

@keyframes progressCircleGlowPulse {
    0%, 100% {
        box-shadow: 0 0 12px rgba(255, 215, 0, 1), 0 0 20px rgba(255, 215, 0, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 18px rgba(255, 215, 0, 1), 0 0 30px rgba(255, 215, 0, 0.9), inset 0 1px 3px rgba(255, 255, 255, 0.7);
    }
}

.column-element-item img {
    width: 95px !important; /* Increased from 80px to match container */
    height: 95px !important;
    border-radius: 50%;
    border: none !important;
    object-fit: contain !important; /* Fit entire image within circle without cropping */
    object-position: center;
    background: transparent;
    box-shadow: none !important; /* No border or shadow effects */
    transition: all 0.3s ease;
}

/* All tiers same size now - removed tier-based sizing and backgrounds */

.column-element-item:hover img {
    box-shadow: none !important; /* No glow effects */
    filter: brightness(1.2);
    transform: scale(1.2);
}

.column-element-item .element-info {
    display: none;
}

/* Simple tooltip - shows element name and match progress */
.simple-tooltip {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.95);
    border: 2px solid rgba(255, 215, 0, 0.6);
    border-radius: 8px;
    padding: 8px 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.column-element-item:hover .simple-tooltip,
.core-element-integrated:hover .simple-tooltip {
    opacity: 1;
    visibility: visible;
}

.tooltip-name-simple {
    font-family: 'Cinzel', serif;
    font-size: 0.9em;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 4px;
}

.tooltip-matches {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.8);
}

/* Hide old complex tooltip */
.element-tooltip {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Tooltip arrow */
.element-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(30, 30, 40, 0.98);
}

/* Tooltip header with image and name */
.tooltip-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.tooltip-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.5);
    flex-shrink: 0;
}

.tooltip-name-tier {
    flex: 1;
}

.tooltip-name {
    font-size: 1.1em;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 4px;
    line-height: 1.2;
}

.tooltip-tier {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

/* Tooltip recipe section */
.tooltip-recipe {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip-recipe-label {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tooltip-recipe-items {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: white;
}

.tooltip-recipe-items .plus {
    color: rgba(255, 215, 0, 0.6);
    font-weight: bold;
}

/* Discovery status badge */
.tooltip-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 600;
    margin-top: 6px;
}

.tooltip-status.discovered {
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.5);
}

.tooltip-status.pending {
    background: rgba(255, 152, 0, 0.3);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.5);
}

.column-element-item .element-tier {
    display: none;
}

/* Tier badges - positioned on circle */
.tier-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: rgba(0, 0, 0, 0.9);
    color: gold;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.65em;
    font-weight: bold;
    border: 2px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Hide completed elements */
.column-element-item.completed {
    opacity: 0.3;
    pointer-events: none;
}

/* Empty state for columns */
.column-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* Mobile responsiveness */
@media (max-width: 1200px) {
    .element-columns-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .element-columns-container {
        grid-template-columns: 1fr;
        gap: 10px;
        height: auto;
        max-height: calc(100vh - 250px);
    }

    .column-header .core-element-integrated img {
        width: 60px;
        height: 60px;
        object-fit: cover;
        object-position: center;
    }

    .column-element-item img {
        width: 40px;
        height: 40px;
    }
}

/* Dual Spinner Container - Position at bottom of each column */
.dual-spinner-container {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    min-height: 100px;
    width: 210px; /* Explicit width: 2 spinners (90px each) + gap (15px) + padding (15px) */
    display: flex;
    flex-direction: row; /* Spinner-1 left, spinner-2 right for intuitive left-to-right placement */
    justify-content: center;
    align-items: center;
    gap: 15px;
}

/* Individual spinner slots */
.element-column .elemental-spinner {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px dashed rgba(255, 255, 255, 0.3);
    background: radial-gradient(circle, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative; /* Position relative for z-index control */
}

/* Override position for merging animation - needs to be fixed to fly across screen */
.element-column .elemental-spinner.merging {
    position: fixed !important;
}

/* Position spinners explicitly side-by-side */
.dual-spinner-container .elemental-spinner[data-slot="1"] {
    margin-right: 0; /* Spinner-1 on the left */
}

.dual-spinner-container .elemental-spinner[data-slot="2"] {
    margin-left: 0; /* Spinner-2 on the right */
}

.element-column .elemental-spinner:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

/* Family-based pulsing glow animations for spinners */
@keyframes pulseFireGlow {
    0%, 100% {
        border-color: rgba(255, 87, 34, 0.6);
        box-shadow: 0 0 15px rgba(255, 87, 34, 0.5), inset 0 0 10px rgba(255, 87, 34, 0.2);
    }
    50% {
        border-color: rgba(255, 87, 34, 1);
        box-shadow: 0 0 25px rgba(255, 87, 34, 0.8), inset 0 0 15px rgba(255, 87, 34, 0.4);
    }
}

@keyframes pulseWaterGlow {
    0%, 100% {
        border-color: rgba(33, 150, 243, 0.6);
        box-shadow: 0 0 15px rgba(33, 150, 243, 0.5), inset 0 0 10px rgba(33, 150, 243, 0.2);
    }
    50% {
        border-color: rgba(33, 150, 243, 1);
        box-shadow: 0 0 25px rgba(33, 150, 243, 0.8), inset 0 0 15px rgba(33, 150, 243, 0.4);
    }
}

@keyframes pulseEarthGlow {
    0%, 100% {
        border-color: rgba(139, 69, 19, 0.6);
        box-shadow: 0 0 15px rgba(139, 69, 19, 0.5), inset 0 0 10px rgba(139, 69, 19, 0.2);
    }
    50% {
        border-color: rgba(139, 69, 19, 1);
        box-shadow: 0 0 25px rgba(139, 69, 19, 0.8), inset 0 0 15px rgba(139, 69, 19, 0.4);
    }
}

@keyframes pulseAirGlow {
    0%, 100% {
        border-color: rgba(200, 200, 255, 0.6);
        box-shadow: 0 0 15px rgba(200, 200, 255, 0.5), inset 0 0 10px rgba(200, 200, 255, 0.2);
    }
    50% {
        border-color: rgba(200, 200, 255, 1);
        box-shadow: 0 0 25px rgba(200, 200, 255, 0.8), inset 0 0 15px rgba(200, 200, 255, 0.4);
    }
}

/* Apply family-specific glows to spinners with elements */
.element-column .elemental-spinner.family-fire {
    border: 3px solid rgba(255, 87, 34, 0.8) !important;
    animation: pulseFireGlow 2s ease-in-out infinite;
}

.element-column .elemental-spinner.family-water {
    border: 3px solid rgba(33, 150, 243, 0.8) !important;
    animation: pulseWaterGlow 2s ease-in-out infinite;
}

.element-column .elemental-spinner.family-earth {
    border: 3px solid rgba(139, 69, 19, 0.8) !important;
    animation: pulseEarthGlow 2s ease-in-out infinite;
}

.element-column .elemental-spinner.family-air {
    border: 3px solid rgba(200, 200, 255, 0.8) !important;
    animation: pulseAirGlow 2s ease-in-out infinite;
}

/* Ready to merge state - pulsing effect */
.element-column .elemental-spinner.ready-to-merge {
    border: 3px solid rgba(255, 215, 0, 0.8);
    animation: readyToMergePulse 0.8s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
}

@keyframes readyToMergePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 50px rgba(255, 215, 0, 0.9);
    }
}

/* Hide old horizontal scroll indicators */
.scroll-indicator {
    display: none !important;
}

/* Hide old kinetic scroll containers */
.kinetic-scroll-container {
    display: none !important;
}
