/* Official protocol form (templates/protocol/_fields.html) */

.pf-section {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1rem 1.1rem;
    margin-bottom: 1rem;
}

.pf-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.85rem;
}

.pf-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.pf-hint {
    font-size: 0.82rem;
    color: var(--secondary-color);
    margin: -0.4rem 0 0.6rem;
}

.pf .form-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.pf .form-control {
    padding: 0.6rem 0.8rem;
}

.pf-counter {
    font-size: 0.78rem;
    color: var(--secondary-color);
    text-align: right;
    min-height: 1.1rem;
    margin-top: 0.2rem;
}

.pf-counter.over {
    color: #b45309;
}

/* the fine sentence, filled in place like on paper */
.pf-sentence {
    line-height: 2.9;
    font-size: 0.95rem;
}

.pf .pf-inline {
    display: inline-block;
    width: 5.5rem;
    padding: 0.3rem 0.5rem;
    margin: 0 0.15rem;
    text-align: center;
    vertical-align: middle;
}

.pf .pf-inline-sm { width: 4rem; }
.pf .pf-inline-lg { width: 11rem; }

/* inspectors */
.pf-inspector {
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    padding: 0.7rem;
    margin-bottom: 0.6rem;
    background: #f8fafc;
}

.pf-inspector-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.pf-inspector-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent-hover);
}

.pf-inspector-remove {
    padding: 0 0.25rem;
    text-decoration: none;
}

/* signature boxes */
.pf-sig-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.6rem;
}

.pf-sig-caption {
    font-size: 0.85rem;
    color: var(--secondary-color);
    min-width: 7.5rem;
    line-height: 1.2;
}

.pf-sig {
    position: relative;
    flex: 1;
    max-width: 280px;
}

.pf-sig-area {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 64px;
    border: 2px dashed #94a3b8;
    border-radius: 10px;
    background: #fff;
    color: var(--secondary-color);
    font-size: 0.85rem;
    padding: 4px;
}

.pf-sig-area:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.pf-sig-img {
    display: none;
    max-width: 100%;
    max-height: 100%;
}

.pf-sig.has-sig .pf-sig-img { display: block; }
.pf-sig.has-sig .pf-sig-empty { display: none; }
.pf-sig.has-sig .pf-sig-area { border-style: solid; border-color: #10b981; }

.pf-sig-clear {
    display: none;
    position: absolute;
    top: -8px;
    right: -8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: #f87171;
    color: #fff;
    font-size: 0.75rem;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.pf-sig.has-sig .pf-sig-clear { display: flex; }

/* full-screen signing overlay */
.pf-signpad {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.pf-signpad[hidden] { display: none; }

.pf-signpad-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    padding: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.pf-signpad-head {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.6rem;
}

.pf-signpad-canvas-wrap {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.pf-signpad canvas {
    display: block;
    touch-action: none;
    cursor: crosshair;
    position: relative;
    z-index: 1;
}

.pf-signpad-line {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 28%;
    border-bottom: 1px dashed #cbd5e1;
}

.pf-signpad-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}

.pf-signpad-actions .btn-primary { min-width: 120px; }

body.pf-signing { overflow: hidden; }

/* launcher on the "new request" form */
.pf-launch {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    text-align: left;
    padding: 0.9rem 1rem;
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.06), rgba(8, 145, 178, 0.12));
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.pf-launch:hover {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.12), rgba(8, 145, 178, 0.2));
}

.pf-launch-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--accent-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.pf-launch-text strong { display: block; font-size: 1.05rem; }
.pf-launch-text small { color: var(--secondary-color); }

.pf-summary {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1rem;
    border: 2px solid #10b981;
    border-radius: 12px;
    background: #ecfdf5;
}

.pf-summary .pf-launch-icon { background: #10b981; }

.pf-summary-text { flex: 1; min-width: 0; }
.pf-summary-text strong { display: block; }
.pf-summary-text small { color: var(--secondary-color); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* modal with the form */
#protocolModal .modal-body { background: var(--bg-light); }
#protocolModal .modal-footer {
    background: #fff;
    gap: 0.5rem;
}

/* standalone edit page: sticky action bar */
.pf-actionbar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: rgba(241, 245, 249, 0.95);
    backdrop-filter: blur(6px);
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* protocol card on the request page */
.protocol-card .card-header {
    background: linear-gradient(135deg, #ecfeff, #f8fafc);
}

.protocol-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.protocol-fact {
    background: #f8fafc;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
}

.protocol-fact span {
    display: block;
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.protocol-fact strong {
    word-break: break-word;
}

.protocol-actions .btn { display: inline-flex; align-items: center; gap: 0.35rem; }

@media (max-width: 576px) {
    .pf-section { padding: 0.85rem; }
    .pf-sig-row { flex-direction: column; align-items: stretch; gap: 0.3rem; }
    .pf-sig { max-width: none; }
    .pf-sig-caption { min-width: 0; }
    .protocol-actions .btn { flex: 1 1 100%; justify-content: center; }
}

/* style.css stretches every .btn in ".d-flex.gap-2" on phones - not here */
.pf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.pf-chips .btn { min-width: 64px; }

.pf-footer-actions {
    display: flex;
    gap: 0.5rem;
}

#protocolModal .modal-footer .btn { white-space: nowrap; }

@media (max-width: 576px) {
    #protocolModal .modal-footer { padding: 0.6rem 0.75rem; }
    #protocolModal .modal-footer .btn { padding: 0.55rem 0.8rem; }
    .pf-launch-text small { display: block; line-height: 1.3; }
}

.pf-summary .btn { padding: 0.35rem 0.55rem; }
.pf-summary-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
