/* PDF Template Editor Styles */

.pdf-template-editor {
    display: flex;
    height: 100vh;
    background: #f8f9fa;
}

.pdf-editor-sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-editor-toolbar {
    background: white;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pdf-editor-canvas-container {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    background: #f8f9fa;
    position: relative;
}

.pdf-canvas-wrapper {
    display: inline-block;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin: 0 auto;
    position: relative;
}

.pdf-canvas {
    display: block;
    border-radius: 4px;
    cursor: crosshair;
}

.pdf-canvas.dragging-field {
    cursor: copy;
}

/* Field Palette Styles */
.field-palette {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.field-palette-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.field-palette-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.field-search .input-group-text {
    background: white;
    border-right: none;
}

.field-search .form-control {
    border-left: none;
}

.field-search .form-control:focus {
    border-left: none;
    box-shadow: none;
}

.field-categories {
    margin-bottom: 0.5rem;
}

.field-category-group {
    margin-bottom: 1rem;
}

.field-category-header {
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.field-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.field-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.field-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.field-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.field-item:active {
    cursor: grabbing;
}

.field-item-content {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    gap: 0.5rem;
}

.field-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 3px;
    color: #6c757d;
    font-size: 0.875rem;
}

.field-info {
    flex: 1;
    min-width: 0;
}

.field-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field-type {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-drag-handle {
    color: #adb5bd;
    font-size: 0.75rem;
}

/* Field Type Colors */
.field-type-currency .field-icon {
    background: #d4edda;
    color: #155724;
}

.field-type-date .field-icon {
    background: #d1ecf1;
    color: #0c5460;
}

.field-type-table .field-icon {
    background: #f8d7da;
    color: #721c24;
}

.field-type-contact .field-icon {
    background: #fff3cd;
    color: #856404;
}

.field-type-list .field-icon {
    background: #e2e3e5;
    color: #383d41;
}

/* Drag Image */
.field-drag-image {
    background: #007bff !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

/* PDF Editor Toolbar */
.pdf-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.5rem;
    border-right: 1px solid #dee2e6;
}

.pdf-toolbar-group:last-child {
    border-right: none;
}

.pdf-toolbar-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-right: 0.25rem;
}

.page-navigation {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.page-input {
    width: 60px;
    text-align: center;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.zoom-display {
    min-width: 60px;
    text-align: center;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Canvas Options */
.canvas-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.canvas-option {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
}

/* Field Properties Panel */
.field-properties {
    background: white;
    border-top: 1px solid #dee2e6;
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.field-properties h6 {
    margin-bottom: 0.75rem;
    color: #495057;
}

.field-properties .form-group {
    margin-bottom: 0.75rem;
}

.field-properties .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.field-properties .form-control,
.field-properties .form-select {
    font-size: 0.875rem;
}

.color-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-preview {
    width: 24px;
    height: 24px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    cursor: pointer;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pdf-template-editor {
        flex-direction: column;
    }

    .pdf-editor-sidebar {
        width: 100%;
        height: 300px;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }

    .pdf-editor-toolbar {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .pdf-toolbar-group {
        padding: 0 0.25rem;
    }
}

/* Loading States */
.pdf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
}

.pdf-loading .spinner-border {
    margin-right: 0.5rem;
}

/* Error States */
.pdf-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #dc3545;
    text-align: center;
}

.pdf-error .bi {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Field Overlay Styles */
.field-overlay {
    position: absolute;
    border: 2px dashed #007bff;
    background: rgba(0, 123, 255, 0.1);
    pointer-events: none;
    z-index: 10;
}

.field-overlay.selected {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.field-overlay .field-label {
    position: absolute;
    top: -20px;
    left: 0;
    background: #007bff;
    color: white;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 2px;
    white-space: nowrap;
}

.field-overlay.selected .field-label {
    background: #dc3545;
}

/* PDF Template Canvas Overlay */
#pdf-template-canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: auto;
    z-index: 10;
    background: transparent;
    cursor: crosshair;
}

#pdf-template-canvas-overlay.dragging-field {
    cursor: copy;
}