.photo-upload-preview {
    margin-top: 0;
    flex-shrink: 0;
}

.photo-upload-preview[hidden] {
    display: none !important;
}

.photo-upload-preview img {
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.custom-file-upload {
    flex-wrap: wrap;
}

.photo-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.photo-editor-modal[hidden] {
    display: none !important;
}

.photo-editor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
}

.photo-editor-panel {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    max-height: 94vh;
    overflow-y: auto;
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.photo-editor-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-editor-close:hover {
    background: #e5e7eb;
}

.photo-editor-frame {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.photo-editor-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #111;
    cursor: grab;
    touch-action: none;
    aspect-ratio: 210 / 297;
    line-height: 0;
}

.photo-editor-viewport.is-dragging {
    cursor: grabbing;
}

.photo-editor-viewport > img {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    max-width: none;
    user-select: none;
    pointer-events: none;
    will-change: transform;
}

.photo-editor-mask {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    display: block;
    background: transparent;
}

.photo-editor-mask[hidden] {
    display: none !important;
}

.photo-editor-caption {
    padding: 1rem 1.25rem 1.1rem;
    text-align: center;
    background: #fff;
}

.photo-editor-main-text {
    font-family: var(--font-heading, Georgia, serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.5rem;
    line-height: 1.35;
    word-break: break-word;
}

.photo-editor-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.photo-editor-giver {
    text-align: left;
}

.photo-editor-date {
    text-align: right;
    white-space: nowrap;
}

.photo-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0 0.25rem;
}

.photo-editor-tool {
    width: 44px;
    height: 44px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.photo-editor-tool:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.photo-editor-tool:active {
    background: #e5e7eb;
}

.photo-editor-tool svg {
    width: 20px;
    height: 20px;
}

.photo-editor-actions {
    margin-top: 1rem;
}

.photo-editor-actions .btn {
    width: 100%;
}

@media (max-width: 480px) {
    .photo-editor-panel {
        padding: 1rem 0.85rem 0.85rem;
        border-radius: 12px;
    }

    .photo-editor-tool {
        width: 40px;
        height: 40px;
    }

    .photo-editor-main-text {
        font-size: 0.95rem;
    }

    .photo-editor-meta {
        font-size: 0.82rem;
    }
}
