/**
 * @file train.css
 * @description Page-specific styles for Marwadi Chess "Train Yourself" Tactics Arena & Focused Zen Mode.
 */

.trainer-container,
#mchessTrainerContainer {
    max-width: 1120px;
    margin: 0 auto;
    box-sizing: border-box;
    width: 100%;
}

.trainer-viewer-container {
    margin: 4px auto 14px auto !important;
    max-width: 1120px !important;
}

/* Unified Card Header */
.trainer-badge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

[data-theme="dark"] .trainer-badge-header,
body.dark-theme .trainer-badge-header {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

.trainer-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.trainer-tech-pill {
    background: rgba(56, 189, 248, 0.15);
    color: #0284c7;
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

[data-theme="dark"] .trainer-tech-pill,
body.dark-theme .trainer-tech-pill {
    color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.15) !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
}

/* Mode Selector & Action Buttons Toolbar */
.trainer-modes-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    width: 100%;
}

.trainer-modes-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.trainer-modes-label {
    color: var(--text-secondary, #475569);
    font-size: 12.5px;
    font-weight: 700;
    margin-right: 2px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

[data-theme="dark"] .trainer-modes-label,
body.dark-theme .trainer-modes-label {
    color: #cbd5e1 !important;
}

.mode-selector-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.mode-chip-btn {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

[data-theme="dark"] .mode-chip-btn,
body.dark-theme .mode-chip-btn {
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
    color: #cbd5e1 !important;
}

.mode-chip-btn:hover {
    background: #f1f5f9;
    color: #0284c7;
    border-color: #0284c7;
    transform: translateY(-1px);
}

[data-theme="dark"] .mode-chip-btn:hover,
body.dark-theme .mode-chip-btn:hover {
    background: #1e293b !important;
    color: #38bdf8 !important;
    border-color: #38bdf8 !important;
}

.mode-chip-btn.active {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    color: #ffffff !important;
    border-color: #d97706 !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35) !important;
}

/* Action Control Buttons Group */
.trainer-action-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-trainer-act {
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-trainer-act:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.btn-trainer-act:active {
    transform: translateY(0);
}

.btn-act-restart {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.btn-act-hint {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.btn-act-solution {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.btn-act-skip {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

/* Dynamic Feedback Pill (Toast for hints/errors/solved) */
.trainer-feedback-pill {
    margin: 2px auto 12px auto;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #0284c7;
    max-width: 100%;
    box-sizing: border-box;
}

[data-theme="dark"] .trainer-feedback-pill,
body.dark-theme .trainer-feedback-pill {
    background: rgba(56, 189, 248, 0.15) !important;
    border-color: rgba(56, 189, 248, 0.4) !important;
    color: #38bdf8 !important;
}

/* Strikes / Lives Indicator */
.strikes-container {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
}

.strike-heart {
    color: #ef4444;
    transition: transform 0.2s ease, opacity 0.2s ease;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.5));
}

.strike-heart.lost {
    color: #475569;
    opacity: 0.35;
    filter: none;
    transform: scale(0.85);
}

.shake-effect {
    animation: shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(3px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
    40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* Focused Zen Mode Button */
.btn-zen-mode {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-zen-mode:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.45);
}

/* ==========================================================================
   Focused Calculation Mode (Zen Fullscreen Modal)
   ========================================================================== */
.zen-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    padding: 16px;
    box-sizing: border-box;
}

.zen-board-shell {
    width: 100%;
    max-width: 580px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.zen-topbar {
    width: 100%;
    background: #1e293b;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 12px;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    box-sizing: border-box;
}

.zen-topbar-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
}

.zen-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-exit-zen {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-exit-zen:hover {
    background: #ef4444;
    color: #ffffff;
}

/* Game Over Summary Modal */
.summary-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 18px 0 24px 0;
}

.summary-stat-box {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.summary-stat-box .val {
    font-size: 22px;
    font-weight: 800;
    color: #38bdf8;
}

.summary-stat-box .lbl {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 2px;
}

@media (max-width: 860px) {
    .trainer-modes-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .trainer-modes-left {
        width: 100%;
        justify-content: flex-start;
    }

    .trainer-action-group {
        width: 100%;
        justify-content: space-between;
    }

    .btn-trainer-act {
        flex: 1 1 auto;
        justify-content: center;
        padding: 9px 8px;
        min-height: 44px;
        box-sizing: border-box;
    }
}

@media (max-width: 640px) {
    .trainer-badge-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .trainer-header-actions {
        width: 100%;
    }

    .btn-zen-mode {
        width: 100%;
        justify-content: center;
        min-height: 44px;
        box-sizing: border-box;
    }

    .mode-selector-group {
        width: 100%;
        justify-content: flex-start;
        gap: 6px;
    }

    .mode-chip-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12px;
        min-height: 44px;
        box-sizing: border-box;
    }

    .zen-modal-overlay {
        padding: 6px;
    }

    .zen-board-shell {
        max-width: 100%;
    }

    .zen-topbar {
        padding: 8px 10px;
        font-size: 12px;
    }

    .trainer-container,
    #mchessTrainerContainer {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
