/* =========================================
       1. GENEL SAYFA AYARLARI
       ========================================= */
body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    /* Arka plan şeffaf olabilir, harita kaplayacak */
    font-family: 'Montserrat', sans-serif;
    /* touch-action: auto - sayfa scroll edilebilir */
}

/* =========================================
       2. HARİTA KUTUSU (WRAPPER) - DÜZELTİLDİ
       ========================================= */
#corgen-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f4f4f4;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    z-index: 10;
    overflow: hidden;
    /* PC İÇİN VARSAYILAN AYARLAR (BOZULMAZ) */
    width: 100%;
    max-width: 1600px;
    height: 900px;
    margin: 30px auto;
    border: 5px solid rgba(255, 255, 255, 0.5);
    /* touch-action: pan-y pinch-zoom; -> REMOVED to allow JS control */
}

/* PC (Geniş Ekran) İçin %95 Küçültme ve Çerçeve */
@media (min-width: 769px) {
    #corgen-wrapper {
        width: 100vw;
        height: 100vh;
        left: -220px;
        top: -15px;
        border-radius: 12px;
        border: 5px solid rgba(255, 255, 255, 0.5);
    }
}

/* WordPress Admin Bar Varsa Kaymayı Önle */
body.admin-bar #corgen-wrapper {
    margin-top: 32px;
    height: calc(100% - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar #corgen-wrapper {
        margin-top: 46px;
        height: calc(100% - 46px);
    }
}

/* =========================================
       3. HARİTA SÜRÜKLEME ALANI VE SVG
       ========================================= */
#map-draggable-area {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    cursor: grab;
    will-change: transform;
    touch-action: manipulation;
    /* Harita kontrolü + sayfa scroll */
}

#map-draggable-area:active {
    cursor: grabbing;
}

#corgen-svg {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: auto;
    /* Tıklamaları algıla */
    filter: drop-shadow(0px 5px 5px rgba(0, 0, 0, 0.15));
}

/* İllerin Rengi ve Hover Efekti */
#corgen-svg g#features path {
    fill: #ad0909 !important;
    stroke: #ffffff;
    stroke-width: 0.6px;
    transition: fill 0.2s ease, transform 0.2s;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
}

@media (hover: hover) {
    #corgen-svg g#features path:hover {
        fill: #111 !important;
        stroke: #ad0909;
        stroke-width: 1.5px;
        z-index: 99;
        filter: drop-shadow(0px 0px 10px rgba(0, 0, 0, 0.4));
        transform: translateY(-2px);
    }
}

/* =========================================
       4. ARAYÜZ (BUTONLAR, TOOLTIP)
       ========================================= */
/* Zoom Controls: Bottom Left (Default) */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9001;
}

/* Other Controls (Lang, Sound, Route): Bottom Right (Above Signature) */
/* Signature is usually ~30px high at bottom:10px. So bottom:50px is safe. */
.corgen-controls-container {
    bottom: -180px !important;
    right: -1525px !important;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    background: #000;
    color: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    transition: all 0.2s;
}

.zoom-btn:active {
    background: #ad0909;
    transform: scale(0.95);
}

.corgen-signature {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 9001;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 8px;
    border-radius: 6px;
    pointer-events: auto;
}

.corgen-signature a {
    text-decoration: none !important;
    /* Alt çizgiyi kesin olarak kaldır */
    color: #333 !important;
    /* Yazıyı standart siyah/gri yap (Mavi olmasın) */
    display: flex;
    align-items: center;
    gap: 4px;
    /* İki kelime arasına hafif boşluk */
    cursor: pointer;
}

.corgen-signature a span {
    color: #ad0909;
    font-weight: 800;
}

.corgen-signature:hover {
    transform: scale(1.05);
    background: #fff;
}

.cm-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    /* TOOLTIP Z-INDEX: Haritadan (9000) yüksek olmalı */
    z-index: 10000 !important;
    border-left: 4px solid #ad0909;
    white-space: nowrap;
    transform: translate(-50%, -150%);
    transition: opacity 0.2s;
}

/* =========================================
       5. MODAL (AÇILIR PENCERE)
       ========================================= */
.cm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    /* MODAL Z-INDEX: En yüksek katman burası */
    z-index: 99999 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.cm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cm-modal-box {
    background: #fff;
    width: 90%;
    max-width: 800px;
    height: auto;
    max-height: 90vh;
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
    border-top: 8px solid #ad0909;
    overflow: hidden;
}

.cm-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: #ad0909;
    color: #fff;
    text-align: center;
    line-height: 40px;
    font-size: 28px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s;
}

.cm-close:hover {
    transform: rotate(90deg);
    background: #000;
}

.cm-gallery {
    width: 100%;
    max-height: 40vh;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.cm-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.cm-gallery img.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.cm-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 24px;
    padding: 15px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    user-select: none;
    border-radius: 4px;
}

.cm-nav:hover {
    background: #ad0909;
}

.cm-nav.prev {
    left: 10px;
}

.cm-nav.next {
    right: 10px;
}

.cm-content {
    padding: 30px;
    overflow-y: auto;
    text-align: center;
    flex-grow: 1;
    background-color: #fff;
}

.cm-title {
    color: #ad0909;
    font-size: 28px;
    margin: 0 auto 15px auto;
    border-bottom: 3px solid #eee;
    padding-bottom: 10px;
    font-weight: 800;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    text-align: center;
    width: 100%;
}

.cm-title-actions {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
}

.cm-desc {
    font-size: 15px;
    line-height: 1.7;
    color: #444;
    margin-bottom: 25px;
}

.cm-list-title {
    font-weight: 700;
    display: block;
    margin-bottom: 15px;
    color: #000;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
}

.cm-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 0;
    list-style: none;
}

.cm-list li {
    background: #f9f9f9;
    padding: 10px 20px;
    border-left: 4px solid #ad0909;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    #corgen-wrapper {
        border-radius: 0;
        height: 55vh;
        /* Mobilde daha kısa yükseklik */
        min-height: 500px;
    }

    .cm-modal-box {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border-top: none;
    }

    .cm-gallery {
        max-height: 30vh;
    }

    .cm-content {
        padding: 20px;
    }

    .cm-list {
        flex-direction: column;
    }

    .cm-list li {
        width: 100%;
        box-sizing: border-box;
    }

    .zoom-controls {
        bottom: 20px;
        left: 20px;
    }

    .corgen-signature {
        bottom: 20px;
        right: 20px;
    }

    .corgen-controls-container {
        bottom: -90px !important;
        right: -305px !important;
        width: 50px !important;
        height: 50px !important;
    }

    /* Butonları Küçült */
    .corgen-controls-container .cm-control-btn,
    .corgen-controls-container #corgen-lang-toggle,
    .corgen-controls-container #corgen-sound-toggle {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
        line-height: 32px !important;
    }
}

/* --- YENİ EKLENEN TASARIM (ACCORDION - KIRMIZI) --- */
.cm-places-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cm-place-card {
    border: 1px solid #ad0909;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.cm-place-header {
    padding: 15px 20px;
    background: #ad0909;
    /* İSTENEN KIRMIZI ARKA PLAN */
    color: #fff;
    /* Yazı beyaz */
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.cm-place-header:hover {
    background: #8a0606;
    /* Hover için biraz koyu */
}

.cm-place-header::after {
    content: '+';
    font-size: 18px;
    color: #fff;
    font-weight: bold;
}

/* Açıkken */
/* .cm-place-card.open logic if we had class toggle in JS, but currently using inline display none/block in JS.
   Only styling the header. */

.cm-place-body {
    display: none;
    padding: 20px;
    background: #fff;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- YENİ EKLENEN TASARIM (ACCORDION - KIRMIZI) --- */
.cm-places-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cm-place-card {
    border: 1px solid #ad0909;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.cm-place-header {
    padding: 15px 20px;
    background: #ad0909;
    /* İSTENEN KIRMIZI ARKA PLAN */
    color: #fff;
    /* Yazı beyaz */
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.cm-place-header:hover {
    background: #8a0606;
    /* Hover için biraz koyu */
}

.cm-place-header::after {
    content: '+';
    font-size: 18px;
    color: #fff;
    font-weight: bold;
}

/* Açıkken (JS toggle ile) */
.cm-place-body {
    display: none;
    padding: 20px;
    background: #fff;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cm-place-desc {
    font-size: 13px;
    line-height: 1.5;
}

/* Weather Animations */
#weather-overlay {
    pointer-events: none;
    z-index: 2000000000;
    /* Above Modal (99999) */
}

.weather-rain {
    position: absolute;
    top: -10px;
    width: 2px;
    height: 15px;
    background: rgba(255, 255, 255, 0.6);
    animation: fall linear infinite;
    animation-duration: 0.7s;
}

.weather-snow {
    position: absolute;
    top: -10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.8;
    animation: fall linear infinite;
    box-shadow: 0 0 5px #fff;
}

.weather-sun {
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 200, 0.8) 0%, rgba(255, 255, 200, 0) 70%);
    animation: shine 5s infinite ease-in-out;
    pointer-events: none;
}

@keyframes fall {
    to {
        transform: translateY(100vh);
    }
}

@keyframes shine {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
}

/* Extra Controls */
.cm-extra-controls {
    margin-top: 10px;
}

/* Search Dropdown & Close Button */
#corgen-search-results {
    z-index: 10001;
}

.cm-search-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #ad0909;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    display: none;
    /* JS will toggle */
    z-index: 105;
}

.cm-search-close:hover {
    background: #000;
}

.corgen-controls-container {
    position: relative;
    /* Context for absolute close icon */
}

#cm-region-filter {
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: #333;
    font-weight: 600;
    cursor: pointer;
}


/* Extra Controls & Filters */
.cm-region-sm {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 9999;
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: auto;
    max-width: 120px;
    height: 30px;
}

@media (max-width: 768px) {
    .cm-region-sm {
        top: 60px;
        /* Below search on mobile */
        right: 10px;
    }
}

/* Ensure Modal is Topmost */
.cm-modal-overlay {
    z-index: 2147483647 !important;
    /* Max Int */
}

/* Speaker Icon */
.cm-speak-btn {
    transition: transform 0.2s;
    display: inline-block;
    vertical-align: middle;
}

.cm-speak-btn:hover {
    transform: scale(1.2);
}

/* Search Dropdown Fix */
#corgen-search-results {
    z-index: 10001;
    /* Above almost everything */
}


/* =========================================
   6. AI CHATBOT & PWA STYLES
   ========================================= */
#cm-chat-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: #ad0909;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: transform 0.3s;
}

#cm-chat-btn:hover {
    transform: scale(1.1);
}

#cm-chat-btn.active {
    transform: rotate(45deg);
    background: #333;
}

#cm-chat-window {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 350px;
    height: 450px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s;
}

#cm-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cm-chat-header {
    background: #ad0909;
    color: #fff;
    padding: 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
}

.cm-chat-close {
    cursor: pointer;
    font-size: 20px;
}

.cm-chat-body {
    flex: 1;
    padding: 15px;
    background: #f4f4f4;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cm-chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
}

.cm-chat-msg.bot {
    background: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 0;
    border: 1px solid #ddd;
}

.cm-chat-msg.user {
    background: #ad0909;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 0;
}

.cm-chat-input-area {
    padding: 10px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

#cm-chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}

#cm-chat-send {
    background: #ad0909;
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

/* Mobile Responsive Chat */
@media (max-width: 480px) {
    #cm-chat-window {
        left: 0;
        bottom: 0;
        width: 100%;
        height: 60vh;
        border-radius: 20px 20px 0 0;
    }

    #cm-chat-btn {
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
    }
}