/* Sonsuz Tuval - Özel Stiller, iPad/Tablet Dokunmatik ve Akıcı Tuval Optimizasyonları */

:root {
    --canvas-bg: #0f172a;
    --grid-dot: #334155;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --surface: #1e293b;
    --surface-border: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

input, textarea, select, [contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
    touch-action: manipulation;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--canvas-bg);
    color: var(--text-primary);
}

/* Sonsuz Tuval Taşıyıcı ve Arka Plan Izgarası */
#viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: default;
    touch-action: none;
    background-color: var(--canvas-bg);
}

#viewport.panning {
    cursor: grab;
}

#viewport.panning:active {
    cursor: grabbing;
}

#canvas-world {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    transform-origin: 0 0;
    will-change: transform;
    touch-action: none;
}

/* Izgara Arka Planı (CSS Dot Grid) */
.grid-background {
    background-size: 32px 32px;
    background-image: radial-gradient(circle, var(--grid-dot) 1.5px, transparent 1.5px);
}

/* Tuval Elemanları Temel Stili */
.canvas-item {
    position: absolute;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.15s ease, outline 0.1s ease;
    cursor: move;
    touch-action: none;
    will-change: transform, left, top, width, height;
}

.canvas-item:hover {
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.6);
}

.canvas-item.selected {
    outline: 3px solid var(--accent);
    box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.28), 0 20px 35px -5px rgba(0, 0, 0, 0.7);
}

/* Yeniden Boyutlandırma Tutamaçları - iPad ve Dokunmatik Ekranlar İçin Genişletilmiş */
.resize-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border: 3px solid var(--accent);
    border-radius: 50%;
    display: none;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45);
    touch-action: none;
}

/* Dokunmatik ekranlarda daha geniş yakalama alanı */
.resize-handle::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
}

.canvas-item.selected .resize-handle {
    display: block;
}

.handle-se { bottom: -10px; right: -10px; cursor: se-resize; }
.handle-sw { bottom: -10px; left: -10px; cursor: sw-resize; }
.handle-ne { top: -10px; right: -10px; cursor: ne-resize; }
.handle-nw { top: -10px; left: -10px; cursor: nw-resize; }

/* Görsel Kartı */
.image-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.image-card img {
    width: 100%;
    height: calc(100% - 44px);
    object-fit: cover;
    display: block;
    pointer-events: none;
    background: #0f172a;
}

.image-card.fit-contain img {
    object-fit: contain;
}

/* Seçili olduğunda da iPad/Tablet için görsel üstü aksiyon butonlarını göster */
.image-card.selected .image-actions-overlay {
    opacity: 1 !important;
}

.image-card-footer {
    height: 44px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1e293b;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
    color: var(--text-secondary);
}

/* Yapışkan Not (Sticky Note) */
.sticky-note {
    padding: 16px;
    display: flex;
    flex-direction: column;
    color: #1e293b;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.sticky-note textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    outline: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: 500;
    line-height: inherit;
}

/* Renk Paleti Kartı */
.color-card {
    background: #1e293b;
    border: 1px solid var(--surface-border);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-swatch-bar {
    display: flex;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.color-swatch-item {
    flex: 1;
    height: 100%;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease;
}

.color-swatch-item:hover, .color-swatch-item:active {
    transform: scaleY(1.08);
    z-index: 2;
}

/* Metin / Başlık Elemanı */
.text-item {
    background: transparent;
    box-shadow: none;
    padding: 8px 12px;
    cursor: text;
}

.text-item.selected {
    outline: 2px dashed var(--accent);
}

.text-item [contenteditable="true"] {
    outline: none;
    color: #f8fafc;
    font-weight: 700;
    font-size: 28px;
    line-height: 1.3;
}

/* Çerçeve / Frame Elemanı */
.frame-item {
    background: rgba(30, 41, 59, 0.35);
    border: 2px dashed rgba(148, 163, 184, 0.4);
    box-shadow: none;
}

.frame-item.selected {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.06);
}

.frame-header {
    position: absolute;
    top: -30px;
    left: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: #1e293b;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid var(--surface-border);
}

/* Harita (Minimap) */
#minimap-container {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 180px;
    height: 120px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    overflow: hidden;
    z-index: 40;
}

@media (max-width: 768px) {
    #minimap-container {
        width: 130px;
        height: 88px;
        bottom: 84px;
        right: 12px;
    }
}

#minimap-canvas {
    width: 100%;
    height: 100%;
}

#minimap-viewport-indicator {
    position: absolute;
    border: 2px solid var(--accent);
    background: rgba(59, 130, 246, 0.15);
    pointer-events: none;
    border-radius: 2px;
}

/* Sürükle & Bırak Vurgusu */
#drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(59, 130, 246, 0.15);
    backdrop-filter: blur(4px);
    border: 4px dashed var(--accent);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    pointer-events: none;
}

/* Araç Çubuğu Aktif Buton Vurgusu */
.tool-btn.active {
    background-color: rgba(59, 130, 246, 0.22);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.45);
}

/* Özel Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #0f172a;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}
