/* Premium CSS Styling for PDF Assistant */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --brand-primary: #4f46e5;
    --brand-primary-hover: #4338ca;
    --bg-base: #f8fafc;
    --surface-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
}

body { 
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
    background-color: var(--bg-base);
    color: var(--text-main);
}

/* Glassmorphism card styles */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Canvas rendering */
canvas { 
    max-width: 100%; 
    height: auto; 
    background-color: white; 
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

/* Edit Workspace */
#edit-workspace {
    width: 100%;
    height: calc(100vh - 80px);
    position: relative;
    background: #09090b;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

#edit-canvas-container {
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7);
    touch-action: none;
    background: white;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: visible;
}

.canvas-trigger-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    touch-action: pan-y;
    cursor: pointer;
}

/* Movable Signatures & Dates overlays */
.movable-overlay {
    position: absolute;
    cursor: move;
    border: 2px dashed transparent;
    touch-action: none;
    z-index: 100;
    padding: 2px;
    transition: border-color 0.15s;
}
.movable-overlay.active {
    border-color: var(--brand-primary);
    background: rgba(79, 70, 229, 0.06);
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.2);
}
.resize-handle {
    position: absolute;
    width: 24px;
    height: 24px;
    background: var(--brand-primary);
    border: 2px solid white;
    border-radius: 50%;
    right: -12px;
    bottom: -12px;
    display: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 110;
    cursor: se-resize;
}
.movable-overlay.active .resize-handle {
    display: block;
}

.delete-handle {
    position: absolute;
    width: 22px;
    height: 22px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    left: -11px;
    top: -11px;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 110;
    line-height: 1;
}
.movable-overlay.active .delete-handle {
    display: flex;
}

/* Modals and Overlays */
#password-modal, #share-options-modal, #text-modal {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.75);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#sig-library-modal {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(8px);
    z-index: 600 !important;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    border: 1px solid var(--border-color);
    color: #475569;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.icon-btn:hover {
    background: #f8fafc;
    color: var(--text-main);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.icon-btn:active {
    transform: scale(0.95);
    background: #f1f5f9;
}
.icon-btn.primary {
    background: var(--brand-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.icon-btn.primary:hover {
    background: var(--brand-primary-hover);
    color: white;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.menu-item {
    width: 100%;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.menu-item:hover {
    background: #f8fafc;
}
.menu-item:last-child {
    border-bottom: none;
}

.input-hidden {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 20;
}

/* Thumbnails strip */
#thumb-list::-webkit-scrollbar { height: 6px; }
#thumb-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }

.thumb-item {
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.thumb-item:hover {
    transform: translateY(-2px);
}

/* Crop mask and overlays */
#crop-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 150;
}

#crop-box {
    position: absolute;
    border: 2px dashed #f59e0b;
    cursor: move;
    pointer-events: auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.5), inset 0 0 20px rgba(245, 158, 11, 0.1);
}

.crop-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: #f59e0b;
    z-index: 160;
}

/* Pulse drag overlay */
.drag-over {
    border-color: var(--brand-primary) !important;
    background: rgba(79, 70, 229, 0.05) !important;
    transform: scale(0.995);
}
