/* ─── CF7 E-Signature ──────────────────────────────────── */

.cf7-esig-wrap {
    --esig-bg: #f0ede8;
    --esig-surface: #fff;
    --esig-border: #d4d0ca;
    --esig-tab-active-bg: #e8e5df;
    --esig-tab-text: #4a4660;
    --esig-tab-active-text: #2c2849;
    --esig-ink: #1a2456;
    --esig-clear: #6b8a5e;
    --esig-placeholder: #a09caf;
    --esig-radius: 6px;
    --esig-font-size: 14px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: var(--esig-font-size);
    background: var(--esig-bg);
    border: 1px solid var(--esig-border);
    border-radius: var(--esig-radius);
    overflow: hidden;
    max-width: 560px;
    width: 100%;
    box-sizing: border-box;
}

.cf7-esig-wrap *,
.cf7-esig-wrap *::before,
.cf7-esig-wrap *::after {
    box-sizing: border-box;
}

/* ─── Tabs ─────────────────────────────────────────────── */

.cf7-esig-tabs {
    display: flex;
    background: var(--esig-tab-active-bg);
    border-bottom: 1px solid var(--esig-border);
}

.cf7-esig-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--esig-tab-text);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    position: relative;
    text-transform: capitalize;
}

.cf7-esig-tab:hover {
    color: var(--esig-tab-active-text);
}

.cf7-esig-tab--active {
    background: var(--esig-surface);
    color: var(--esig-tab-active-text);
}

.cf7-esig-tab--active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--esig-tab-active-text);
}

/* ─── Panels ───────────────────────────────────────────── */

.cf7-esig-panel {
    background: var(--esig-surface);
    min-height: 180px;
    position: relative;
}

/* ─── Canvas (Draw mode) ───────────────────────────────── */

.cf7-esig-canvas {
    display: block;
    width: 100%;
    height: 200px;
    cursor: crosshair;
    touch-action: none;
}

/* ─── Type mode ────────────────────────────────────────── */

.cf7-esig-type-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
}

.cf7-esig-type-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--esig-border);
    background: transparent;
    font-family: 'Dancing Script', cursive;
    font-size: 36px;
    color: var(--esig-ink);
    text-align: center;
    padding: 8px 4px;
    outline: none;
    transition: border-color 0.2s;
}

.cf7-esig-type-input:focus {
    border-bottom-color: var(--esig-tab-active-text);
}

.cf7-esig-type-input::placeholder {
    color: var(--esig-placeholder);
    font-size: 22px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ─── Font selector ────────────────────────────────────── */

.cf7-esig-font-selector {
    position: relative;
    text-align: right;
    padding: 0 16px 8px;
}

.cf7-esig-font-toggle {
    background: none;
    border: none;
    color: var(--esig-tab-text);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    padding: 6px 10px;
    transition: color 0.15s;
}

.cf7-esig-font-toggle:hover {
    color: var(--esig-tab-active-text);
}

.cf7-esig-font-arrow {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 11px;
    margin-left: 2px;
}

.cf7-esig-font-selector.cf7-esig-font-selector--open .cf7-esig-font-arrow {
    transform: rotate(180deg);
}

.cf7-esig-font-dropdown {
    position: absolute;
    right: 12px;
    bottom: 100%;
    background: var(--esig-surface);
    border: 1px solid var(--esig-border);
    border-radius: var(--esig-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    list-style: none;
    margin: 0 0 4px;
    padding: 6px 0;
    min-width: 180px;
    z-index: 20;
}

.cf7-esig-font-dropdown li {
    margin: 0;
    padding: 0;
}

.cf7-esig-font-option {
    display: block;
    width: 100%;
    padding: 10px 18px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--esig-ink);
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}

.cf7-esig-font-option:hover {
    background: var(--esig-tab-active-bg);
}

.cf7-esig-font-option--active {
    background: var(--esig-tab-active-bg);
}

/* ─── Toolbar (colours + clear) ────────────────────────── */

.cf7-esig-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--esig-border);
    background: var(--esig-bg);
}

.cf7-esig-colors {
    display: flex;
    gap: 8px;
}

.cf7-esig-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    padding: 0;
    outline: none;
}

.cf7-esig-color:hover {
    transform: scale(1.1);
}

.cf7-esig-color--active {
    border-color: var(--esig-surface);
    box-shadow: 0 0 0 2px var(--esig-tab-active-text);
}

.cf7-esig-clear {
    background: none;
    border: none;
    color: var(--esig-clear);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    padding: 6px 10px;
    transition: opacity 0.15s;
}

.cf7-esig-clear:hover {
    opacity: 0.7;
}

/* ─── Validation error ─────────────────────────────────── */

.cf7-esig-wrap .wpcf7-not-valid-tip {
    padding: 6px 16px;
    font-size: 13px;
}

/* ─── Responsive ───────────────────────────────────────── */

@media (max-width: 600px) {
    .cf7-esig-wrap {
        max-width: 100%;
    }

    .cf7-esig-type-input {
        font-size: 28px;
    }

    .cf7-esig-canvas {
        height: 160px;
    }
}
