/* ============================================================================
   PDF Canvas Editor Styles - Phase A Implementation
   Visual element placement with Fabric.js overlay
   ============================================================================ */

/* Canvas Editor Wrapper */
.pdf-canvas-editor-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Editor Toolbar */
.pdf-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(0,0,0,0.05); /* light mode */
    border-bottom: 1px solid rgba(0,0,0,.1);
    flex-wrap: wrap;
}

[data-theme="dark"] .pdf-editor-toolbar {
    background: rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(148,163,184,.2);
}

.pdf-editor-toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    border-right: 1px solid rgba(0,0,0,.1); /* light mode */
}

[data-theme="dark"] .pdf-editor-toolbar-section {
    border-right: 1px solid rgba(148,163,184,.2);
}

.pdf-editor-toolbar-section:last-child {
    border-right: none;
}

/* Editor Buttons */
.pdf-editor-btn {
    padding: 8px 16px;
    background: rgba(14, 165, 233, 0.15);
    color: #0ea5e9;
    border: 2px solid rgba(14, 165, 233, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pdf-editor-btn:hover {
    background: rgba(14, 165, 233, 0.25);
    border-color: #0ea5e9;
}

.pdf-editor-btn:active,
.pdf-editor-btn-active {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
    border-color: #0ea5e9;
}

.pdf-editor-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdf-editor-btn-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
}

.pdf-editor-btn-danger:hover {
    background: rgba(220, 53, 69, 0.25);
    border-color: #dc3545;
}

/* Fabric.js Canvas Overlay */
#pdfViewerContainer_fabricCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: auto;
    z-index: 10;
}

/* Canvas Container Positioning */
.pdf-canvas-container {
    position: relative;
}

/* Element Selection Highlight */
.canvas-free-drawing-mode .pdf-canvas-container {
    cursor: crosshair !important;
}

/* Fabric.js Control Customization */
.canvas-container {
    position: absolute !important;
}

/* Element Info Panel */
.element-info-panel {
    position: absolute;
    top: 60px;
    right: 20px;
    background: rgba(15,23,42,0.95);
    border: 2px solid rgba(148,163,184,.25);
    border-radius: 10px;
    padding: 16px;
    min-width: 250px;
    z-index: 100;
}

.element-info-panel h6 {
    color: white;
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 14px;
}

.element-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.element-info-label {
    color: rgba(229, 231, 235, 0.7);
}

.element-info-value {
    color: #0ea5e9;
    font-weight: 600;
}

/* Placement Instructions */
.placement-instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(14, 165, 233, 0.95);
    color: white;
    padding: 20px 32px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 16px;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.05); }
}

/* Property Panel */
.property-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(15,23,42,0.95);
    border: 2px solid rgba(148,163,184,.25);
    border-radius: 10px;
    padding: 16px;
    min-width: 300px;
    z-index: 100;
}

.property-panel-group {
    margin-bottom: 12px;
}

.property-panel-group:last-child {
    margin-bottom: 0;
}

.property-panel-label {
    display: block;
    color: rgba(229, 231, 235, 0.8);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.property-panel-input {
    width: 100%;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(148,163,184,.25);
    border-radius: 6px;
    font-size: 13px;
}

.property-panel-input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

/* Element Badges */
.element-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(14, 165, 233, 0.2);
    color: #0ea5e9;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 6px;
}

.element-badge-signature {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.element-badge-watermark {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.element-badge-text {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.element-badge-crop {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.element-badge-redact {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pdf-editor-toolbar {
        padding: 10px;
        gap: 8px;
    }
    
    .pdf-editor-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .element-info-panel,
    .property-panel {
        min-width: 200px;
        padding: 12px;
    }
    
    .placement-instructions {
        font-size: 14px;
        padding: 16px 24px;
    }
}

@media (max-width: 480px) {
    .pdf-editor-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pdf-editor-toolbar-section {
        border-right: none;
        border-bottom: 1px solid rgba(148,163,184,.2);
        padding-bottom: 8px;
        margin-bottom: 8px;
    }
    
    .pdf-editor-toolbar-section:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }
    
    .element-info-panel {
        top: auto;
        bottom: 80px;
        right: 10px;
        left: 10px;
        min-width: auto;
    }
    
    .property-panel {
        bottom: 10px;
        left: 10px;
        right: 10px;
        min-width: auto;
    }
}

/* Animations for Element Placement */
@keyframes elementFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.canvas-container .fabric-object {
    animation: elementFadeIn 0.2s ease-out;
}

/* Alignment Guide Animation */
@keyframes guideAppear {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.alignment-guide {
    animation: guideAppear 0.15s ease-out;
}

/* Smooth Transitions */
.pdf-editor-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pdf-editor-btn:hover {
    transform: translateY(-2px);
}

.pdf-editor-btn:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

/* Element Selection Glow */
.canvas-container .fabric-object.selected {
    box-shadow: 0 0 0 2px #0ea5e9, 0 0 20px rgba(14, 165, 233, 0.4);
}

/* Grid Background (optional visual aid) */
.pdf-canvas-editor-grid-enabled .pdf-canvas-container {
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 9px, rgba(148,163,184,0.1) 9px, rgba(148,163,184,0.1) 10px),
        repeating-linear-gradient(90deg, transparent, transparent 9px, rgba(148,163,184,0.1) 9px, rgba(148,163,184,0.1) 10px);
    background-size: 10px 10px;
}

/* Accessibility */
.pdf-editor-btn:focus {
    outline: 3px solid #0ea5e9;
    outline-offset: 2px;
}

.property-panel-input:focus {
    outline: 3px solid #0ea5e9;
    outline-offset: 2px;
}

/* Smooth Element Dragging */
.canvas-container {
    transition: cursor 0.1s ease;
}

.canvas-container.dragging {
    cursor: grabbing !important;
}

