.apl-msg-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: var(--sans);
}

.apl-msg-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.apl-msg-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--charcoal);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    transition: transform 0.2s ease, background 0.2s ease;
    position: absolute;
    bottom: 0;
    right: 0;
}

.apl-msg-bubble:hover {
    transform: scale(1.06);
    background: var(--soft-black);
}

.apl-msg-icon-close {
    display: none;
}

.apl-msg-widget.is-open .apl-msg-icon-chat {
    display: none;
}

.apl-msg-widget.is-open .apl-msg-icon-close {
    display: block;
}

.apl-msg-panel {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 340px;
    background: var(--warm-white);
    border-radius: 12px;
    border: 1px solid var(--sand);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.apl-msg-widget.is-open .apl-msg-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.apl-msg-panel-header {
    background: var(--charcoal);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.apl-msg-panel-title {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 400;
    color: var(--warm-white);
    margin: 0;
    line-height: 1.3;
}

.apl-msg-panel-subtitle {
    font-size: 12px;
    color: var(--taupe);
    margin: 4px 0 0;
    line-height: 1.4;
}

.apl-msg-panel-close {
    background: none;
    border: none;
    color: var(--taupe);
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.apl-msg-panel-close:hover {
    color: var(--warm-white);
}

.apl-msg-panel-body {
    padding: 20px;
}

.apl-msg-field {
    margin-bottom: 14px;
}

.apl-msg-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--warm-gray);
    letter-spacing: 0.3px;
    margin-bottom: 5px;
}

.apl-msg-field input,
.apl-msg-field textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: var(--sans);
    color: var(--charcoal);
    background: var(--warm-white);
    border: 1px solid var(--sand);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.apl-msg-field input::placeholder,
.apl-msg-field textarea::placeholder {
    color: var(--taupe);
}

.apl-msg-field input:focus,
.apl-msg-field textarea:focus {
    border-color: var(--accent);
}

.apl-msg-field input.apl-msg-invalid,
.apl-msg-field textarea.apl-msg-invalid {
    border-color: #C44A4A;
}

.apl-msg-field textarea {
    resize: vertical;
    min-height: 80px;
    max-height: 160px;
    line-height: 1.5;
}

.apl-msg-submit {
    width: 100%;
    padding: 13px 20px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--soft-black);
    background: var(--accent);
    border: 1.5px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    margin-top: 4px;
}

.apl-msg-submit:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.apl-msg-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.apl-msg-success,
.apl-msg-error {
    display: none;
}

.apl-msg-success {
    text-align: center;
    padding: 24px 0 8px;
}

.apl-msg-success-icon {
    color: var(--accent);
    margin-bottom: 16px;
}

.apl-msg-success-title {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 400;
    color: var(--charcoal);
    margin: 0 0 8px;
}

.apl-msg-success-text {
    font-size: 14px;
    color: var(--warm-gray);
    margin: 0 0 24px;
    line-height: 1.5;
}

.apl-msg-success-close {
    display: inline-block;
    padding: 10px 32px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--charcoal);
    background: transparent;
    border: 1.5px solid var(--sand);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.apl-msg-success-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.apl-msg-error {
    padding: 12px 0 0;
}

.apl-msg-error p {
    font-size: 13px;
    color: #C44A4A;
    line-height: 1.5;
    margin: 0;
}

.apl-msg-error a {
    color: var(--accent-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.grecaptcha-badge {
    visibility: hidden !important;
}

.apl-msg-recaptcha-notice {
    font-size: 11px;
    color: var(--taupe);
    text-align: center;
    margin: 12px 0 0;
    line-height: 1.4;
}

.apl-msg-recaptcha-notice a {
    color: var(--taupe);
    text-decoration: underline;
    text-underline-offset: 1px;
}

@media (max-width: 480px) {
    .apl-msg-widget {
        bottom: 16px;
        right: 16px;
    }

    .apl-msg-panel {
        width: calc(100vw - 32px);
        right: 0;
        bottom: 68px;
    }

    .apl-msg-bubble {
        width: 50px;
        height: 50px;
    }
}
