/* ===================================================================
 * Sequence Reasoning Deck - Dedicated Stylesheet
 * Created: 2025-12-08
 * Purpose: Styles specific to Sequence Reasoning card deck
 * =================================================================== */

/* Sequence Container */
.sequence-container {
    display: flex;
    justify-content: flex-start;
    /* Left-align items (was: center) */
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 2rem 2rem;
    padding: 0.5rem;
    transform: scale(1) !important;
    zoom: 1 !important;
}

/* Sequence Item - 80x80px discs - Force size with !important to override any parent scaling */
.sequence-item {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    /* Default circular, but can be overridden for shapes */
    font-size: 1.5rem !important;
    font-weight: bold !important;
    /* color set dynamically via inline style based on background brightness */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: 40px !important;
    position: relative !important;
    border: none !important;
    outline: none !important;
    overflow: hidden !important;
    transform: scale(1) !important;
    transition: transform 0.2s ease !important;
}

/* Shape items: remove circular shape and allow overflow */
.sequence-item-shape {
    border-radius: 0 !important;
    overflow: visible !important;
    background-color: transparent !important;
    box-shadow: none !important;
    /* Remove shadow for shapes */
}

/* Emoji and seasonal icon sizing */
.sequence-item-emoji,
.sequence-item-seasonal-icon {
    width: 37px !important;
    height: 37px !important;
    min-width: 37px !important;
    max-width: 37px !important;
    min-height: 37px !important;
    max-height: 37px !important;
    font-size: 37px !important;
    line-height: 37px !important;
}

.sequence-item-seasonal-icon img {
    width: 50px !important;
    height: 50px !important;
    object-fit: contain !important;
    display: block !important;
}

/* Remove circular shape for sequence items containing images (shapes) - using :has() as fallback */
.sequence-item:has(img) {
    border-radius: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    /* Remove shadow for shapes */
}

.sequence-item img {
    border-radius: 0 !important;
    display: block !important;
}

.sequence-item:hover {
    transform: scale(1.05) !important;
}

/* Missing item (gray disc with "?") */
.sequence-item.missing {
    background-color: #EAEAEA !important;
}

/* Prevent any parent scaling - apply to all possible parent containers */
#sentenceContainer_front .sequence-item,
#sentenceContainer_frontc .sequence-item,
#sentenceContainer_back .sequence-item,
.card-face .sequence-item,
.card-front .sequence-item,
.card-front2 .sequence-item,
.custom-card .sequence-item,
.sequence-container .sequence-item {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    transform: scale(1) !important;
    flex-basis: 40px !important;
}

/* Only prevent scaling on sequence items themselves, not parent containers */
/* Parent container transforms are needed for card flip animations */

/* Nuclear option: Force 80px on sequence items regardless of any parent scaling */
div.sequence-item,
.sequence-item,
[class*="sequence-item"] {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    transform: scale(1) !important;
    zoom: 1 !important;
}

/* Sequence Choice Buttons - 2-column layout matching progress bar width (270px) */
/* Stretch vertically and center buttons within available space */
/* CRITICAL: Override Bootstrap d-grid and row classes immediately to prevent flash */
#multipleChoiceContainerFront.sequence-choice-layout,
#multipleChoiceContainerFrontc.sequence-choice-layout,
#multipleChoiceContainerBack.sequence-choice-layout,
#multipleChoiceContainerFront.sequence-choice-layout.d-grid,
#multipleChoiceContainerFrontc.sequence-choice-layout.d-grid,
#multipleChoiceContainerBack.sequence-choice-layout.d-grid,
#multipleChoiceContainerFront.sequence-choice-layout.row,
#multipleChoiceContainerFrontc.sequence-choice-layout.row,
#multipleChoiceContainerBack.sequence-choice-layout.row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    align-content: center !important;
    gap: 0 !important;
    /* Using margins on buttons instead */
    width: 270px !important;
    max-width: 270px !important;
    margin: 1rem auto !important;
    padding: 0 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    /* Override Bootstrap grid properties */
    grid-template-columns: none !important;
    grid-auto-flow: unset !important;
}

/* Individual buttons in 2-column layout */
#multipleChoiceContainerFront.sequence-choice-layout .choice-btn,
#multipleChoiceContainerFrontc.sequence-choice-layout .choice-btn,
#multipleChoiceContainerBack.sequence-choice-layout .choice-btn {
    /* Make buttons narrower to allow for spacing */
    width: calc((270px - 10px) / 2 - 5px) !important;
    margin-bottom: 10px !important;
    margin-top: 10px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    flex: 0 0 calc((270px - 10px) / 2 - 5px) !important;
    min-width: calc((270px - 10px) / 2 - 5px) !important;
    max-width: calc((270px - 10px) / 2 - 5px) !important;
}

/* Add spacing after left column buttons (1st and 3rd) */
#multipleChoiceContainerFront.sequence-choice-layout .choice-btn:nth-child(1),
#multipleChoiceContainerFront.sequence-choice-layout .choice-btn:nth-child(3),
#multipleChoiceContainerFrontc.sequence-choice-layout .choice-btn:nth-child(1),
#multipleChoiceContainerFrontc.sequence-choice-layout .choice-btn:nth-child(3),
#multipleChoiceContainerBack.sequence-choice-layout .choice-btn:nth-child(1),
#multipleChoiceContainerBack.sequence-choice-layout .choice-btn:nth-child(3) {
    margin-right: 10px !important;
}

/* Override default choice-btn margin-bottom for sequence cards */
.sequence-choice-layout .choice-btn {
    margin-bottom: 0 !important;
}

/* Box-shadow: Let appstyle.css handle it - buttons are inside #cardFront1/#cardFront2 */
/* The existing rule #cardFront1 .choice-btn:not(...) should apply automatically */

/* Spacing: Add margin between question text and sequence */
#sentenceContainer_front.sequence-card #sentenceQuestion1,
#sentenceContainer_frontc.sequence-card #sentenceQuestion1c {
    margin-bottom: 20px !important;
    display: block !important;
}

/* Bottom-align sequence container within sentenceContainer (all card faces) */
#sentenceContainer_front.sequence-card,
#sentenceContainer_frontc.sequence-card,
#sentenceContainer_back.sequence-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    /* Changed from center to flex-end for bottom alignment */
    align-items: center !important;
    flex: 0 0 auto !important;
}

/* Spacing: Sequence container should have top margin to separate from question */
#sentenceContainer_front.sequence-card .sequence-container,
#sentenceContainer_frontc.sequence-card .sequence-container,
#sentenceContainer_back.sequence-card .sequence-container {
    margin-top: 0 !important;
    margin-bottom: 1rem !important;
}

/* Box-shadow: appstyle.css rule should apply automatically since buttons are inside #cardFront1/#cardFront2 */
/* The rule #cardFront1 .choice-btn:not(...) matches #cardFront1 .sequence-choice-layout .choice-btn */
/* No override needed - appstyle.css handles it */