/**
 * Flatplan Frontend Styles
 */

.flatplan-viewer {
    position: relative;
    background: #f6f5f2;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.flatplan-canvas-wrapper {
    position: relative;
    flex: 1;
    overflow: auto;
    background: #f6f5f2;
}

.flatplan-canvas {
    display: block;
    margin: 0;
    background: #f6f5f2;
}

.flatplan-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-top: 1px solid #eee;
    align-items: center;
    flex-wrap: wrap;
}

.flatplan-toolbar button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.flatplan-toolbar button:hover {
    background: #f0f0f0;
    border-color: #999;
}

.flatplan-toolbar button:active {
    background: #e5e5e5;
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    font-size: 12px;
    color: #666;
}

.flatplan-sidebar {
    width: 250px;
    border-left: 1px solid #eee;
    background: #fafafa;
    overflow-y: auto;
    max-height: 400px;
}

.flatplan-sidebar h3 {
    margin: 0;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid #eee;
    background: #fff;
    color: #333;
}

.flatplan-elements {
    padding: 8px;
}

.element {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.element:hover {
    background: #f9f9f9;
    border-color: #bbb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.element .color {
    width: 18px;
    height: 18px;
    border-radius: 2px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.element .title {
    flex: 1;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.element.section {
    background: #f0f9ff;
}

.element.item {
    background: #f9f5ff;
}

/* Mobile / Responsive */
@media (max-width: 1024px) {
    .flatplan-viewer {
        flex-direction: column;
    }

    .flatplan-sidebar {
        width: 100%;
        max-height: 200px;
        border-left: none;
        border-top: 1px solid #eee;
    }

    .flatplan-toolbar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .flatplan-sidebar {
        display: none;
    }

    .flatplan-toolbar {
        flex-direction: column;
        gap: 4px;
    }

    .flatplan-toolbar button {
        width: 100%;
        text-align: center;
    }
}

/* Accessibility */
.flatplan-toolbar button:focus,
.flatplan-toolbar button:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Loading state */
.flatplan-viewer.loading {
    opacity: 0.6;
    pointer-events: none;
}

.flatplan-viewer.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    z-index: 10;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Fullscreen mode */
.flatplan-viewer.fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    border-radius: 0;
    border: none;
}

@media print {
    .flatplan-toolbar,
    .flatplan-sidebar {
        display: none !important;
    }

    .flatplan-viewer {
        border: none;
        background: #fff;
    }
}
