/* minesweeper.css — celikezor minesweeper oyunu stilleri */
/* Template: templates/data_manager/games/minesweeper.html'den çıkarıldı */

.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    gap: 1.5rem;
    padding: 2.5rem 1rem 1rem 1rem;
    min-height: calc(100vh - 120px);
    box-sizing: border-box;
}

.game-header-title {
    color: var(--accent-color);
    font-size: 2.5rem;
    font-weight: 300;
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.35);
    margin-bottom: 0.5rem;
    text-align: center;
}

.glass-card {
    background: rgba(10, 15, 25, 0.65);
    backdrop-filter: blur(10px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    transition: all 0.2s ease;
}

/* Fullscreen Mode override */
.glass-card.fullscreen-active {
    width: 100vw;
    min-height: 100vh !important;
    height: auto !important;
    max-width: 100vw;
    max-height: none !important;
    border-radius: 0;
    border: none;
    padding: 2rem 1.5rem;
    background: #02050a;
    box-shadow: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow-y: auto !important;
}

/* Hide title in fullscreen to save space */
.glass-card.fullscreen-active ~ .game-header-title {
    display: none;
}

/* Controls Panel */
.controls-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    gap: 1rem;
    flex-wrap: wrap;
}

.difficulty-group {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 250px;
}

.diff-btn {
    flex: 1;
    background: rgba(19, 34, 56, 0.3);
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 0.6rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    text-align: center;
}

.diff-btn:hover {
    border-color: var(--accent-color);
    color: #ffffff;
}

.diff-btn.active {
    background: var(--active-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.25);
}

.sound-toggle-btn {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    box-sizing: border-box;
}

.sound-toggle-btn:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(0, 210, 255, 0.15);
}

.sound-toggle-btn.muted {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

/* Mobile Click/Flag Mode Switcher */
.mobile-mode-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 600px;
}

.mode-switch-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(19, 34, 56, 0.3);
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.mode-switch-btn.active {
    background: var(--active-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
}

.mode-switch-btn.active.flag-active {
    background: rgba(255, 170, 0, 0.1);
    border-color: #ffaa00;
    color: #ffaa00;
    box-shadow: 0 0 12px rgba(255, 170, 0, 0.2);
}

/* Minesweeper LED Console style scoreboard */
.minesweeper-console {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #02050a;
    border: 2px solid var(--surface-border);
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 210, 255, 0.05);
}

.console-counter {
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.7);
    letter-spacing: 2px;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 10px;
    border-radius: 6px;
    border: 1px solid rgba(0, 210, 255, 0.15);
    min-width: 75px;
    text-align: center;
    user-select: none;
}

.console-counter.danger-color {
    color: var(--danger-color);
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.7);
    border-color: rgba(255, 51, 51, 0.15);
}

/* Glowing restart face button */
.face-btn {
    background: rgba(19, 34, 56, 0.5);
    border: 1.5px solid var(--surface-border);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    user-select: none;
    box-sizing: border-box;
}

.face-btn:hover {
    transform: scale(1.08);
    border-color: var(--accent-color);
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.3);
}

.face-btn:active {
    transform: scale(0.95);
}

.smiley-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Pulsing animations for game over restart reminder */
@keyframes faceGlowDanger {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 51, 51, 0.4), inset 0 0 5px rgba(255, 51, 51, 0.2);
        border-color: rgba(255, 51, 51, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 51, 51, 0.95), inset 0 0 15px rgba(255, 51, 51, 0.5);
        border-color: #ff3333;
        background: rgba(255, 51, 51, 0.15);
        transform: scale(1.15);
    }
}

@keyframes faceGlowSuccess {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 210, 255, 0.4), inset 0 0 5px rgba(0, 210, 255, 0.2);
        border-color: rgba(0, 210, 255, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 210, 255, 0.95), inset 0 0 15px rgba(0, 210, 255, 0.5);
        border-color: var(--accent-color);
        background: rgba(0, 210, 255, 0.15);
        transform: scale(1.15);
    }
}

.face-btn.glow-danger {
    animation: faceGlowDanger 1.2s infinite ease-in-out;
}

.face-btn.glow-success {
    animation: faceGlowSuccess 1.2s infinite ease-in-out;
}

/* Board Frame - Centered and completely non-scrolling */
.board-frame {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding: 0.5rem;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
}

/* The actual Minesweeper Grid - Dynamic gap and padding to save space on mobile */
.mines-grid {
    display: grid;
    gap: max(1px, calc(var(--cell-size) * 0.08));
    background: rgba(13, 20, 35, 0.9);
    border: 2px solid var(--surface-border);
    border-radius: 10px;
    padding: max(2px, calc(var(--cell-size) * 0.15));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 210, 255, 0.05);
    box-sizing: border-box;
    margin: 0 auto;
    touch-action: manipulation;
    user-select: none;
}

.mines-grid.shaking {
    animation: boardShake 0.4s ease-out;
}

/* Cell sizes defined dynamically via CSS variable calculated in JS */
.grid-cell {
    width: var(--cell-size, 32px);
    height: var(--cell-size, 32px);
    aspect-ratio: 1 / 1;
    background: rgba(22, 34, 57, 0.7);
    border: 1px solid rgba(0, 210, 255, 0.12);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: calc(var(--cell-size, 32px) * 0.6);
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
    user-select: none;
    position: relative;
}

.grid-cell:hover:not(.revealed):not(.flagged) {
    background: rgba(0, 210, 255, 0.15);
    border-color: var(--accent-color);
    box-shadow: 0 0 6px rgba(0, 210, 255, 0.4);
}

/* Revealed empty or number cells */
.grid-cell.revealed {
    background: rgba(8, 12, 22, 0.9);
    border-color: rgba(19, 34, 56, 0.5);
    cursor: default;
}

.grid-cell i {
    font-size: calc(var(--cell-size, 32px) * 0.55);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Custom colors for cell numbers */
.grid-cell.num-1 { color: #00d2ff; text-shadow: 0 0 5px rgba(0, 210, 255, 0.5); }
.grid-cell.num-2 { color: #00ff66; text-shadow: 0 0 5px rgba(0, 255, 102, 0.5); }
.grid-cell.num-3 { color: #ff3333; text-shadow: 0 0 5px rgba(255, 51, 51, 0.5); }
.grid-cell.num-4 { color: #d000ff; text-shadow: 0 0 5px rgba(208, 0, 255, 0.5); }
.grid-cell.num-5 { color: #ff8800; text-shadow: 0 0 5px rgba(255, 136, 0, 0.5); }
.grid-cell.num-6 { color: #00ffff; text-shadow: 0 0 5px rgba(0, 255, 255, 0.5); }
.grid-cell.num-7 { color: #ffffff; text-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
.grid-cell.num-8 { color: #888888; }

/* Flagged Cell style */
.grid-cell.flagged {
    color: #ffaa00;
    text-shadow: 0 0 8px rgba(255, 170, 0, 0.7);
}

/* Blown mine or standard mine display */
.grid-cell.mine {
    background: rgba(255, 51, 51, 0.15) !important;
    border-color: var(--danger-color) !important;
    color: var(--danger-color);
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.8);
}

.grid-cell.mine.exploded {
    background: rgba(255, 51, 51, 0.45) !important;
    border-color: #ff0000 !important;
    animation: explodePulse 0.3s ease-out;
}

.grid-cell.wrong-flag {
    background: rgba(255, 255, 255, 0.05);
    color: #ff3333;
    text-shadow: 0 0 8px rgba(255, 51, 51, 0.6);
    position: relative;
}

.grid-cell.wrong-flag::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: #ff3333;
    transform: rotate(45deg);
    box-shadow: 0 0 6px rgba(255, 51, 51, 0.6);
}

/* Modal Overlay styling */
.game-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 12, 0.85);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-card {
    background: rgba(10, 14, 23, 0.95);
    border: 2px solid var(--accent-color);
    border-radius: 16px;
    padding: 2.2rem;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 210, 255, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 380px;
    width: 90%;
    box-sizing: border-box;
}

.game-modal-overlay.show .modal-card {
    transform: scale(1);
}

.modal-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
}

.modal-title.win {
    color: var(--accent-color);
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.6);
}

.modal-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-btn {
    background: var(--accent-color);
    color: #000000;
    border: none;
    padding: 0.8rem 1.8rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.modal-btn:hover {
    background: #00b8e6;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.45);
    transform: translateY(-2px);
}

/* Keyframes */
@keyframes boardShake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-6px); }
    30%, 60%, 90% { transform: translateX(6px); }
}

@keyframes explodePulse {
    0% { transform: scale(1); filter: brightness(1.8); }
    50% { transform: scale(1.15); filter: brightness(2.2); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* Mobile responsive media queries with tighter spacing */
@media (max-width: 768px) {
    .game-layout {
        padding: 1rem 0.5rem 0.5rem 0.5rem;
        gap: 1rem;
    }

    .game-header-title {
        font-size: 1.8rem;
        margin-bottom: 0.2rem;
    }

    .glass-card {
        padding: 0.75rem;
        gap: 0.8rem;
    }

    .glass-card.fullscreen-active {
        padding: 0.5rem;
    }

    .minesweeper-console {
        padding: 0.5rem 0.8rem;
    }

    .console-counter {
        font-size: 1.5rem;
        min-width: 55px;
        padding: 2px 4px;
    }

    .face-btn {
        width: 38px;
        height: 38px;
        padding: 4px;
    }
}

@media (max-width: 480px) {
    .difficulty-group {
        min-width: 100%;
    }
}

/* Mobile Touch Standardizations */
canvas, .minesweeper-layout, .mines-grid {
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
