/*
 * File: css/sign-pdf.css
 * Description: PREMIUM GLASS STYLES for PDF Signer (BACKEND IMAGES)
 */

.full-width-container { max-width: 1600px; padding: 0 20px; }

/* NOTIFICATION (Center) */
#notification {
    top: 30px !important; bottom: auto !important; right: auto !important; left: 50% !important;
    transform: translateX(-50%) !important; border-radius: 12px !important; padding: 15px 30px !important;
    font-size: 1rem !important; box-shadow: 0 15px 40px rgba(0,0,0,0.2) !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    min-width: 300px !important; z-index: 99999 !important;
}

/* WORKSPACES */
.converter-workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; min-height: 500px; animation: fadeIn 0.5s ease; }
.glass-workspace { display: flex; gap: 30px; height: 85vh; animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1); }

.glass-panel {
    background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px; padding: 40px; box-shadow: 0 20px 50px rgba(0,0,0,0.05);
}

.panel-header { display: flex; justify-content: space-between; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.panel-header h3 { font-size: 1.2rem; color: var(--text-dark); display: flex; gap: 10px; align-items: center; }

.upload-area {
    border: 3px dashed rgba(147, 112, 219, 0.2); border-radius: 16px; background: rgba(255,255,255,0.5);
    flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: all 0.3s;
}
.upload-area:hover { border-color: var(--primary-color); background: rgba(255,255,255,0.8); }
.upload-icon { font-size: 4rem; color: var(--primary-color); margin-bottom: 20px; }

.divider { margin: 20px 0; width: 100%; color: #999; display: flex; align-items: center; }
.divider::before, .divider::after { content: ""; flex: 1; border-bottom: 1px solid #ddd; }
.divider span { padding: 0 10px; font-size: 0.8rem; }

.cloud-actions { display: flex; gap: 10px; width: 100%; }
.cloud-btn { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 8px; background: white; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.cloud-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }

/* SIDEBAR */
.glass-sidebar {
    width: 340px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.6); border-radius: 20px; padding: 25px;
    display: flex; flex-direction: column; flex-shrink: 0; box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}
.toolbox-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid rgba(0,0,0,0.1); }
.tool-row { display: flex; gap: 10px; }
.signatures-list { flex: 1; overflow-y: auto; margin: 10px 0 20px; display: flex; flex-direction: column; gap: 15px; }

.signature-item {
    background: white; border-radius: 12px; padding: 15px; cursor: grab; position: relative;
    display: flex; justify-content: center; border: 1px solid transparent; box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.signature-item:hover { border-color: var(--primary-color); transform: translateY(-2px); }
.signature-item img { max-height: 50px; max-width: 100%; object-fit: contain; }
.remove-sig { position: absolute; top: 5px; right: 5px; background: #ff4757; color: white; border-radius: 50%; width: 20px; height: 20px; border: none; cursor: pointer; opacity: 0; }
.signature-item:hover .remove-sig { opacity: 1; }

.sidebar-footer { margin-top: auto; }

/* CANVAS AREA */
.document-canvas {
    flex: 1; background: #f0f2f5; border-radius: 20px; position: relative; overflow: hidden; display: flex; justify-content: center;
}
.pdf-container {
    padding: 60px; overflow-y: auto; width: 100%; height: 100%; 
    display: flex; flex-direction: column; align-items: center; gap: 40px;
}

/* === PAGE CONTAINER (Holds the Image) === */
.pdf-page {
    background-color: white;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15); 
    position: relative; 
    margin-bottom: 20px;
    /* Ensure minimum visibility */
    min-height: 500px;
    min-width: 400px;
}

/* PLACED ITEMS */
.placed-sig, .text-element { 
    position: absolute; cursor: move; border: 2px solid transparent; 
    z-index: 100; /* Ensure on top */
}
.placed-sig:hover, .placed-sig.selected { border: 2px solid var(--primary-color); background: rgba(147, 112, 219, 0.1); }
.text-element { border: 1px dashed transparent; padding: 5px; min-width: 50px; outline: none; background: transparent; color: black; }
.text-element:hover { border: 1px dashed var(--primary-color); background: rgba(255, 255, 255, 0.5); }

.element-delete-btn { position: absolute; top: -15px; right: -15px; background: #ff4757; color: white; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; display: none; align-items: center; justify-content: center; font-size: 14px; line-height: 1; border:none; }
.placed-element:hover .element-delete-btn { display: flex; }

.placed-sig img { width: 100%; height: 100%; pointer-events: none; }

/* UTILS & MODAL */
.sig-tools { position: absolute; top: -35px; right: 0; background: #333; padding: 5px; border-radius: 6px; display: none; gap: 5px; }
.placed-sig:hover .sig-tools { display: flex; }
.tool-icon { color: white; background: none; border: none; cursor: pointer; padding: 2px 5px; font-size: 14px; }

.floating-toolbar { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); background: rgba(33, 33, 33, 0.9); backdrop-filter: blur(10px); padding: 10px 20px; border-radius: 50px; display: flex; align-items: center; gap: 15px; z-index: 200; color: white; }
.float-btn { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }

/* MODAL */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); z-index: 2000; align-items: center; justify-content: center; }
.glass-modal { background: white; border-radius: 20px; width: 600px; max-width: 90%; }
.modal-header { padding: 20px 30px; background: #fafafa; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; }
.modal-body { padding: 30px; }

.tab-buttons { display: flex; border-bottom: 1px solid #eee; margin-bottom: 20px; }
.tab-button { flex: 1; padding: 15px; border: none; background: none; cursor: pointer; font-weight: 600; color: #888; }
.tab-button.active { color: var(--primary-color); border-bottom: 2px solid var(--primary-color); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.canvas-wrapper { border: 2px dashed #ddd; border-radius: 10px; height: 200px; margin-bottom: 20px; display: flex; align-items: center; justify-content: center; background: #fafafa; }
#signatureCanvas { width: 100%; height: 100%; cursor: crosshair; }
.sig-input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 10px; font-size: 1.2rem; }
.sig-select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 20px; }
.type-preview { height: 150px; border: 1px solid #eee; margin-bottom: 20px; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
#typePreviewCanvas { width: 100%; height: 100%; object-fit: contain; }

.btn-icon-small { background: none; border: none; color: #999; font-size: 1.2rem; cursor: pointer; }
.full-width { width: 100%; }
.flex-1 { flex: 1; }
.pulse-btn:hover { animation: pulse 1s infinite; }

.progress-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.8); backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; z-index: 50; }
.glass-loader { background: white; padding: 30px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 10px 40px rgba(0,0,0,0.1); }
.spinner { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 15px; }

@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes slideDownFade { 0% { opacity: 0; transform: translate(-50%, -20px); } 100% { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 992px) {
    .glass-workspace { flex-direction: column; height: auto; }
    .glass-sidebar { width: 100%; height: auto; }
    .document-canvas { height: 500px; }
    .converter-workspace { grid-template-columns: 1fr; }
}