/**
 * PDF Editor toolbar.
 *
 * A horizontal action bar at the top of the editor: select / text /
 * highlight / shapes / stamp / signature / pages, plus zoom, undo/redo,
 * find, save, and the "Open in Word editor" fallback.
 *
 * Uses site CSS variables from common.css.
 */

.pdfne-toolbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.pdfne-tb-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 8px;
    border-right: 1px solid var(--border-color);
}
.pdfne-tb-group:last-child {
    border-right: 0;
    padding-right: 0;
    margin-left: auto;
}
.pdfne-tb-group.pdfne-tb-end {
    margin-left: auto;
    border-right: 0;
    padding-right: 0;
}

.pdfne-tb-btn {
    height: 36px;
    min-width: 36px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.pdfne-tb-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}
.pdfne-tb-btn[disabled] {
    opacity: .35;
    cursor: not-allowed;
}
.pdfne-tb-btn[disabled]:hover {
    background: transparent;
    color: var(--text-secondary);
}
.pdfne-tb-btn.active {
    background: rgba(0, 204, 106, .12);
    color: var(--accent-primary);
}
.pdfne-tb-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.pdfne-tb-sep {
    width: 1px;
    background: var(--border-color);
    margin: 4px 4px;
}

.pdfne-tb-select,
.pdfne-tb-input,
.pdfne-tb-color {
    height: 30px;
    padding: 0 6px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: white;
    color: var(--text-primary);
    font-size: 12px;
}
.pdfne-tb-input { width: 60px; }
.pdfne-tb-color {
    width: 36px;
    padding: 0;
    cursor: pointer;
}

/* Tool-specific option panel */
.pdfne-tb-panel {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 12px;
}
.pdfne-tb-panel label {
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Stamp dropdown */
.pdfne-tb-dropdown {
    position: relative;
}
.pdfne-tb-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    padding: 4px;
    min-width: 160px;
    display: none;
    z-index: 60;
}
.pdfne-tb-dropdown.open .pdfne-tb-dropdown-menu {
    display: block;
}
.pdfne-tb-dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-primary);
}
.pdfne-tb-dropdown-menu button:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

@media (max-width: 768px) {
    .pdfne-toolbar {
        gap: 2px;
        padding: 4px 6px;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    .pdfne-tb-group {
        flex-shrink: 0;
    }
    .pdfne-tb-group:last-child {
        margin-left: 0;
    }
    .pdfne-tb-btn span {
        display: none;
    }
}
