/* helpers/quantik/style.css */

#helper-quantik {
    --color-quantik-blue: #2563eb;      /* Blue Player */
    --color-quantik-orange: #ea580c;    /* Orange Player */
    --color-quantik-border: var(--color-border);
    height: calc(100vh - 56px); /* Lock view height to remaining viewport */
    overflow: hidden;
    box-sizing: border-box;
}

/* 1. Main Layout Panel */
#helper-quantik .panel {
    max-width: 800px; /* Aligned with Panic Lab */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Top full-width button container */
#helper-quantik .quantik-top-actions {
    width: 100%;
}

#helper-quantik .quantik-top-actions button {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px;
    font-weight: 700;
}

/* Status alerts & active banner */
#helper-quantik .quantik-status-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}





/* 2. Side-by-side Player pool cards */
#helper-quantik .quantik-pools-row {
    display: flex;
    flex-direction: row; /* Always side-by-side */
    gap: 12px;
    width: 100%;
}

#helper-quantik .quantik-pools-row .player-pool-box {
    flex: 1;
}

#helper-quantik .player-pool-box {
    border: 2px solid var(--color-quantik-border);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    background-color: var(--color-bg-surface);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

#helper-quantik .player-pool-box[data-player="blue"].active-pool {
    border-color: var(--color-quantik-blue) !important;
}

#helper-quantik .player-pool-box[data-player="orange"].active-pool {
    border-color: var(--color-quantik-orange) !important;
}

/* Fading inactive player inventory */
#helper-quantik .player-pool-box.inactive-pool {
    opacity: 0.45;
    pointer-events: none;
}

#helper-quantik .pool-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

/* Inventory shapes 2x2 grid layout */
#helper-quantik .shapes-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
}

#helper-quantik .shape-slot {
    border: 1px solid var(--color-quantik-border);
    border-radius: var(--border-radius-sm);
    background-color: var(--color-bg-surface);
    aspect-ratio: 4 / 3;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-sizing: border-box;
    padding: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

#helper-quantik .shape-slot:hover:not(.empty-slot) {
    border-color: var(--color-text-muted);
    transform: translateY(-1px);
}

#helper-quantik .shape-slot.empty-slot {
    cursor: default;
    opacity: 0.15; /* Make it blank and faded */
}

/* Selection state border styling */
#helper-quantik .player-pool-box[data-player="blue"] .shape-slot.active-shape {
    border-color: var(--color-quantik-blue) !important;
    background-color: rgba(37, 99, 235, 0.05) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

#helper-quantik .player-pool-box[data-player="orange"] .shape-slot.active-shape {
    border-color: var(--color-quantik-orange) !important;
    background-color: rgba(234, 88, 12, 0.05) !important;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15) !important;
}

/* Mini SVG shapes sizing rules inside the slot */
#helper-quantik .mini-shapes-row {
    display: flex;
    flex-direction: row;
    gap: 4px;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

#helper-quantik .mini-shapes-row .piece-svg {
    width: 22px !important;
    height: 33px !important;
    max-width: 22px;
    max-height: 33px;
    display: block;
}

#helper-quantik .mini-shapes-row.single-shape .piece-svg {
    width: 26px !important;
    height: 39px !important;
    max-width: 26px;
    max-height: 39px;
}

/* 3. Bottom Playfield Container */
#helper-quantik .quantik-board-container {
    background-color: transparent;
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    flex: 1;
    min-height: 0;
}

#helper-quantik .quantik-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1 / 1;
    background-color: var(--color-bg-surface);
    border: 3px solid var(--color-text-muted);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

/* Grid Cells styling */
#helper-quantik .quantik-cell {
    border: 1px solid var(--color-quantik-border);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    position: relative;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

#helper-quantik .quantik-cell:hover:not(.has-piece) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Divider lines separating the 4 Quadrants */
#helper-quantik .quantik-cell:nth-child(4n + 2) {
    border-right: 3px solid var(--color-text-muted);
}

#helper-quantik .quantik-cell:nth-child(n+5):nth-child(-n+8) {
    border-bottom: 3px solid var(--color-text-muted);
}

/* Inside SVGs */
#helper-quantik .quantik-cell .piece-svg {
    width: 100%;
    height: 100%;
    display: block;
    animation: placePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes placePop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Invalid Placement Animations */
#helper-quantik .quantik-cell.cell-invalid-flash {
    animation: errorShake 0.4s ease-in-out;
    background-color: rgba(185, 28, 28, 0.12) !important;
    border-color: var(--color-destructive) !important;
    z-index: 10;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Winning Highlights */
#helper-quantik .quantik-cell.winning-cell-blue {
    background-color: rgba(37, 99, 235, 0.08) !important;
    border-color: #2563eb !important;
    animation: winFlashBlue 1s infinite alternate;
}

#helper-quantik .quantik-cell.winning-cell-orange {
    background-color: rgba(234, 88, 12, 0.08) !important;
    border-color: #ea580c !important;
    animation: winFlashOrange 1s infinite alternate;
}

@keyframes winFlashBlue {
    0% { box-shadow: inset 0 0 8px rgba(37, 99, 235, 0.2); }
    100% { box-shadow: inset 0 0 16px rgba(37, 99, 235, 0.5); }
}

@keyframes winFlashOrange {
    0% { box-shadow: inset 0 0 8px rgba(234, 88, 12, 0.2); }
    100% { box-shadow: inset 0 0 16px rgba(234, 88, 12, 0.5); }
}

/* Mobile responsive layout (max-width: 768px) */
@media (max-width: 768px) {
    #helper-quantik {
        padding-top: 0;
        padding-bottom: 0;
    }
    #helper-quantik .panel {
        gap: 12px;
        margin: 0 auto;
        height: 100%;
        border-radius: 0; /* Flush on mobile screen edges */
    }
    
    #helper-quantik .player-pool-box {
        padding: 8px;
    }
    
    #helper-quantik .shapes-list {
        gap: 6px;
    }
    
    #helper-quantik .shape-slot {
        padding: 3px;
    }

    #helper-quantik .mini-shapes-row {
        gap: 2px;
    }

    #helper-quantik .mini-shapes-row .piece-svg {
        width: 14px !important;
        height: 21px !important;
        max-width: 14px;
        max-height: 21px;
    }

    #helper-quantik .mini-shapes-row.single-shape .piece-svg {
        width: 18px !important;
        height: 27px !important;
        max-width: 18px;
        max-height: 27px;
    }
    
    #helper-quantik .quantik-board-container {
        padding: 0;
    }
    
    #helper-quantik .quantik-cell {
        padding: 6px;
    }
}
