/**
 * Kreatus DXF Viewer - Frontend Styles
 */

/* Container */
.kdxf-viewer-container {
    position: relative;
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Loading State */
.kdxf-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 46, 0.95);
    z-index: 100;
    color: #fff;
    gap: 16px;
}

.kdxf-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: kdxf-spin 0.8s linear infinite;
}

@keyframes kdxf-spin {
    to { transform: rotate(360deg); }
}

/* Canvas Container */
.kdxf-canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.kdxf-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.kdxf-canvas.grabbing {
    cursor: grabbing;
}

.kdxf-canvas.crosshair {
    cursor: crosshair;
}

/* SVG Overlay */
.kdxf-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

/* Toolbar */
.kdxf-toolbar {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    z-index: 50;
}

.kdxf-toolbar-group {
    display: flex;
    background: rgba(30, 30, 50, 0.9);
    border-radius: 8px;
    padding: 4px;
    gap: 2px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Buttons */
.kdxf-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #a0aec0;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
}

.kdxf-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.kdxf-btn.active {
    background: #3b82f6;
    color: #fff;
}

.kdxf-btn svg {
    flex-shrink: 0;
}

.kdxf-btn-primary {
    background: #3b82f6;
    color: #fff;
}

.kdxf-btn-primary:hover {
    background: #2563eb;
}

.kdxf-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
}

.kdxf-btn-small {
    padding: 4px 8px;
}

.kdxf-scale-value {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.8;
}

/* Layer Panel */
.kdxf-layer-panel {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 240px;
    max-height: calc(100% - 24px);
    background: rgba(30, 30, 50, 0.95);
    border-radius: 8px;
    overflow: hidden;
    z-index: 50;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.kdxf-layer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

.kdxf-layer-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.kdxf-layer-close:hover {
    color: #fff;
}

.kdxf-layer-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
}

.kdxf-layer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.kdxf-layer-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.kdxf-layer-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.kdxf-layer-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.kdxf-layer-name {
    flex: 1;
    color: #e2e8f0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kdxf-layer-count {
    color: #718096;
    font-size: 11px;
}

/* Scale Dialog */
.kdxf-scale-dialog {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
}

/* Scale Modal (used by JS) */
.kdxf-scale-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 300;
    backdrop-filter: blur(4px);
}

.kdxf-scale-modal-content {
    background: #1e1e3f;
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.kdxf-scale-modal-content h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.kdxf-scale-modal-content p {
    margin: 0 0 20px 0;
    color: #a0aec0;
    font-size: 14px;
}

.kdxf-scale-modal-content label {
    display: block;
    color: #a0aec0;
    font-size: 13px;
    margin-bottom: 8px;
}

.kdxf-scale-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.kdxf-scale-buttons .kdxf-btn {
    padding: 10px 20px;
}

.kdxf-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
}

.kdxf-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

.kdxf-btn-apply {
    background: #3b82f6;
    color: #fff;
}

.kdxf-btn-apply:hover {
    background: #2563eb;
}

.kdxf-dialog-content {
    background: #1e1e3f;
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.kdxf-dialog-content h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.kdxf-dialog-content p {
    margin: 0 0 20px 0;
    color: #a0aec0;
    font-size: 14px;
}

.kdxf-scale-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.kdxf-scale-input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
}

.kdxf-scale-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.kdxf-scale-unit {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.kdxf-dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.kdxf-dialog-buttons .kdxf-btn {
    padding: 10px 20px;
}

/* Measurement Info */
.kdxf-measurement-info {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(30, 30, 50, 0.95);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 50;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.kdxf-measurement-type {
    color: #a0aec0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kdxf-measurement-value {
    font-weight: 600;
    font-size: 16px;
    color: #3b82f6;
}

/* Error State */
.kdxf-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 46, 0.95);
    z-index: 100;
}

.kdxf-error-message {
    color: #ef4444;
    font-size: 14px;
    padding: 20px;
    text-align: center;
}

.kdxf-viewer-error {
    padding: 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    text-align: center;
}

/* SVG Measurements */
.kdxf-measure-line {
    stroke: #3b82f6;
    stroke-width: 2;
    fill: none;
}

.kdxf-measure-line-dashed {
    stroke-dasharray: 5, 3;
}

.kdxf-measure-point {
    fill: #3b82f6;
    stroke: #fff;
    stroke-width: 2;
}

.kdxf-measure-label {
    fill: #fff;
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
}

.kdxf-measure-label-bg {
    fill: rgba(59, 130, 246, 0.9);
    rx: 4;
    ry: 4;
}

.kdxf-snap-indicator {
    fill: #10b981;
    stroke: #fff;
    stroke-width: 2;
}

.kdxf-snap-label {
    fill: #10b981;
    font-size: 10px;
    text-transform: uppercase;
}

/* Responsive */
@media (max-width: 768px) {
    .kdxf-toolbar {
        top: 8px;
        left: 8px;
        gap: 4px;
    }

    .kdxf-toolbar-group {
        padding: 2px;
    }

    .kdxf-btn {
        padding: 6px 8px;
    }

    .kdxf-layer-panel {
        width: 200px;
        right: 8px;
        top: 8px;
    }

    .kdxf-measurement-info {
        bottom: 8px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .kdxf-scale-value {
        display: none;
    }
}

/* Minimal Toolbar Mode */
.kdxf-toolbar[data-mode="minimal"] .kdxf-measure-tools,
.kdxf-toolbar[data-mode="minimal"] [data-action="toggle-layers"],
.kdxf-toolbar[data-mode="minimal"] [data-action="set-scale"],
.kdxf-toolbar[data-mode="minimal"] [data-action="clear-measurements"] {
    display: none;
}

/* Scrollbar */
.kdxf-layer-list::-webkit-scrollbar {
    width: 6px;
}

.kdxf-layer-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.kdxf-layer-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.kdxf-layer-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Tooltip */
.kdxf-tooltip {
    position: absolute;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 300;
    white-space: nowrap;
}

/* Animation */
.kdxf-fade-in {
    animation: kdxf-fadeIn 0.2s ease;
}

@keyframes kdxf-fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Upload Area */
.kdxf-upload-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1a1a2e;
    border: 2px dashed rgba(59, 130, 246, 0.4);
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 50;
}

.kdxf-upload-area:hover,
.kdxf-upload-area.dragover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.kdxf-upload-area.dragover {
    background: rgba(59, 130, 246, 0.1);
}

.kdxf-upload-content {
    text-align: center;
    padding: 40px;
}

.kdxf-upload-icon {
    color: #3b82f6;
    margin-bottom: 16px;
    opacity: 0.8;
}

.kdxf-upload-content h3 {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.kdxf-upload-content p {
    color: #a0aec0;
    font-size: 14px;
    margin: 0 0 20px 0;
}

.kdxf-select-file {
    padding: 12px 28px;
    font-size: 15px;
}

.kdxf-upload-hint {
    color: #718096;
    font-size: 12px;
    margin-top: 16px !important;
}

/* Upload Progress */
.kdxf-upload-progress {
    text-align: center;
    padding: 20px;
}

.kdxf-progress-bar {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.kdxf-progress-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.kdxf-progress-text {
    color: #a0aec0;
    font-size: 13px;
}

/* File loaded - show filename */
.kdxf-file-name {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(30, 30, 50, 0.9);
    border-radius: 6px;
    color: #a0aec0;
    font-size: 12px;
    z-index: 45;
}

.kdxf-file-name svg {
    width: 16px;
    height: 16px;
    color: #3b82f6;
}

/* ============================================
   Modal System
   ============================================ */

.kdxf-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 5vh 5vw;
}

.kdxf-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.kdxf-modal-content {
    position: relative;
    width: 90vw;
    height: 90vh;
    max-width: 100%;
    max-height: 100%;
    background: #1a1a2e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.kdxf-modal-content.kdxf-modal-tabbed {
    /* Tabbed modal layout */
}

/* Tabs Bar */
.kdxf-tabs-bar {
    display: flex;
    align-items: center;
    background: #0d0d1a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 8px;
    height: 42px;
    flex-shrink: 0;
}

.kdxf-tabs {
    display: flex;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 2px;
    padding: 6px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.kdxf-tabs::-webkit-scrollbar {
    display: none;
}

/* Individual Tab */
.kdxf-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px 6px 0 0;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 100px;
    max-width: 200px;
    flex-shrink: 0;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -1px;
}

.kdxf-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.kdxf-tab.active {
    background: #1a1a2e;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
}

.kdxf-tab-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
}

.kdxf-tab-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
}

.kdxf-tab-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.kdxf-tab.active .kdxf-tab-close {
    color: rgba(255, 255, 255, 0.6);
}

.kdxf-tab.active .kdxf-tab-close:hover {
    background: rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
}

/* Add Tab Button (inside tabs container) */
.kdxf-tab-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    margin-left: 4px;
}

.kdxf-tab-add:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Modal Close in Tabs Bar */
.kdxf-tabs-bar .kdxf-modal-close {
    position: static;
    width: 28px;
    height: 28px;
    margin-left: 8px;
    font-size: 18px;
    flex-shrink: 0;
}

/* Tabs Content Area */
.kdxf-tabs-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.kdxf-tab-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 0;
}

.kdxf-tab-content.active {
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
}

/* Legacy modal close (for non-tabbed) */
.kdxf-modal-content:not(.kdxf-modal-tabbed) .kdxf-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
}

.kdxf-modal-content:not(.kdxf-modal-tabbed) .kdxf-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.kdxf-modal-viewer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Open Viewer Button */
.kdxf-open-viewer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.kdxf-open-viewer:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.kdxf-open-viewer:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.kdxf-open-viewer svg {
    flex-shrink: 0;
}

/* Modal Responsive */
@media (max-width: 768px) {
    .kdxf-modal {
        padding: 2vh 2vw;
    }

    .kdxf-modal-content {
        width: 96vw;
        height: 96vh;
        border-radius: 8px;
    }

    .kdxf-modal-close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .kdxf-open-viewer {
        padding: 10px 18px;
        font-size: 14px;
    }
}

/* ============================================
   Diff View (Farklılıklar Tab)
   ============================================ */

/* Diff Tab Button Style */
.kdxf-tab.kdxf-tab-diff {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    gap: 6px;
    min-width: auto;
    padding: 6px 14px;
}

.kdxf-tab.kdxf-tab-diff:hover {
    background: rgba(59, 130, 246, 0.25);
}

.kdxf-tab.kdxf-tab-diff.active {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
}

.kdxf-tab.kdxf-tab-diff svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Diff View Container */
.kdxf-diff-view {
    background: #1a1a2e;
}

.kdxf-diff-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.kdxf-diff-canvas-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.kdxf-diff-viewer-container {
    width: 100%;
    height: 100%;
}

/* Diff Panel (Right Side) */
.kdxf-diff-panel {
    width: 220px;
    background: rgba(30, 30, 50, 0.95);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.kdxf-diff-panel-header {
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.kdxf-diff-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Diff Panel Item */
.kdxf-diff-panel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.15s;
}

.kdxf-diff-panel-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.kdxf-diff-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.kdxf-diff-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.kdxf-diff-toggle.active {
    background: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.kdxf-diff-toggle.active:hover {
    background: rgba(59, 130, 246, 0.4);
}

.kdxf-diff-item-name {
    flex: 1;
    color: #e2e8f0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kdxf-diff-item-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Diff Legend */
.kdxf-diff-legend {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.kdxf-diff-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    color: #a0aec0;
    font-size: 12px;
}

.kdxf-diff-legend-color {
    width: 16px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Diff Empty State */
.kdxf-diff-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
    color: #a0aec0;
}

.kdxf-diff-empty svg {
    color: rgba(59, 130, 246, 0.5);
    margin-bottom: 20px;
}

.kdxf-diff-empty h3 {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.kdxf-diff-empty p {
    margin: 0;
    font-size: 14px;
    max-width: 300px;
    line-height: 1.5;
}

/* No Visible State */
.kdxf-diff-no-visible {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #718096;
    font-size: 14px;
}

/* Diff Panel Scrollbar */
.kdxf-diff-panel-list::-webkit-scrollbar {
    width: 6px;
}

.kdxf-diff-panel-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.kdxf-diff-panel-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.kdxf-diff-panel-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Shake animation for disabled toggle */
@keyframes kdxf-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-3px); }
    40%, 80% { transform: translateX(3px); }
}

/* Diff Responsive */
@media (max-width: 768px) {
    .kdxf-diff-panel {
        width: 180px;
    }

    .kdxf-diff-panel-header {
        padding: 10px 12px;
        font-size: 12px;
    }

    .kdxf-diff-panel-item {
        padding: 8px 10px;
        gap: 8px;
    }

    .kdxf-diff-toggle {
        width: 24px;
        height: 24px;
    }

    .kdxf-diff-item-name {
        font-size: 12px;
    }
}

/* ============================================
   ANNOTATIONS SYSTEM
   ============================================ */

/* Annotations Panel (Right Sidebar) */
.kdxf-annotations-panel {
    position: absolute;
    top: 50px;
    right: 0;
    width: 280px;
    max-height: calc(100% - 60px);
    background: rgba(26, 26, 46, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 150;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kdxf-annotations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.kdxf-annotations-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.kdxf-annotations-close:hover {
    color: #fff;
}

/* User Toggles */
.kdxf-annotations-users {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
}

.kdxf-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
}

.kdxf-user-row input[type="checkbox"] {
    accent-color: #3b82f6;
}

.kdxf-user-name {
    flex: 1;
}

.kdxf-user-count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

/* Annotations List */
.kdxf-annotations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.kdxf-annotation-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.kdxf-annotation-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.kdxf-annotation-marker-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

.kdxf-annotation-content {
    flex: 1;
    min-width: 0;
}

.kdxf-annotation-user {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.kdxf-annotation-text-preview {
    color: #fff;
    font-size: 13px;
    word-break: break-word;
}

.kdxf-annotation-delete {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.kdxf-annotation-delete:hover {
    color: #ef4444;
}

.kdxf-no-annotations {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    padding: 20px;
    font-size: 13px;
}

/* Annotation Popover */
.kdxf-annotation-popover {
    position: absolute;
    width: 260px;
    background: rgba(26, 26, 46, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 200;
    padding: 12px;
}

.kdxf-annotation-text {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 10px;
    color: #fff;
    font-size: 13px;
    resize: none;
    font-family: inherit;
}

.kdxf-annotation-text:focus {
    outline: none;
    border-color: #3b82f6;
}

.kdxf-annotation-colors {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.kdxf-color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.kdxf-color-btn.active {
    border-color: #fff;
    transform: scale(1.1);
}

.kdxf-color-red {
    background: #ef4444;
}

.kdxf-color-green {
    background: #22c55e;
}

.kdxf-annotation-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.kdxf-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
}

/* PDF Modal */
.kdxf-pdf-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.kdxf-pdf-modal-content {
    background: rgba(26, 26, 46, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    overflow: hidden;
}

.kdxf-pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
}

.kdxf-pdf-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.kdxf-pdf-close:hover {
    color: #fff;
}

.kdxf-pdf-body {
    padding: 20px;
}

.kdxf-pdf-instruction {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 16px;
}

.kdxf-pdf-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kdxf-pdf-option {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: background 0.2s;
}

.kdxf-pdf-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.kdxf-pdf-option input[type="radio"] {
    accent-color: #3b82f6;
}

.kdxf-pdf-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Annotation Note on Canvas (SVG) */
.kdxf-annotation-note {
    cursor: move;
    pointer-events: all;
}

.kdxf-annotation-note:hover rect {
    stroke-width: 3px !important;
    filter: brightness(1.2);
}

.kdxf-annotation-note:hover text {
    filter: brightness(1.2);
}

/* Eye Icon in User Row */
.kdxf-eye-icon {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
}

.kdxf-user-row input:checked + .kdxf-eye-icon {
    color: #3b82f6;
}

/* Annotation Group in Panel */
.kdxf-annotation-group {
    margin-bottom: 12px;
}

.kdxf-annotation-group-header {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 4px;
}

.kdxf-annotation-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Simplified Annotation Item */
.kdxf-annotation-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 12px;
    color: #e0e0e0;
}

.kdxf-annotation-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.kdxf-annotation-text-preview {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Annotation Resize Handle */
.kdxf-annotation-resize {
    pointer-events: all;
    transition: opacity 0.15s;
}

.kdxf-annotation-resize:hover {
    opacity: 1 !important;
}

/* Annotation Edit Modal */
.kdxf-annotation-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.kdxf-annotation-edit-content {
    background: #1e1e1e;
    border-radius: 8px;
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.kdxf-annotation-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: #fff;
}

.kdxf-annotation-edit-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.kdxf-annotation-edit-close:hover {
    color: #fff;
}

.kdxf-annotation-edit-body {
    padding: 16px;
}

.kdxf-annotation-edit-body label {
    display: block;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.kdxf-annotation-edit-text {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.kdxf-annotation-edit-text:focus {
    outline: none;
    border-color: #3b82f6;
}

.kdxf-annotation-edit-colors {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.kdxf-annotation-edit-colors .kdxf-color-btn {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid transparent;
    border-radius: 4px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.kdxf-annotation-edit-colors .kdxf-color-btn:hover {
    filter: brightness(1.1);
}

.kdxf-annotation-edit-colors .kdxf-color-btn.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.kdxf-annotation-edit-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 8px;
}

.kdxf-annotation-delete-btn {
    background: #dc2626 !important;
}

.kdxf-annotation-delete-btn:hover {
    background: #b91c1c !important;
}

.kdxf-annotation-save-btn {
    background: #3b82f6 !important;
    flex: 1;
}

.kdxf-annotation-save-btn:hover {
    background: #2563eb !important;
}

/* PDF Selection Overlay */
.kdxf-pdf-select-overlay {
    display: none;
}

.kdxf-pdf-select-rect-div {
    border: 2px dashed #3b82f6;
    background: rgba(59, 130, 246, 0.15);
}
