@import url('https://fonts.googleapis.com/css2?family=Bungee&display=swap');

.hidden { display: none !important; }

.pdf-neo-wrapper {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 980px; margin: 30px auto; background: #fff;
    border: 3px solid #000; border-radius: 16px; box-shadow: 10px 10px 0px #000;
    padding: 25px; box-sizing: border-box; color: #000;
}
.pdf-neo-wrapper * { box-sizing: border-box; }

.pdf-header {
    background: #f4f4f4; padding: 20px; border-radius: 12px;
    border: 3px solid #000; box-shadow: 4px 4px 0px #000; margin-bottom: 25px; text-align: center;
}
.pdf-header h2 { margin: 0 0 10px 0; font-size: 1.8rem; font-weight: 900; text-transform: uppercase; }
.pdf-header p { margin: 0; font-weight: 700; font-size: 1rem; color: #333; }

.bg-yellow { background: #fdfd96; }
.bg-pink { background: #ffb3c6; }
.bg-blue { background: #c6e2ff; }
.bg-green { background: #baffc9; }
.bg-purple { background: #e0c3fc; }
.bg-orange { background: #ffd8be; }

/* KHU VỰC UPLOAD */
.pdf-upload-card {
    border: 4px dashed #000; border-radius: 14px; padding: 45px 20px;
    text-align: center; cursor: pointer; transition: 0.15s;
    box-shadow: 6px 6px 0px #000;
}
.pdf-upload-card:hover, .pdf-upload-card.dragover {
    background: #baffc9; border-style: solid; transform: translateY(-2px);
}
.upload-icon { font-size: 4rem; margin-bottom: 10px; line-height: 1; }
.pdf-upload-card h3 { margin: 0 0 8px 0; font-size: 1.4rem; font-weight: 900; }
.pdf-upload-card p { margin: 0 0 20px 0; font-weight: 700; color: #333; }

.pdf-btn-action {
    padding: 14px 28px; font-size: 1.15rem; font-weight: 900; text-transform: uppercase;
    border: 3px solid #000; border-radius: 10px; box-shadow: 4px 4px 0px #000;
    cursor: pointer; transition: 0.1s; color: #000;
}
.pdf-btn-action:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0px #000; }

/* BÁO LỖI */
.pdf-error-box {
    margin-top: 20px; background: #ffadad; color: #900000; border: 3px solid #000;
    padding: 15px; border-radius: 8px; font-weight: 900; font-size: 1.05rem;
    box-shadow: 4px 4px 0px #000; text-align: center;
}

/* THANH CÔNG CỤ */
.pdf-toolbar {
    border: 3px solid #000; border-radius: 12px; padding: 15px;
    box-shadow: 4px 4px 0px #000; margin-bottom: 15px;
    display: flex; flex-direction: column; gap: 12px;
}
.tool-group, .prop-group {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
}
.prop-group { border-top: 2px dashed #000; padding-top: 12px; }

.tool-btn {
    padding: 10px 14px; font-size: 0.95rem; font-weight: 900;
    background: #fff; color: #000; border: 2px solid #000; border-radius: 8px;
    box-shadow: 2px 2px 0px #000; cursor: pointer; transition: 0.1s;
}
.tool-btn:hover { background: #f0f0f0; }
.tool-btn.active {
    background: #111 !important; color: #fff !important;
    transform: translate(2px, 2px); box-shadow: 1px 1px 0px #555;
}

.prop-item { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 0.95rem; }
.color-picker-neo {
    width: 42px; height: 38px; border: 2px solid #000; border-radius: 6px;
    padding: 2px; background: #fff; cursor: pointer;
}
.size-select-neo {
    padding: 8px 10px; font-weight: 900; font-size: 0.95rem;
    border: 2px solid #000; border-radius: 6px; background: #fff; cursor: pointer;
}

/* THANH ĐIỀU HƯỚNG TRANG */
.pdf-nav-bar {
    border: 3px solid #000; border-radius: 10px; padding: 10px 15px;
    box-shadow: 4px 4px 0px #000; margin-bottom: 12px;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
}
.nav-controls { display: flex; align-items: center; gap: 12px; }
.nav-btn {
    padding: 8px 14px; font-weight: 900; font-size: 0.9rem;
    background: #fff; border: 2px solid #000; border-radius: 6px;
    box-shadow: 2px 2px 0px #000; cursor: pointer;
}
.nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.page-indicator { font-size: 1.05rem; font-weight: 800; }

.tool-hint-bar {
    background: #fdfd96; border: 2px solid #000; border-radius: 8px;
    padding: 10px 15px; font-size: 0.95rem; font-weight: 700; margin-bottom: 15px; text-align: center;
}

/* KHUNG STAGE HIỂN THỊ PDF */
.pdf-stage-wrapper {
    width: 100%; overflow-x: auto; background: #333;
    border: 4px solid #000; border-radius: 12px; padding: 20px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6); text-align: center;
}
.pdf-stage {
    position: relative; display: inline-block; background: #fff;
    box-shadow: 6px 6px 0px #000; border: 2px solid #000;
    user-select: none; text-align: left;
}
#pdfRenderCanvas { display: block; }
#pdfDrawCanvas {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2; pointer-events: none;
}
.pdf-object-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 3; overflow: hidden;
}

/* CÁC ĐỐI TƯỢNG NỔI TRÊN PDF (TEXT, STAMP, SIGNATURE) */
.pdf-floating-item {
    position: absolute; border: 2px dashed transparent;
    padding: 2px 4px; cursor: move; display: inline-block;
    transition: border-color 0.1s;
}
.pdf-floating-item:hover, .pdf-floating-item.selected {
    border-color: #1982c4; background: rgba(25, 130, 196, 0.06);
}
.pdf-floating-text {
    min-width: 30px; min-height: 20px; outline: none;
    white-space: pre-wrap; word-break: break-word; line-height: 1.25;
    font-family: Arial, Helvetica, sans-serif; font-weight: 700;
    cursor: text;
}
.pdf-floating-sig {
    display: block; max-width: 180px; height: auto; pointer-events: none;
}
.btn-del-item {
    position: absolute; top: -12px; right: -12px;
    width: 22px; height: 22px; border-radius: 50%;
    background: #d00000; color: #fff; border: 2px solid #000;
    font-size: 12px; font-weight: 900; line-height: 16px; text-align: center;
    cursor: pointer; display: none; z-index: 10;
}
.pdf-floating-item:hover .btn-del-item,
.pdf-floating-item.selected .btn-del-item {
    display: block;
}

/* NÚT XUẤT FILE */
.pdf-btn-export {
    width: 100%; padding: 18px; font-size: 1.4rem; font-weight: 900; text-transform: uppercase; margin-top: 25px;
    background: #111; color: #fff; border: 3px solid #000; border-radius: 12px;
    box-shadow: 6px 6px 0px #555; cursor: pointer; transition: 0.1s; letter-spacing: 1px;
}
.pdf-btn-export:hover { background: #222; }
.pdf-btn-export:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0px #555; }

/* MODAL CHỮ KÝ */
.pdf-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); z-index: 9999;
    display: flex; align-items: center; justify-content: center; padding: 15px;
}
.pdf-modal-box {
    border: 4px solid #000; border-radius: 16px; padding: 25px;
    max-width: 520px; width: 100%; box-shadow: 8px 8px 0px #000; text-align: center;
}
.pdf-modal-box h3 { margin: 0 0 8px 0; font-size: 1.4rem; font-weight: 900; }
.pdf-modal-box p { margin: 0 0 15px 0; font-weight: 700; font-size: 0.95rem; }
.sig-pad-canvas {
    width: 100%; height: 200px; background: #fff;
    border: 3px solid #000; border-radius: 10px; cursor: crosshair; touch-action: none;
}
.modal-actions {
    display: flex; justify-content: space-between; margin-top: 15px; gap: 10px;
}

@media (max-width: 650px) {
    .pdf-neo-wrapper { padding: 15px; }
    .pdf-btn-export { font-size: 1.15rem; }
}