/* ======================================================
   ONCHAT STUDIO PRO - MASTER CSS (COMPLETE & FIXED)
   ====================================================== */

.avatar-grid {
    display: grid; 
    grid-template-columns: repeat(7, 1fr);
    gap: 15px;
    margin-top: 25px;
}

.avatar-item {
    width: 75px;
    background: #fff;
    padding: 6px;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s ease-in-out;
    position: relative;
    cursor: pointer;
}

.avatar-item:hover {
    transform: scale(1.15);
    border-color: #007bff;
    z-index: 100;
}

.avatar-img {
    width: 60px;
    height: 100px;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
    background: #f8fafb;
    border-radius: 4px;
}

.studio-master-container {
    display: flex;
    gap: 15px;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    background: #f4f4f4;
    border-radius: 12px;
}

/* EDITOR GRID (DESKTOP) */
.studio-editor-core {
    display: grid;
    grid-template-areas:
        "s-top s-top s-top"
        "s-left s-workspace s-right"
        "s-bottom s-bottom s-bottom";
    grid-template-columns: 110px 1fr 220px;
    grid-template-rows: 45px 370px 40px;
    gap: 8px;
    background: #34495e;
    padding: 8px;
    border-radius: 10px;
}

/* ============================= */
/* ÜST BAR */
/* ============================= */

.s-top {
    grid-area: s-top;
    background: #2c3e50;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
}

/* ============================= */
/* SOL TOOL PANEL */
/* ============================= */

.s-left {
    grid-area: s-left;
    background: #f1f3f4;
    border-radius: 6px;
    padding: 10px 5px;
    display: flex;
    flex-direction: column; /* Butonlar ve Renk paletini dikey hizalar */
    align-items: center;
    gap: 10px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Masaüstü 2 sütun */
    gap: 4px;
}

.s-color-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 5px 0;
}

#mainColor {
    width: 90%;
    height: 40px;
    border: none;
    cursor: pointer;
    background: none;
}
/* PROFESYONEL RENK PALETİ TASARIMI */
.s-color-section {
    width: 100%;
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.color-trigger-wrapper {
    width: 100%;
    height: 40px;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 3px;
    background: #fff;
}

.color-preview-box {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

#hexInput {
    width: 100%;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
    font-family: monospace;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
}

/* ============================= */
/* WORKSPACE */
/* ============================= */

.s-workspace {
    grid-area: s-workspace;
    background: #4a4a4a;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10px;
    min-width: 0;
    min-height: 0;
    border-radius: 6px;
}

.s-workspace-inner {
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(#aaa 0% 25%, #888 0% 50%) 50% / 20px 20px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

/* ============================= */
/* DELETE MODAL & OPTIONS */
/* ============================= */

#deleteOptionsArea label {
    font-size: 13px;
    color: #333;
    padding: 5px;
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #ddd;
}

#deleteOptionsArea p {
    font-size: 13px;
    color: #333;
}

.delete-modal-inner {
    margin: 15px 0;
    text-align: left;
    background: transparent;
}

.delete-option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: inherit;
}

.delete-msg-text {
    font-size: 13px;
    line-height: 1.5;
}

/* ============================= */
/* CANVAS */
/* ============================= */

#studioCanvas {
	touch-action: none;
    width: 100px;
    height: 100px;
    image-rendering: pixelated;
    background: transparent;
    border: none;
}

#canvasWrapper {
    position: relative;
}

/* ============================= */
/* BRUSH PANEL */
/* ============================= */

#brushPanel {
    position: fixed;
    top: 200px;
    left: 300px;
    width: 240px;
    padding: 14px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px) scale(0.96);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
    z-index: 9999;
    touch-action: none;
    user-select: none;
}

#brushPanel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}

#brushHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 12px;
    cursor: move;
}

#brushCloseBtn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

/* ============================= */
/* RIGHT PANEL (KÜTÜPHANE) */
/* ============================= */

.s-right {
    grid-area: s-right;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ============================= */
/* ALT BAR */
/* ============================= */

.s-bottom {
    grid-area: s-bottom;
    background: #2c3e50;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    color: #fff;
    font-size: 12px;
    gap: 15px;
    justify-content: space-between;
}

/* ============================= */
/* TOOL BUTTONS */
/* ============================= */

.s-tool-btn {
    width: 45px;
    height: 30px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.s-tool-btn i {
    color: #333;
    font-size: 14px;
}

.s-tool-btn:hover,
.s-tool-btn.active {
    background: #007bff;
}

.s-tool-btn:hover i,
.s-tool-btn.active i {
    color: #ffffff;
}

/* ============================= */
/* DROPDOWN & HISTORY */
/* ============================= */

.s-nav-item {
    position: relative;
    display: inline-block;
    padding: 10px 12px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.s-dropdown {
    display: none;
    position: absolute;
    top: 35px;
    left: 0;
    background: #ffffff;
    min-width: 200px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 9999;
    padding: 5px 0;
    flex-direction: column;
}

.s-nav-item:hover .s-dropdown {
    display: flex;
}

.s-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    color: #333;
    font-size: 12px;
    border-bottom: 1px solid #eee;
}

.s-dropdown a:hover {
    background: #f0faff;
    color: #007bff;
}

.s-history-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
    border-left: 1px solid rgba(255,255,255,0.1);
    padding-left: 15px;
}

.s-upload-btn {
    background: #6f42c1;
    color: #ffffff;
    border: none;
    height: 30px;
    padding: 0 15px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ============================= */
/* TEXT MODAL */
/* ============================= */

.text-input-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 10002;
    width: 320px;
    max-width: 90%;
}

/* ======================================================
   MOBILE RESPONSIVE RULES (TAM VE EKSİKSİZ)
   ====================================================== */

@media (max-width: 768px) {
    .studio-editor-core {
        display: flex;
        flex-direction: column;
        height: auto !important;
        padding: 5px;
        gap: 5px;
    }

    /* Sıralama: Top > Workspace > Bottom > Left > Right */
    .s-top { order: 1; width: 100%; }
    .s-workspace { order: 2; width: 100%; height: 400px; margin: 5px 0; }
    .s-bottom { order: 3; width: 100%; }
    
    .s-left { 
        order: 4; 
        width: 100% !important; 
        padding: 10px;
        background: #f8f9fa;
        flex-direction: column !important; /* Butonlar üstte renk altta kalsın diye */
    }

    .tools-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr); /* Mobilde 7 buton yan yana (2 satır) */
        width: 100%;
        gap: 4px;
    }

    .s-color-wrapper {
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }

    #mainColor {
        width: 120px;
        height: 35px;
    }
	
	 .s-color-section {
        flex-direction: row; /* Mobilde yan yana */
        justify-content: center;
        width: 180px;
        margin: 10px auto;
    }
    
    .color-trigger-wrapper {
        width: 50px;
    }
    
    #hexInput {
        width: 80px;
    }

    .s-right { order: 5; width: 100% !important; height: auto !important; }
    
    /* Layout Wrapper Sıralaması */
    .main-content-wrapper {
        display: flex;
        flex-direction: column;
    }
    .main-content-area { order: 1; }
    .main-left-sidebar-area { order: 2; margin-top: 20px; }
}