/* PSD Text Layer Styles */
.psd-text-layer {
    position: absolute;
    z-index: 10;
    overflow: visible; /* Allow text to expand properly */
    word-wrap: break-word;
    white-space: pre-wrap; /* Allow line breaks and text wrapping */
    /* Removed default font-family to use the one from PSD */
    line-height: 1.2;
    /* Use flex for better text alignment */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1); /* Slight background for visibility */
    padding: 1px; /* Minimal padding to prevent overlap */
    border: 1px dashed rgba(0, 102, 255, 0.3); /* Subtle border to show text layer boundaries */
    pointer-events: auto !important; /* Ensure text layers can be clicked */
    /* max-width removed to allow horizontal expansion */
    min-height: auto; /* Auto height for better text flow */
    box-sizing: border-box; /* Include padding in width calculations */
}

/* Make text layers visible in PSD mode */
.psd-mode .psd-text-layer {
    display: flex !important;
}

/* Removed blue outline for previews with PSD content */

/* Highlight animation for form focus */
.highlight-layer-form {
    animation: flash-border 1.5s ease-in-out;
}

/* Highlight animation for text layers when using font manager */
.highlight-layer {
    animation: pulse-border 1.5s ease-in-out;
    cursor: pointer !important;
    z-index: 100 !important; /* Ensure text layers are clickable */
}

.psd-text-layer.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.psd-text-layer.clickable:hover {
    box-shadow: 0 0 8px rgba(0, 102, 255, 0.8);
    border: 1px solid rgba(0, 102, 255, 0.8);
}

/* Custom font styling for text layers */
.psd-text-layer.has-custom-font,
.psd-text-layer.custom-font-applied {
    /* Make text more visible when custom font is applied */
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
}

/* Ensure custom fonts display correctly in all previews */
.preview-container .psd-text-layer.has-custom-font,
.square-preview .psd-text-layer.has-custom-font,
.post-preview .psd-text-layer.has-custom-font,
.banner-preview .psd-text-layer.has-custom-font,
.hd-preview .psd-text-layer.has-custom-font,
.preview-container .psd-text-layer.custom-font-applied,
.square-preview .psd-text-layer.custom-font-applied,
.post-preview .psd-text-layer.custom-font-applied,
.banner-preview .psd-text-layer.custom-font-applied,
.hd-preview .psd-text-layer.custom-font-applied {
    /* Override any conflicting styles */
    font-family: inherit !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Animation for text layer highlighting */
@keyframes flash-border {
    0% { box-shadow: 0 0 0 4px rgba(0,255,0,0.7); }
    100% { box-shadow: 0 0 0 0 rgba(0,255,0,0); }
}

/* Animation for pulsing border when font manager is active */
@keyframes pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.7); border: 1px dashed rgba(0, 102, 255, 0.7); }
    50% { box-shadow: 0 0 0 6px rgba(0, 102, 255, 0.3); border: 1px solid rgba(0, 102, 255, 1); }
    100% { box-shadow: 0 0 0 0 rgba(0, 102, 255, 0); border: 1px dashed rgba(0, 102, 255, 0.3); }
}
