/* ================================================================
   Pdfito UX Widget Styles
   Matches theme: --bg: #06060B, --orange: #FF6B35, --gold: #FFB627
   ================================================================ */

/* ==============================================================
   1. PDF PAGE PICKER — Visual thumbnail grid
   ============================================================== */
.ux-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    max-height: 500px;
    overflow-y: auto;
}

.ux-page-item {
    position: relative;
    aspect-ratio: 3/4;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ux-page-item:hover {
    border-color: rgba(255, 107, 53, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px -4px rgba(255, 107, 53, 0.25);
}

.ux-page-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.ux-page-thumb-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.ux-page-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #fff;
    border-radius: 4px;
}

.ux-page-num {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(11, 11, 20, 0.85);
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    pointer-events: none;
}

.ux-page-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(11, 11, 20, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 14px;
    font-weight: 900;
    transition: all 0.2s;
    pointer-events: none;
}

.ux-page-item.selected .ux-page-check {
    background: linear-gradient(135deg, #FF6B35, #FFB627);
    border-color: #fff;
    color: #fff;
}

.ux-page-rotate {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    background: rgba(255, 107, 53, 0.9);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    backdrop-filter: blur(8px);
}

.ux-page-rotate:hover {
    background: #FF6B35;
    transform: scale(1.08);
}

.ux-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.ux-btn-sm {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #E5E5E8;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.ux-btn-sm:hover {
    background: rgba(255, 107, 53, 0.15);
    border-color: rgba(255, 107, 53, 0.3);
    color: #fff;
}

.ux-selection-info {
    margin-left: auto;
    font-size: 12px;
    color: #A8A8AC;
    font-weight: 500;
}

/* ==============================================================
   2. VISUAL CROPPER
   ============================================================== */
.ux-cropper {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px;
}

.ux-crop-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    user-select: none;
    background: repeating-conic-gradient(#2a2a30 0% 25%, #1a1a20 0% 50%) 50% / 20px 20px;
    border-radius: 8px;
    overflow: hidden;
}

.ux-crop-img {
    display: block;
    max-width: 100%;
    max-height: 500px;
    user-select: none;
    pointer-events: none;
}

.ux-crop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.ux-crop-selection {
    position: absolute;
    border: 2px solid #FF6B35;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    cursor: move;
    background: rgba(255, 107, 53, 0.05);
    min-width: 50px;
    min-height: 50px;
}

.ux-crop-selection::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.4) 1px, transparent 1px) 0 33.3% / 100% 33.3%,
        linear-gradient(90deg, rgba(255,255,255,0.4) 1px, transparent 1px) 0 66.6% / 100% 33.3%,
        linear-gradient(0deg, rgba(255,255,255,0.4) 1px, transparent 1px) 33.3% 0 / 33.3% 100%,
        linear-gradient(0deg, rgba(255,255,255,0.4) 1px, transparent 1px) 66.6% 0 / 33.3% 100%;
    pointer-events: none;
}

.ux-crop-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #FF6B35;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 2;
}

.ux-crop-handle-nw { top: -8px; left: -8px; cursor: nw-resize; }
.ux-crop-handle-ne { top: -8px; right: -8px; cursor: ne-resize; }
.ux-crop-handle-sw { bottom: -8px; left: -8px; cursor: sw-resize; }
.ux-crop-handle-se { bottom: -8px; right: -8px; cursor: se-resize; }

.ux-crop-info {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FF6B35, #FFB627);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
}

.ux-crop-controls {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ux-aspect-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.ux-aspect-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #A8A8AC;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.ux-aspect-btn:hover { color: #fff; border-color: rgba(255, 107, 53, 0.3); }

.ux-aspect-btn.active {
    background: linear-gradient(135deg, #FF6B35, #FFB627);
    border-color: transparent;
    color: #fff;
}

/* ==============================================================
   3. POSITION GRID (9-cell)
   ============================================================== */
.ux-position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-width: 200px;
    aspect-ratio: 1;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.ux-pos-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #A8A8AC;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    padding: 0;
    aspect-ratio: 1;
}

.ux-pos-cell:hover {
    border-color: rgba(255, 107, 53, 0.5);
    color: #fff;
}

.ux-pos-cell.active {
    background: linear-gradient(135deg, #FF6B35, #FFB627);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
    transform: scale(1.05);
}

/* ==============================================================
   4. PRESET CARDS
   ============================================================== */
.ux-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin: 12px 0;
}

.ux-preset-card {
    position: relative;
    padding: 20px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    color: #E5E5E8;
    font-family: inherit;
}

.ux-preset-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 107, 53, 0.4);
    box-shadow: 0 8px 20px -6px rgba(255, 107, 53, 0.3);
}

.ux-preset-card.active {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.ux-preset-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.ux-preset-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}

.ux-preset-desc {
    font-size: 11px;
    color: #A8A8AC;
    line-height: 1.4;
}

.ux-preset-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #FF6B35, #FFB627);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* ==============================================================
   5. WATERMARK LIVE PREVIEW
   ============================================================== */
.ux-wm-preview-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #1a1a20;
}

.ux-wm-img {
    display: block;
    max-width: 100%;
    max-height: 400px;
}

.ux-wm-text {
    position: absolute;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

/* ==============================================================
   6. LIVE PDF PREVIEW
   ============================================================== */
.ux-live-preview-empty,
.ux-live-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    color: #A8A8AC;
}

.ux-live-preview-empty p,
.ux-live-preview-loading p {
    margin-top: 12px;
    font-size: 13px;
}

.ux-live-preview-iframe {
    width: 100%;
    min-height: 500px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: #fff;
}

/* ==============================================================
   7. PHOTO ADJUSTER
   ============================================================== */
.ux-photo-adjuster {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
}

.ux-photo-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 182, 39, 0.05));
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: 10px;
}

.ux-photo-spec {
    font-size: 12px;
    color: #FFB627;
    font-weight: 600;
}

.ux-photo-hint {
    margin-top: 44px;
    font-size: 12px;
    color: #A8A8AC;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    line-height: 1.6;
}

/* ==============================================================
   8. ASPECT LOCK BUTTON
   ============================================================== */
.ux-aspect-lock {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #A8A8AC;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.ux-aspect-lock.locked {
    background: rgba(255, 107, 53, 0.15);
    border-color: rgba(255, 107, 53, 0.4);
    color: #FF6B35;
}

.ux-aspect-lock:hover {
    border-color: rgba(255, 107, 53, 0.5);
}

/* ==============================================================
   9. SPLIT MODE TABS
   ============================================================== */
.ux-mode-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.ux-mode-tab {
    padding: 14px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #A8A8AC;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    text-align: center;
    line-height: 1.4;
}

.ux-mode-tab:hover {
    color: #fff;
    border-color: rgba(255, 107, 53, 0.3);
}

.ux-mode-tab.active {
    background: rgba(255, 107, 53, 0.12);
    border-color: #FF6B35;
    color: #fff;
}

.ux-mode-tab-icon {
    display: block;
    font-size: 22px;
    margin-bottom: 4px;
}

/* ==============================================================
   10. GENERIC
   ============================================================== */
.ux-loading, .ux-error {
    text-align: center;
    padding: 40px 20px;
    color: #A8A8AC;
    font-size: 14px;
}

.ux-error { color: #ff6b6b; }

.ux-split-screen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 900px) {
    .ux-split-screen { grid-template-columns: 1fr; }
    .ux-page-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .ux-preset-grid { grid-template-columns: repeat(2, 1fr); }
}
