/* Dachflächen-Planer - Custom CSS (nur Drag&Drop-spezifisches) */

/* Roof Canvas */
.roof-canvas {
    position: relative;
    width: 100%;
    height: 500px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.roof-canvas::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    border-radius: 20px;
    z-index: 1;
}

/* Roof Rectangle (drop zone) */
.roof-rectangle {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(2px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    width: 380px;
    height: 120px;
    transition: all 0.3s ease;
    z-index: 2;
    overflow: visible;
}

.roof-rectangle:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.18), inset 0 2px 8px rgba(255, 255, 255, 0.8);
}

.roof-rectangle::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.4), transparent);
    border-radius: 1px;
}

.roof-rectangle::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.4), transparent);
    border-radius: 1px;
}

/* Module Library Items */
.module-item {
    cursor: grab;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
}

.module-item:active { cursor: grabbing; opacity: 0.8; transform: rotate(2deg); }

.module-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.module-item.ring-2 {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

.module-solar { background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05)); border-color: rgba(59, 130, 246, 0.3); }
.module-window { background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05)); border-color: rgba(16, 185, 129, 0.3); }
.module-vent { background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05)); border-color: rgba(239, 68, 68, 0.3); }
.module-accessory { background: linear-gradient(135deg, rgba(107, 114, 128, 0.1), rgba(75, 85, 99, 0.05)); border-color: rgba(107, 114, 128, 0.3); }

/* Stats Panel */
.stats-panel {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #0ea5e9;
    border-radius: 12px;
    padding: 20px;
}

/* Placed Modules on Canvas */
.placed-module {
    position: absolute;
    border: 2px solid #374151;
    border-radius: 4px;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.placed-module.dragging {
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    border-color: #3B82F6;
    z-index: 1000;
}

.placed-module::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    border-radius: 6px;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.placed-module:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: rgba(255, 255, 255, 0.6);
}

.placed-module:hover::before { opacity: 1; }

.placed-module.selected {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3), 0 8px 25px rgba(96, 165, 250, 0.2);
}

.placed-module.collision {
    border: 2px solid #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.2) !important;
    animation: shake 0.5s ease-in-out;
}

/* Module type colors */
.placed-module.solar { background: linear-gradient(135deg, rgba(59, 130, 246, 0.8), rgba(37, 99, 235, 0.9)); border-color: rgba(59, 130, 246, 0.6); }
.placed-module.window { background: linear-gradient(135deg, rgba(16, 185, 129, 0.8), rgba(5, 150, 105, 0.9)); border-color: rgba(16, 185, 129, 0.6); }
.placed-module.vent { background: linear-gradient(135deg, rgba(239, 68, 68, 0.8), rgba(220, 38, 38, 0.9)); border-color: rgba(239, 68, 68, 0.6); }
.placed-module.climate { background: linear-gradient(135deg, rgba(107, 114, 128, 0.8), rgba(75, 85, 99, 0.9)); border-color: rgba(107, 114, 128, 0.6); }
.placed-module.custom { background: linear-gradient(135deg, rgba(124, 58, 237, 0.8), rgba(109, 40, 217, 0.9)); border-color: rgba(124, 58, 237, 0.6); }

/* Module Controls (toolbar on selected module) */
.module-controls {
    position: absolute;
    top: -45px;
    right: -8px;
    display: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    padding: 6px;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: slideIn 0.2s ease-out;
}

.placed-module.selected .module-controls { display: flex; }

.control-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.control-btn:hover {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.control-btn:active {
    transform: translateY(0) scale(0.95);
}

/* Grid Overlay */
.grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.2) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.2) 1px, transparent 1px);
    background-size: 20px 20px;
    transition: opacity 0.3s ease;
}

.grid-overlay.active { opacity: 0.4; }

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    padding: 8px 0;
    display: none;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    transition: background-color 0.15s ease;
}

.context-menu-item:hover { background-color: #f3f4f6; }
.context-menu-item.danger { color: #dc2626; }
.context-menu-item.danger:hover { background-color: #fef2f2; }

/* Roof Label */
.roof-label {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

/* Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Mobile */
@media (max-width: 768px) {
    .roof-canvas {
        min-height: 280px;
        height: auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .placed-module { min-width: 44px; min-height: 44px; font-size: 8px; }
    .module-item { padding: 10px; margin: 6px 0; }
    .module-controls { gap: 2px; top: -38px; }
    .control-btn { width: 36px; height: 36px; font-size: 16px; }
    .roof-label { font-size: 10px; padding: 6px 12px; }
}

@media (max-width: 480px) {
    .roof-canvas { min-height: 220px; border-radius: 12px; }
    .roof-rectangle { border-radius: 8px; }
    .placed-module span { font-size: 7px !important; }
}
