﻿/* CSS Kodları */
/* Genel Siyah Tema */
body {
    display: flex;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: auto;
    background-color: #2c2c2c;
    box-shadow: 0 0 40px rgba(0, 188, 212, 0.25);
    border-radius: 15px;
    overflow: hidden;
    min-height: 90vh;
    border: 1px solid #444;
}

/* Sol Alan: Izgara Simülasyonu */
.simulation-area {
    flex: 2;
    padding: 15px 25px 25px 25px;
    background-color: #000;
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Simülasyon Alanı Kenarlık Animasyonu */
@keyframes borderGlow {
    0% {
        border-color: #00bcd4;
        box-shadow: 0 0 10px rgba(0, 188, 212, 0.5);
    }

    50% {
        border-color: #00e0ff;
        box-shadow: 0 0 20px rgba(0, 224, 255, 0.8);
    }

    100% {
        border-color: #00bcd4;
        box-shadow: 0 0 10px rgba(0, 188, 212, 0.5);
    }
}

.simulation-area {
    animation: borderGlow 4s infinite alternate;
}


#grid-container {
    width: 100%;
    padding-bottom: 50%;
    position: relative;
    background-color: transparent;
    border: 3px solid #00bcd4;
    box-shadow: 0 0 25px rgba(0, 188, 212, 0.8);
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    margin-bottom: 20px;
    margin-top: 5px;
}

/* Renkli Alan Stili */
.colored-area {
    position: absolute;
    opacity: 0.7;
    z-index: 0; /* mBot'un altında kalmalı */
    transition: all 0.4s ease-in-out;
}

    .colored-area.red {
        background-color: #f44336;
        box-shadow: 0 0 10px #f44336;
    }

    .colored-area.blue {
        background-color: #2196f3;
        box-shadow: 0 0 10px #2196f3;
    }

    .colored-area.green {
        background-color: #4caf50;
        box-shadow: 0 0 10px #4caf50;
    }


/* Engel Stili (Kırmızı) */
.obstacle {
    position: absolute;
    background-color: #ff5722;
    opacity: 0.9;
    box-shadow: 0 0 15px rgba(255, 87, 34, 0.8);
    border: 1px solid #e64a19;
    z-index: 5;
    filter: drop-shadow(0 0 5px rgba(255, 87, 34, 0.7));
}

/* TAŞINABİLİR BLOK Stili (Sarı/Turuncu) */
.movable-block {
    position: absolute;
    background-color: #ffc107; /* Sarı */
    opacity: 1;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.9);
    border: 2px dashed #e65100; /* Koyu Turuncu Çerçeve */
    z-index: 5;
    transition: all 0.4s ease-in-out; /* Hareket animasyonu için */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: #333;
    font-weight: bold;
}

    .movable-block::after {
        content: "İT";
        font-size: 0.8em;
        color: #e65100;
    }


/* Hedef İşaretçisi */
#goal-marker {
    position: absolute;
    width: 28px;
    height: 38px;
    background-color: transparent;
    border-radius: 2px;
    z-index: 10;
    transition: all 0.4s ease-in-out;
    pointer-events: none;
    transform-origin: bottom center;
    filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.9));
}

.flag-pole {
    position: absolute;
    bottom: 0;
    left: 12px;
    width: 4px;
    height: 100%;
    background-color: #f8f9fa;
    border-radius: 1px;
}

.flag {
    position: absolute;
    top: 0;
    left: 4px;
    width: 20px;
    height: 14px;
    background-color: #ff0000;
    border-top-right-radius: 50%;
    border-bottom-right-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 0, 0, 1);
}

/* Izgaranın Kendi Çizgileri - Artık daha belirgin ve parlayan */
.grid-line-v, .grid-line-h {
    position: absolute;
    background-color: rgba(0, 188, 212, 0.4);
    opacity: 0.7;
    box-shadow: 0 0 5px rgba(0, 188, 212, 0.6);
}

.grid-line-v {
    width: 1px;
    height: 100%;
}

.grid-line-h {
    width: 100%;
    height: 1px;
}

/* mBot'un İzlediği Yol - Daha dinamik */
.mbot-path-segment {
    position: absolute;
    background-color: rgba(255, 160, 0, 0.9);
    border-radius: 50%;
    transition: all 0.4s linear;
    z-index: 0;
    box-shadow: 0 0 8px 3px rgba(255, 160, 0, 1);
}

/* MBOT BOYUTU */
#mbot {
    position: absolute;
    width: 50px;
    height: 60px;
    transition: all 0.4s ease-in-out;
    transform-origin: center center;
    z-index: 1;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.9));
}

.robot-body {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #00e0ff 0%, #0096ff 100%);
    border-radius: 10px;
    border: 2px solid #5a5a5a;
    box-shadow: 0 0 25px rgba(0, 224, 255, 1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 5px;
    box-sizing: border-box;
}

/* Renk Sensörü Görseli (mBot altında) */
#color-sensor {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #f0f0f0;
    bottom: 5px;
    left: calc(50% - 6px);
    border: 2px solid #555;
    z-index: 3;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
    transition: background-color 0.2s;
}


/* Tekerlekler */
.wheel {
    position: absolute;
    width: 14px;
    height: 8px;
    background-color: #222;
    border: 1px solid #444;
    border-radius: 4px;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.9);
}

    .wheel.front-left {
        top: -5px;
        left: 0px;
    }

    .wheel.front-right {
        top: -5px;
        right: 0px;
    }

    .wheel.back-left {
        bottom: -5px;
        left: 0px;
    }

    .wheel.back-right {
        bottom: -5px;
        right: 0px;
    }

/* Yön oku */
#mbot-direction {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 14px solid #fff;
    top: -12px;
    left: calc(50% - 8px);
    z-index: 2;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.7));
}

/* LED'ler */
.mbot-led {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #333;
    box-shadow: 0 0 5px rgba(0,0,0,0.8);
    transition: background-color 0.2s ease-out, box-shadow 0.2s ease-out;
    border: 1px solid #555;
}

    .mbot-led.left-front {
        margin-left: 4px;
    }

    .mbot-led.right-front {
        margin-right: 4px;
    }

/* LED Parlama Animasyonu */
@keyframes ledGlowPulse {
    0% {
        box-shadow: 0 0 8px 2px var(--led-color, #fff);
    }

    50% {
        box-shadow: 0 0 12px 4px var(--led-color, #fff);
    }

    100% {
        box-shadow: 0 0 8px 2px var(--led-color, #fff);
    }
}

.mbot-led.glow {
    animation: ledGlowPulse 1.5s infinite alternate;
}


/* Çıktı Alanı */
#output {
    width: 100%;
    padding: 12px;
    border: 1px solid #00bcd4;
    background-color: #0d0d0d;
    min-height: 96px;
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.8em;
    color: #00ff00;
    max-height: 180px;
    overflow-y: auto;
    flex-grow: 1;
    box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.2);
}

#level-indicator {
    display: none;
}


/* Sağ Alan: Blok Editör ve Kod Çıktısı */
.coding-area {
    flex: 1;
    padding: 20px;
    background-color: #1e1e1e;
    display: flex;
    flex-direction: column;
    /* Önemli: Sağ sütun içeriği çok uzunsa buraya da scroll eklenebilir, ancak genelde iç elementlere eklemek daha iyidir.
    Görseldeki düzeni korumak için burada overflow-y: hidden bırakıldı. */
    overflow-y: hidden;
}

    /* H2 Başlıkları kaldırıldı (Gizlendi) */
    .coding-area h2 {
        display: none;
    }


/* Blok Komutları Alanı (SAĞ ÜST KISIM) */
#block-palette {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 8px;
    background-color: #242424;
    border: 1px solid #555;
    /* ! ÖNEMLİ DÜZENLEME: Blok menüsüne maksimum yükseklik ve kaydırma çubuğu eklendi */
    max-height: 40vh; /* Ekran yüksekliğinin %40'ı kadar */
    overflow-y: auto;
    /* end: ! ÖNEMLİ DÜZENLEME */
    order: -3; /* En üstte */
}

/* BLOK BOYUTU */
.code-block {
    padding: 8px 15px;
    border: 2px solid #48d1cc;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #fff;
    background-color: #008070;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    user-select: none;
    box-shadow: 0 0 5px rgba(0, 200, 180, 0.5);
}

    .code-block.action {
        background-color: #5d5dff; /* İtme bloğu için farklı renk */
        border-color: #9292ff;
    }

        .code-block.action:hover {
            background-color: #4b4bbd;
            box-shadow: 0 0 15px rgba(93, 93, 255, 0.8);
        }

    .code-block.loop {
        background-color: #9c27b0; /* Döngü (Mor) */
        border-color: #e1bee7;
    }

        .code-block.loop:hover {
            background-color: #7b1fa2;
            box-shadow: 0 0 15px rgba(156, 39, 176, 0.8);
        }

    .code-block.condition {
        background-color: #ff9800; /* Koşul (Turuncu) */
        border-color: #ffe0b2;
    }

        .code-block.condition:hover {
            background-color: #f57c00;
            box-shadow: 0 0 15px rgba(255, 152, 0, 0.8);
        }

    .code-block.function {
        background-color: #00bcd4; /* Fonksiyon (Mavi/Turkuaz) */
        border-color: #b2ebf2;
    }

        .code-block.function:hover {
            background-color: #0097a7;
            box-shadow: 0 0 15px rgba(0, 188, 212, 0.8);
        }

    .code-block.sensor {
        background-color: #795548; /* Sensör (Kahverengi) */
        border-color: #d7ccc8;
    }

        .code-block.sensor:hover {
            background-color: #5d4037;
            box-shadow: 0 0 15px rgba(121, 85, 72, 0.8);
        }


    .code-block:hover {
        background-color: #006b5e;
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 0 15px rgba(0, 200, 180, 0.8);
    }

    .code-block code {
        background-color: rgba(0, 0, 0, 0.4);
        padding: 3px 6px;
        border-radius: 4px;
        font-family: 'Fira Code', monospace;
        font-weight: normal;
        font-size: 12px;
        color: #fffc70;
    }

/* Kodlama Çıktı Alanı (Textarea) - Textarea kullanılıyorsa */
#code-input {
    width: 100%;
    height: auto;
    padding: 10px;
    border: 1px solid #00bcd4;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    resize: vertical;
    background-color: #0d0d0d;
    color: #d4d4d4;
    line-height: 1.6;
    flex-grow: 1;
    box-shadow: inset 0 0 10px rgba(0, 188, 212, 0.2);
    /* ! Kaydırma Çubuğu için kritik */
    max-height: 350px;
    overflow-y: auto;
}

/* Kodların Listelendiği Alan (Görseldeki sağ alt kısım - listelenen kodlar) */
#code-output-list {
    width: 100%;
    height: auto;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #00bcd4;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    background-color: #0d0d0d;
    color: #d4d4d4;
    line-height: 1.6;
    flex-grow: 1;
    box-shadow: inset 0 0 10px rgba(0, 188, 212, 0.2);
    white-space: pre-wrap;
    /* ! Kaydırma Çubuğu için kritik */
    max-height: 300px;
    overflow-y: auto;
}


/* Satır Vurgulama Alanı STİLİ */
#code-display {
    width: 100%;
    min-height: 180px;
    padding: 10px;
    border: 1px solid #00bcd4;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    background-color: #0d0d0d;
    color: #d4d4d4;
    line-height: 1.6;
    flex-grow: 1;
    box-shadow: inset 0 0 10px rgba(0, 188, 212, 0.2);
    white-space: pre; /* Yeni satırları koru */
    overflow: auto;
    display: none; /* Varsayılan olarak gizli */
}

/* Vurgulanan satır */
.highlighted-line {
    background-color: #ffc107; /* Parlak Sarı */
    color: #1a1a1a;
    display: block;
    transition: background-color 0.1s;
}

/* Buton Grubu Stili */
.action-buttons {
    display: flex;
    margin-bottom: 10px; /* Text area ile aralık */
    margin-top: 15px;
    order: -2; /* Blokların hemen altında */
}

    /* BUTON BOYUTLARI VE STİLİ */
    .action-buttons button {
        padding: 10px 18px;
        margin-right: 10px;
        background-color: #ff3d00;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        font-size: 14px;
        font-weight: bold;
        transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
        box-shadow: 0 0 10px rgba(255, 61, 0, 0.5);
    }

        .action-buttons button:hover {
            background-color: #e63900;
            transform: translateY(-2px) scale(1.03);
            box-shadow: 0 0 18px rgba(255, 61, 0, 0.9);
        }

        .action-buttons button:last-child {
            margin-right: 0;
        }

/* Hata Vurgulama */
.highlight-error {
    border-color: #ff3d00 !important;
    box-shadow: 0 0 15px rgba(255, 61, 0, 0.8) !important;
}
