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

/* Main Layout */
.game-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 1rem 2rem 1rem;
    box-sizing: border-box;
    min-height: calc(100vh - 80px);
}

.board-container {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.info-wrapper {
    flex: 0.8;
    width: 100%;
    max-width: 400px;
    margin-top: 92px; /* Aligns settings card with the top of the board wrapper */
}

/* Glassmorphism Cards */
.glass-card {
    background: rgba(10, 15, 28, 0.65);
    border: 1px solid rgba(0, 210, 255, 0.15);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 210, 255, 0.05);
    backdrop-filter: blur(8px);
    margin-bottom: 1.5rem;
    box-sizing: border-box;
}

/* Status Bar */
.game-status-bar {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #ffffff;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.status-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px currentColor;
}

.color-blue {
    background-color: #00d2ff;
    color: #00d2ff;
}

.color-white {
    background-color: #ffffff;
    color: #ffffff;
}

/* Connect 4 Board Styles */
.connect4-board-wrapper {
    position: relative;
    border: 12px solid #1e293b;
    border-radius: 24px;
    padding: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(0, 210, 255, 0.15);
    width: 100%;
    max-width: 540px;
    box-sizing: border-box;
    margin-top: 50px; /* Space for the floating previews */
    background: #090e1a; /* Dark space background under layers */
}

/* Board Container containing layered components */
.connect4-board {
    position: relative;
    width: 100%;
    aspect-ratio: 7 / 6;
}

/* Back Layer (Discs Container) */
.discs-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 0;
    z-index: 1;
    pointer-events: none;
}

.disc-slot {
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: radial-gradient(circle, #090e1a 50%, #060912 100%); /* Deep space wall */
}

/* SVG Front Plate with Cutouts */
.board-front-plate {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Front Interaction & Detail Layer */
.masks-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 0;
    z-index: 3;
}

.mask-slot {
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    cursor: pointer;
    transition: background-color 0.25s ease;
    box-shadow: inset -1px -1px 0 rgba(0, 210, 255, 0.12);
}

.mask-slot:nth-child(7n+1) {
    box-shadow: inset 1px -1px 0 rgba(0, 210, 255, 0.12), inset -1px 0 0 rgba(0, 210, 255, 0.12);
}

.mask-slot:nth-child(-n+7) {
    box-shadow: inset 0 1px 0 rgba(0, 210, 255, 0.12), inset -1px -1px 0 rgba(0, 210, 255, 0.12);
}

.mask-slot:nth-child(7n+1):nth-child(-n+7) {
    box-shadow: inset 1px 1px 0 rgba(0, 210, 255, 0.12), inset -1px -1px 0 rgba(0, 210, 255, 0.12);
}

.mask-slot:hover {
    background-color: rgba(0, 210, 255, 0.04); /* Highlight hole column area */
}

/* 3D Deep Wall & Inset Shadow Overlay for each cutout */
.mask-slot::before {
    content: '';
    position: absolute;
    top: 9%;
    left: 9%;
    width: 82%;
    height: 82%;
    border-radius: 50%;
    border: 2.5px solid #14233c; /* Realistic circular dark blue inner wall */
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.85); /* Deep inset shadow cast on disc */
    pointer-events: none;
    z-index: 4;
    box-sizing: border-box !important;
}

/* Discs (Rendered at z-index: 1, behind masks. Sized larger than cutout for depth effect) */
.disc {
    position: absolute;
    top: 6%;
    left: 6%;
    width: 88%;
    height: 88%;
    border-radius: 50%;
    z-index: 1;
    box-sizing: border-box;
}

.disc.blue {
    background: radial-gradient(circle at 35% 35%, #00d2ff 0%, #0066ff 60%, #0033aa 100%);
    box-shadow: 0 4px 10px rgba(0, 102, 255, 0.5), inset 0 -3px 6px rgba(0,0,0,0.5), inset 0 3px 6px rgba(255,255,255,0.4);
}

.disc.white {
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #e6e6e6 60%, #b3b3b3 100%);
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.3), inset 0 -3px 6px rgba(0,0,0,0.3), inset 0 3px 6px rgba(255,255,255,0.6);
}

/* Fall Animation with Bounce (Starts at -1000px and falls behind front masks) */
.disc.falling {
    animation: fall-anim 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes fall-anim {
    0% {
        transform: translateY(var(--fall-distance, -1000px));
    }
    60% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(-16px);
    }
    90% {
        transform: translateY(0);
    }
    95% {
        transform: translateY(-4px);
    }
    100% {
        transform: translateY(0);
    }
}

.previews-row {
    position: absolute;
    bottom: 100%;
    margin-bottom: 8px;
    left: 12px;
    right: 12px;
    aspect-ratio: 7 / 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    pointer-events: none;
    z-index: 5;
}

.preview-slot {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-disc {
    width: 88%;
    height: 88%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    opacity: 0.5;
    border: 2px dashed #ffffff;
    transform: scale(0.9);
    display: none;
    animation: previewFloat 1.5s infinite ease-in-out;
}

.preview-disc.blue {
    background: radial-gradient(circle at 35% 35%, #00d2ff 0%, #0066ff 60%, #0033aa 100%);
    box-shadow: 0 4px 10px rgba(0, 102, 255, 0.3);
}

.preview-disc.white {
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #e6e6e6 60%, #b3b3b3 100%);
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.2);
}

@keyframes previewFloat {
    0%, 100% { transform: translateY(0) scale(0.9); }
    50% { transform: translateY(-6px) scale(0.95); }
}

/* Scoreboard */
.scoreboard {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.score-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.8rem;
    text-align: center;
    transition: border-color 0.3s;
}

.score-box.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.15);
}

.score-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-val {
    font-size: 1.8rem;
    font-weight: 800;
}

.score-val.blue-text {
    color: #00d2ff;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.score-val.white-text {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Control Groups */
.control-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.control-buttons-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.toggle-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 0.6rem 0.4rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.toggle-btn.active {
    background: var(--accent-color, #00d2ff);
    color: #000000;
    border-color: var(--accent-color, #00d2ff);
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.4);
}

/* Action Buttons */
.game-actions {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    margin-top: 1rem;
}

.action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.8rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover:not(:disabled) {
    background: var(--accent-color);
    color: #000000;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.danger {
    border-color: #ff3366;
    color: #ff3366;
    background: rgba(255, 51, 102, 0.1);
}

.action-btn.danger:hover {
    background: #ff3366;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.4);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Modal Overlay */
.game-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 6, 12, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
    padding: 1rem;
    box-sizing: border-box;
}

.game-modal-overlay.show {
    display: flex !important;
}

.modal-card {
    background: rgba(10, 15, 28, 0.95);
    border: 2px solid var(--accent-color);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 210, 255, 0.2);
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-title {
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.8rem;
    letter-spacing: 1px;
}

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

/* Rules Modal (Scrollable internal body) */
.rules-card {
    max-width: 520px;
    text-align: left;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    background: rgba(10, 15, 25, 0.96) !important;
}

.rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.rules-header h3 {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin: 0;
    font-weight: 700;
}

.close-rules-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-rules-btn:hover {
    color: #ffffff;
}

.rules-body {
    overflow-y: auto;
    padding-right: 8px;
    flex-grow: 1;
}

.rule-section {
    margin-bottom: 1.2rem;
}

.rule-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rule-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Winning line glow - overlays a pulsing neon ring directly over cutout hole */
.mask-slot.winner::after {
    content: '';
    position: absolute;
    top: 6%;
    left: 6%;
    width: 88%;
    height: 88%;
    border-radius: 50%;
    border: 4px solid #00ffaa;
    box-shadow: 0 0 15px #00ffaa, inset 0 0 10px #00ffaa;
    animation: winPulse 1s infinite alternate;
    pointer-events: none;
    z-index: 10;
}

@keyframes winPulse {
    0% { transform: scale(0.98); opacity: 0.8; }
    100% { transform: scale(1.02); opacity: 1; }
}

/* Thinking state overlay */
.thinking-overlay {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 15, 28, 0.85);
    border: 1px solid rgba(0, 210, 255, 0.3);
    padding: 6px 16px;
    border-radius: 20px;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 700;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 15;
}

.thinking-dots span {
    animation: thinkingDots 1.4s infinite both;
    display: inline-block;
    font-size: 1.2rem;
    line-height: 1;
}
.thinking-dots span:nth-child(2) { animation-delay: .2s; }
.thinking-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes thinkingDots {
    0% { opacity: .2; transform: translateY(0); }
    20% { opacity: 1; transform: translateY(-2px); }
    100% { opacity: .2; transform: translateY(0); }
}

/* Premium Fullscreen Mode */
.game-layout:fullscreen {
    background: radial-gradient(circle at center, #0d1527 0%, #03060c 100%) !important;
    padding: 2rem 3rem !important;
    overflow-y: auto !important;
    min-height: 100vh !important;
    height: auto !important;
    width: 100vw !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3rem !important;
    box-sizing: border-box !important;
}

.game-layout:fullscreen .board-container {
    flex: 1.6 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
}

.game-layout:fullscreen .connect4-board-wrapper {
    max-width: 85vw !important;
    max-height: 80vh !important;
    width: calc((80vh - 48px) * 7 / 6 + 48px) !important;
    height: 80vh !important;
    border: 12px solid #1e293b !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 60px rgba(0,0,0,0.8), 0 0 40px rgba(0, 210, 255, 0.2) !important;
    margin-top: 50px !important;
}

.game-layout:fullscreen .info-wrapper {
    flex: 0.7 !important;
    max-width: 380px !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    margin-top: 0 !important; /* Reset layout margin in fullscreen */
}

.game-layout:fullscreen .glass-card {
    background: rgba(10, 15, 25, 0.8) !important;
    border-color: rgba(0, 210, 255, 0.25) !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6) !important;
}

/* Screen size adaptations for standard pages and fullscreen */
@media (max-width: 1024px) or (orientation: portrait) {
    .game-layout:fullscreen {
        flex-direction: column !important;
        padding: 1.5rem 1rem !important;
        overflow-y: auto !important;
        justify-content: flex-start !important;
        gap: 1.5rem !important;
    }

    .game-layout:fullscreen .board-container {
        flex: none !important;
        width: 100% !important;
        height: auto !important;
    }

    .game-layout:fullscreen .connect4-board-wrapper {
        width: 95vw !important;
        height: calc((95vw - 32px) * 6 / 7 + 32px) !important;
        max-height: 60vh !important;
        border-width: 8px !important;
        padding: 8px !important;
    }

    .game-layout:fullscreen .info-wrapper {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 0 !important;
    }
}

/* Mobile Responsive styling for regular viewport */
@media (max-width: 900px) {
    .game-layout {
        flex-direction: column;
        align-items: center;
        padding-top: 5rem;
    }

    .board-container {
        width: 100%;
        margin-bottom: 1.5rem;
    }

    .info-wrapper {
        width: 100%;
        max-width: 100%;
        margin-top: 0; /* Reset layout margin on mobile stacking */
    }

    .scoreboard {
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .connect4-board-wrapper {
        border-width: 6px;
        padding: 6px;
        margin-top: 40px;
    }
    .connect4-board {
        gap: 0;
    }
    .previews-row {
        gap: 0 !important;
        margin-bottom: 6px !important;
        left: 6px !important;
        right: 6px !important;
    }
    .game-status-bar {
        font-size: 1.2rem;
    }
}
