/* helpers/szokoto/style.css */

#helper-szokoto .panel {
    max-width: 800px;
    margin: 0 auto;
}

/* Top Menu Bar Layout (50-50% 2-Column Split, Left Aligned) */
.szokoto-top-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.top-bar-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    max-width: 220px;
}

.top-bar-left .btn,
.top-bar-left .szokoto-select,
.top-bar-left .decoy-stepper-wrapper {
    width: 100%;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.control-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
}

/* Icon Button (Top Right Header) */
.btn-icon {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    color: var(--color-primary-accent);
    border-color: var(--color-primary-accent);
    background-color: var(--color-neutral-shaded);
}

.top-bar-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

/* Stepper Control [-] N [+] */
.decoy-stepper-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background-color: var(--color-bg-surface);
    overflow: hidden;
    height: 36px;
}

.stepper-btn {
    background: none;
    border: none;
    padding: 0 12px;
    height: 100%;
    color: var(--color-text-primary);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stepper-btn:hover {
    background-color: var(--color-neutral-shaded);
    color: var(--color-primary-accent);
}

.stepper-value {
    padding: 0 6px;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--color-text-primary);
    min-width: 18px;
    text-align: center;
    user-select: none;
}

/* Database Select Dropdown */
.szokoto-select {
    height: 36px;
    padding: 0 8px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-surface);
    color: var(--color-text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* Round Steps Indicator Buttons (Full Width Rows & Scores) */
.round-steps-indicator {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}

.step-btn-full {
    width: 100%;
    text-align: center;
}

.step-btn-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.step-btn {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    padding: 6px 14px;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.step-btn.step-num {
    flex: 1;
    height: 46px;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    line-height: 1.1;
}

.num-title {
    font-size: 0.85rem;
    font-weight: 800;
}

.num-score {
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.85;
}

.step-btn:hover {
    color: var(--color-text-primary);
    border-color: var(--color-border-hover);
    background-color: var(--color-neutral-shaded);
}

.step-btn.active {
    background-color: var(--color-primary-accent);
    color: #ffffff;
    border-color: var(--color-primary-accent);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

/* Game Stage & Board Area */
.szokoto-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.outer-clue-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.outer-clue-slot.horizontal-clue {
    width: 100%;
    min-height: 44px;
}

.outer-clue-slot.vertical-clue {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    min-height: 140px;
    position: relative;
    overflow: visible;
}

/* Rotated Left & Right Clue Inputs & Badges with Negative Margin to Cancel Unrotated Flexbox Overhang */
.vertical-clue-left .clue-input,
.vertical-clue-left .clue-badge {
    transform: rotate(-90deg);
    transform-origin: center center;
    margin: 0 -50px;
    flex-shrink: 0;
}

.vertical-clue-right .clue-input,
.vertical-clue-right .clue-badge {
    transform: rotate(90deg);
    transform-origin: center center;
    margin: 0 -50px;
    flex-shrink: 0;
}

.clue-input {
    width: 140px;
    padding: 8px 10px;
    border: 2px solid var(--color-primary-accent);
    border-radius: var(--border-radius-sm);
    background-color: var(--color-bg-surface);
    color: var(--color-text-primary);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.clue-input:focus {
    outline: none;
    border-color: var(--color-primary-accent-hover, #4f46e5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* Static clue badges */
.clue-badge {
    background-color: var(--color-neutral-shaded);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
    white-space: nowrap;
}

/* Middle Layout Row (Left Clue + 2x2 Grid + Right Clue) */
.szokoto-middle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

/* 2x2 Grid Container */
.szokoto-board-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background-color: var(--color-neutral-shaded);
    padding: 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
}

/* Board Slot */
.board-slot {
    width: 140px;
    height: 140px;
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--color-bg-surface);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.board-slot.slot-selected {
    border-color: var(--color-primary-accent);
    background-color: rgba(99, 102, 241, 0.05);
}

.board-slot.slot-correct {
    border: 2px solid var(--color-success) !important;
    background-color: rgba(34, 197, 94, 0.05);
}

.board-slot.slot-incorrect {
    border: 2px solid var(--color-destructive) !important;
    background-color: rgba(239, 68, 68, 0.05);
}

.board-slot.slot-locked {
    pointer-events: none;
}

/* Slot Placeholder Text */
.slot-placeholder {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
}

/* Square Card Component */
.clover-card {
    width: 140px;
    height: 140px;
    background-color: var(--color-bg-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    position: relative;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    user-select: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.clover-card:hover {
    box-shadow: 0 6px 12px -2px rgba(0,0,0,0.15);
    border-color: var(--color-border-hover);
}

.clover-card.selected-in-pool {
    border-color: var(--color-primary-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.clover-card.card-locked {
    border-color: var(--color-success) !important;
    cursor: default;
}

.clover-card.card-incorrect {
    border-color: var(--color-destructive) !important;
    cursor: default;
}

/* Inner Rotatable Container */
.card-inner-rotator {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Card Clover Background (Diagonals & Center Circle) */
.card-clover-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Card Side Wrappers & Symmetric Edge Words */
.card-side-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.card-edge {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--color-text-primary);
    text-transform: uppercase;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: center;
    line-height: 1.05;
    max-width: 82px;
    z-index: 2;
}

/* Card Center Controls Overlay & Progress Ring */
.card-center-action {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: var(--color-text-muted);
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    touch-action: none;
    user-select: none;
}

.card-center-action:hover {
    background-color: var(--color-neutral-shaded);
    color: var(--color-primary-accent);
}

.progress-ring-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 11;
}

.progress-ring-circle {
    stroke-dasharray: 119.38;
    stroke-dashoffset: 119.38;
    transition: stroke-dashoffset 0s linear;
}

.progress-ring-circle.animating {
    transition: stroke-dashoffset 1s linear;
    stroke-dashoffset: 0;
}

/* Lock & Incorrect Badges in Corner */
.card-lock-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background-color: var(--color-success);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    z-index: 12;
}

.card-incorrect-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background-color: var(--color-destructive);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    z-index: 12;
}

/* Card Pool Container */
.szokoto-pool-section {
    width: 100%;
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.pool-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.pool-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.szokoto-pool-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background-color: var(--color-neutral-shaded);
    border-radius: var(--border-radius-sm);
    border: 1px dashed var(--color-border);
    min-height: 160px;
}

/* Action Row (Submit / Save Button) */
.szokoto-action-row {
    width: 100%;
    margin-top: 20px;
}

#btn-submit-action {
    width: 100%;
}

/* Attempt Status Log */
.attempt-log-container {
    margin-top: 16px;
    padding: 12px;
    background-color: var(--color-neutral-shaded);
    border-radius: var(--border-radius-sm);
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.attempt-log-title {
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

/* Custom Szókötő Confirmation Modal Overlay & Content */
.szokoto-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.szokoto-modal-content {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm, 8px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: szokotoModalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes szokotoModalPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-text-primary);
    margin: 0;
}

.modal-message {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.4;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

/* History Accordion Modal Styles */
.history-list-accordion {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 65vh;
    overflow-y: auto;
}

.history-item {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background-color: var(--color-neutral-shaded);
    padding: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.history-item:hover {
    border-color: var(--color-border-hover);
    background-color: var(--color-bg-surface);
}

.history-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.history-left-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    overflow: hidden;
}

.history-date {
    font-weight: 700;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.history-clues-summary {
    font-weight: 800;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-right-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 0.9rem;
    white-space: nowrap;
}

.history-solved-success {
    color: var(--color-success);
}

.history-solved-failed {
    color: var(--color-destructive);
}

.history-chevron {
    transition: transform 0.2s ease;
}

.history-item.open .history-chevron {
    transform: rotate(180deg);
}

/* Expandable Details Body */
.history-details-body {
    display: none;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
}

.history-item.open .history-details-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-section-title {
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}

.szokoto-select {
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-primary);
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.history-hints-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-hint-block {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    padding: 8px 10px;
}

.history-hint-name {
    font-weight: 800;
    font-size: 0.88rem;
    color: var(--color-text-primary);
}

.history-hint-pair {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--color-primary-accent);
    margin-top: 2px;
}

/* Attempts 4 Equal-Width Box Grid */
.history-attempts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.history-attempt-box {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
}

.attempt-box-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-text-muted);
}

.attempt-box-score {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--color-text-primary);
}

.history-view-solution-btn {
    width: 100%;
    margin-top: 8px;
    font-weight: 800;
    font-size: 0.85rem;
}

/* Mobile Responsiveness (<= 768px) */
@media (max-width: 768px) {
    .board-slot,
    .clover-card {
        width: 100px;
        height: 100px;
    }
    
    .edge-right {
        right: -30px;
    }

    .edge-left {
        left: -30px;
    }

    .card-edge {
        font-size: 0.56rem;
        max-width: 70px;
        line-height: 1.05;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .clue-input {
        width: 110px;
        font-size: 0.75rem;
        padding: 4px 6px;
    }

    .clue-badge {
        font-size: 0.75rem;
        padding: 5px 8px;
    }

    .outer-clue-slot.vertical-clue {
        width: 32px;
        min-width: 32px;
        max-width: 32px;
        min-height: 100px;
    }

    .vertical-clue-left .clue-input,
    .vertical-clue-left .clue-badge,
    .vertical-clue-right .clue-input,
    .vertical-clue-right .clue-badge {
        margin: 0 -40px;
    }

    .szokoto-middle-row {
        gap: 8px;
    }

    .szokoto-board-grid {
        gap: 8px;
        padding: 8px;
    }

    .szokoto-top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .top-bar-left {
        max-width: 100%;
        width: 100%;
    }

    .top-bar-right {
        width: 100%;
    }
}
