/* Bubble Diagram Maker CSS */

.bubble-diagram-container {
    max-width: 95%;
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: visible; /* değişti: panel'in taşmasına izin ver */
    background: #f9f9f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: relative; /* eklendi: absolute positioning için */
}



.bubble-diagram-main {
    display: block; /* değişti: flex yerine block */
    position: relative;
    height: 600px;
    /* margin-right: 320px; Panel için yer bırak */
}

.bubble-diagram-toolbar {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
}

.bdm-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.bdm-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.bdm-btn:active {
    transform: translateY(0);
}

.bdm-btn.bdm-add-bubble {
    background: #00a32a;
}

.bdm-btn.bdm-add-bubble:hover {
    background: #008a20;
}

.bdm-btn.bdm-add-connection {
    background: #f0b849;
}

.bdm-btn.bdm-add-connection:hover {
    background: #dfa724;
}

.bdm-btn.bdm-download {
    background: #8c8f94;
}

.bdm-btn.bdm-download:hover {
    background: #6c7781;
}

.bdm-btn.bdm-download:disabled {
    background: #95a5a6 !important;
    color: #7f8c8d !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    transform: none !important;
    pointer-events: none;
}

.bdm-btn.bdm-download:disabled:hover {
    background: #95a5a6 !important;
    transform: none !important;
}

.bdm-btn.bdm-clear {
    background: #d63638;
}

.bdm-btn.bdm-clear:hover {
    background: #b32d2e;
}

.bubble-diagram-canvas-container {
    position: relative;
    background: #fff;
    overflow: hidden;
    width: 100%; /* Canvas tam genişlik kullanır */
    height: 600px;
}

.bubble-diagram-canvas {
    display: block;
    border: none;
    cursor: crosshair;
    width: 100%;
    height: 100%;
    max-width: 100%;
    background-color: #ffffff;
    background-image: 
        linear-gradient(rgba(0,0,0,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 0 0;
}

.bubble-diagram-canvas.dragging {
    cursor: move;
}

.bubble-diagram-canvas.connecting {
    cursor: pointer;
}

.bubble-properties-panel {
    width: 300px;
    height: 600px;
    background: #f8f9fa;
    border-left: 1px solid #ddd;
    padding: 20px;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow-y: auto;
    position: absolute; /* değişti: absolute position */
    top: 0;
    right: -320px; /* container'ın tamamen dışında */
    opacity: 1;
    transition: all 0.3s ease;
}

.bubble-properties-panel.hidden {
    opacity: 0.6;
    background: #f5f5f5;
}

.bubble-properties-panel h4 {
    margin: 0 0 15px 0;
    color: #23282d;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.property-group {
    margin-bottom: 15px;
}

.property-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #23282d;
    font-size: 14px;
}

.property-group input[type="text"],
.property-group input[type="color"],
.property-group input[type="range"],
.property-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.bubble-shape {
    margin-bottom: 10px;
}

.property-group select {
    background: #fff;
    cursor: pointer;
}

.property-group input[type="color"] {
    height: 40px;
    cursor: pointer;
}

.property-group input[type="range"] {
    margin-bottom: 5px;
}

.property-group input:disabled,
.bdm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.bdm-btn:disabled:hover {
    background: inherit !important;
    transform: none !important;
}

/* Rate limiting için özel styling */
.bdm-btn.rate-limited {
    background: #e74c3c !important;
    color: #fff !important;
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.size-value,
.width-value {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* Properties Panel Butonları */
.properties-button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.properties-button-group .bdm-btn {
    flex: 1;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
}

.bdm-apply-properties {
    background: #00a32a;
}

.bdm-apply-properties:hover {
    background: #008a20;
}

.bdm-delete-bubble {
    background: #d63638;
}

.bdm-delete-bubble:hover {
    background: #b32d2e;
}

/* Bağlantı Butonları */
.bdm-apply-connection {
    background: #f0b849;
}

.bdm-apply-connection:hover {
    background: #dfa724;
}

.bdm-delete-connection {
    background: #d63638;
}

.bdm-delete-connection:hover {
    background: #b32d2e;
}

/* Tablet Responsive (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .bubble-properties-panel {
        width: 280px;
        right: -300px;
        padding: 15px;
    }
    
    .bubble-diagram-toolbar {
        padding: 12px;
        gap: 8px;
    }
    
    .bdm-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Mobile Responsive (768px ve altı) */
@media (max-width: 768px) {
    .bubble-diagram-container {
        margin: 10px 0;
        border-radius: 6px;
    }
    
    .bubble-diagram-main {
        height: auto;
        display: block;
    }
    
    .bubble-diagram-canvas-container {
        height: 400px;
        width: 100%;
        border-radius: 0;
    }
    
    .bubble-diagram-canvas {
        height: 400px;
        background-size: 15px 15px; /* Daha küçük grid mobilde */
    }
    
    .bubble-properties-panel {
        position: relative; /* Mobile'da normal flow'da */
        top: auto;
        right: auto;
        width: 100%;
        height: auto;
        min-height: 280px;
        border-left: none;
        border-top: 2px solid #0073aa;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        margin-top: 0;
        padding: 15px;
        border-radius: 0 0 6px 6px;
    }
    
    .bubble-properties-panel h4 {
        font-size: 15px;
        margin-bottom: 12px;
    }
    
    .property-group {
        margin-bottom: 12px;
    }
    
    .property-group label {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .property-group input[type="text"],
    .property-group input[type="color"],
    .property-group input[type="range"],
    .property-group select {
        padding: 10px; /* Touch için daha büyük */
        font-size: 16px; /* iOS zoom'u önlemek için */
        border-radius: 6px;
    }
    
    .property-group input[type="color"] {
        height: 45px; /* Touch için daha büyük */
    }
    
    .bubble-diagram-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }
    
    .bdm-btn {
        flex: 1;
        min-width: calc(50% - 4px); /* 2'şer sıra */
        height: 44px; /* Touch standartı */
        justify-content: center;
        font-size: 14px;
        padding: 0 12px;
        border-radius: 6px;
    }
    
    .properties-button-group .bdm-btn {
        height: 44px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    /* Connection properties daha az yer kaplar */
    .connection-properties-section {
        margin-top: 20px;
        padding-top: 15px;
    }
    
    .connection-properties-section h4 {
        font-size: 14px;
        margin-bottom: 10px;
    }
}

/* Küçük Mobile (480px ve altı) */
@media (max-width: 480px) {
    .bubble-diagram-container {
        margin: 5px 0;
        border: none;
        border-radius: 0;
    }
    
    .bubble-diagram-canvas-container {
        height: 300px; /* Daha küçük canvas */
    }
    
    .bubble-diagram-canvas {
        height: 300px;
        background-size: 12px 12px; /* Daha da küçük grid */
    }
    
    .bubble-properties-panel {
        padding: 12px;
        min-height: 250px;
        border-radius: 0;
    }
    
    .bubble-diagram-toolbar {
        padding: 10px;
        gap: 6px;
    }
    
    .bdm-btn {
        width: 100%; /* Tek sıra */
        min-width: 100%;
        height: 40px;
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .property-group input[type="text"],
    .property-group input[type="color"],
    .property-group input[type="range"],
    .property-group select {
        padding: 8px;
        font-size: 16px; /* iOS zoom önleme */
    }
    
    .properties-button-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .properties-button-group .bdm-btn {
        width: 100%;
        margin-bottom: 0;
    }
}

/* Landscape mode için özel ayarlar */
@media (max-width: 768px) and (orientation: landscape) {
    .bubble-diagram-canvas-container {
        height: 350px;
    }
    
    .bubble-diagram-canvas {
        height: 350px;
    }
    
    .bubble-properties-panel {
        min-height: 220px;
        padding: 12px;
    }
    
    .property-group {
        margin-bottom: 10px;
    }
}

/* Touch optimization */
@media (hover: none) and (pointer: coarse) {
    .bdm-btn {
        min-height: 44px; /* Apple guideline */
        padding: 12px 16px;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    .bdm-btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .property-group input[type="range"] {
        height: 40px; /* Kalın slider mobile'da */
        -webkit-appearance: none;
        background: #ddd;
        border-radius: 20px;
    }
    
    .property-group input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        height: 20px;
        width: 20px;
        border-radius: 50%;
        background: #0073aa;
        cursor: pointer;
    }
    
    .bubble-diagram-canvas {
        cursor: default; /* Touch'ta cursor gerekmez */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        touch-action: none; /* Prevent default touch behaviors */
    }
    
    /* Touch feedback */
    .bubble-diagram-canvas:active {
        background-color: rgba(0, 115, 170, 0.02);
    }
}

/* Loading ve Status Mesajları */
.bdm-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: bdm-spin 1s linear infinite;
}

@keyframes bdm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.bdm-status {
    position: absolute;
    top: 10px;
    left: 20px;
    padding: 8px 16px;
    background: #00a32a;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bdm-status.show {
    opacity: 1;
}

.bdm-status.error {
    background: #d63638;
}

/* Bubble Seçim Efektleri */
.bubble-selected {
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
}

/* Bağlantı Çizgisi Stilleri */
.connection-line {
    stroke: #666;
    stroke-width: 2;
    stroke-dasharray: none;
}

.connection-line.dashed {
    stroke-dasharray: 5,5;
}

.connection-line.selected {
    stroke: #0073aa;
    stroke-width: 3;
} 