/* ============================================
   APX Modern Success Alert
   ============================================ */

.apx-modern-ui .apx-alert,
.ap_alert_show .apx-alert {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    margin-bottom: 0;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    box-shadow:
        0 4px 16px rgba(16, 185, 129, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    color: #065f46;
    font-size: 0.95rem;
    overflow: hidden;
}

/* Subtle glossy top highlight */
.apx-modern-ui .apx-alert::before,
.ap_alert_show .apx-alert::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
}

/* Left accent bar */
.apx-modern-ui .apx-alert::after,
.ap_alert_show .apx-alert::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, #34d399, #10b981);
    border-radius: 14px 0 0 14px;
}

/* Content + icon */
.apx-alert-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.apx-alert-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(180deg, #34d399, #10b981);
    color: #fff;
    box-shadow:
        0 3px 8px rgba(16, 185, 129, 0.35),
        inset 0 1px 0 rgba(255,255,255,0.35);
    flex-shrink: 0;
}

.apx-alert-icon svg {
    width: 16px;
    height: 16px;
}

.apx-alert strong {
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Close button */
.apx-alert-close {
    position: static !important;
    padding: 0 !important;
    margin: 0 0 0 16px !important;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(6, 95, 70, 0.08);
    border: none;
    color: #065f46;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.7;
    transition: all 0.2s ease;
    cursor: pointer;
}

.apx-alert-close:hover {
    opacity: 1;
    background: rgba(6, 95, 70, 0.15);
    transform: scale(1.08);
}

.apx-alert-close:active {
    transform: scale(0.95);
}

.apx-alert-close span {
    font-weight: 300;
}

/* Fade animation polish */
.apx-alert.fade {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.apx-alert.fade:not(.show) {
    opacity: 0;
    transform: translateY(-8px);
}

/* Optional: make the whole alert slightly more compact on mobile */
@media (max-width: 575px) {
    .apx-modern-ui .apx-alert,
    .ap_alert_show .apx-alert {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .apx-alert-icon {
        width: 28px;
        height: 28px;
    }
}
/* ============================================
   APX Modern UI – Unique wrapper
   ============================================ */
.apx-modern-ui {
    --apx-primary: #3b82f6;
    --apx-primary-dark: #2563eb;
    --apx-danger: #ef4444;
    --apx-danger-dark: #dc2626;
    --apx-success: #10b981;
    --apx-bg: #f8fafc;
    --apx-card: #ffffff;
    --apx-border: #e2e8f0;
    --apx-text: #1e293b;
    --apx-muted: #64748b;
    --apx-radius: 14px;
    --apx-shadow: 0 4px 14px rgba(0,0,0,0.06);
    --apx-transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.apx-modern-ui .apx-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--apx-border);
}

.apx-modern-ui .apx-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Labels */
.apx-modern-ui .apx-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--apx-text);
    line-height: 1.4;
}

.apx-modern-ui .apx-label small {
    display: block;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--apx-muted);
    margin-top: 3px;
}

/* ============================================
   Bubble / Pill Toggle Group
   ============================================ */
.apx-modern-ui .apx-bubble-group {
    display: inline-flex;
    background: #e2e8f0;
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

.apx-modern-ui .apx-bubble {
    position: relative;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.apx-modern-ui .apx-bubble input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.apx-modern-ui .apx-bubble-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    height: 38px;
    padding: 0 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--apx-muted);
    border-radius: 999px;
    transition: var(--apx-transition);
    white-space: nowrap;
}

/* Active / Checked state – glossy bubble */
.apx-modern-ui .apx-bubble input:checked + .apx-bubble-text {
    background: linear-gradient(180deg, #60a5fa 0%, var(--apx-primary) 55%, var(--apx-primary-dark) 100%);
    color: #fff;
    box-shadow:
        0 4px 12px rgba(59, 130, 246, 0.35),
        inset 0 1px 0 rgba(255,255,255,0.35),
        inset 0 -1px 0 rgba(0,0,0,0.08);
    transform: scale(1.03);
}

/* Hover (non-active) */
.apx-modern-ui .apx-bubble:not(:has(input:checked)):hover .apx-bubble-text {
    background: rgba(255,255,255,0.7);
    color: var(--apx-text);
}

/* Pressed feedback */
.apx-modern-ui .apx-bubble:active .apx-bubble-text {
    transform: scale(0.97);
}

/* ============================================
   Modern Selects & Inputs
   ============================================ */
.apx-modern-ui .apx-select,
.apx-modern-ui .apx-input {
    width: 100%;
    max-width: 420px;
    min-height: 42px;
    padding: 8px 14px;
    font-size: 0.9rem;
    color: var(--apx-text);
    background: var(--apx-card);
    border: 1.5px solid var(--apx-border);
    border-radius: 10px;
    box-shadow: var(--apx-shadow);
    transition: var(--apx-transition);
    outline: none;
}

.apx-modern-ui .apx-select:focus,
.apx-modern-ui .apx-input:focus {
    border-color: var(--apx-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.apx-modern-ui select[multiple].apx-select {
    min-height: 110px;
    padding: 8px;
}

/* Colored dual selects */
.apx-modern-ui .apx-select-include {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    border-color: #0284c7;
}

.apx-modern-ui .apx-select-exclude {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff;
    border-color: #dc2626;
}

.apx-modern-ui .apx-select-include option,
.apx-modern-ui .apx-select-exclude option {
    background: #fff;
    color: #1e293b;
}

/* Dual select layout */
.apx-modern-ui .apx-dual-select {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.apx-modern-ui .apx-dual-select .apx-select {
    flex: 1 1 180px;
    max-width: none;
}

/* ============================================
   Buttons (DOM Default / Custom)
   ============================================ */
.apx-modern-ui .apx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    height: 38px;
    padding: 0 18px;
    margin-right: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--apx-transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.apx-modern-ui .apx-btn-primary {
    background: linear-gradient(180deg, #60a5fa 0%, var(--apx-primary) 60%, var(--apx-primary-dark) 100%);
    color: #fff;
    box-shadow:
        0 4px 12px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.3);
}

.apx-modern-ui .apx-btn-danger {
    background: linear-gradient(180deg, #f87171 0%, var(--apx-danger) 60%, var(--apx-danger-dark) 100%);
    color: #fff;
    box-shadow:
        0 4px 12px rgba(239, 68, 68, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.25);
}

.apx-modern-ui .apx-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.apx-modern-ui .apx-btn:active {
    transform: scale(0.97);
}

/* Reset link */
.apx-modern-ui .apx-reset-link {
    display: inline-block;
    margin-left: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--apx-primary);
    text-decoration: none;
    transition: var(--apx-transition);
}

.apx-modern-ui .apx-reset-link:hover {
    color: var(--apx-primary-dark);
    text-decoration: underline;
}

/* Caption & Notes */
.apx-modern-ui .apx-caption,
.apx-modern-ui .apx-note {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--apx-muted);
    line-height: 1.45;
}

/* Fieldset cleanup */
.apx-modern-ui .apx-fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

/* ============================================
   Tablet & Touch Improvements
   ============================================ */
@media (max-width: 991px) {
    .apx-modern-ui .apx-bubble-text {
        min-width: 100px;
        height: 44px;          /* larger touch target */
        font-size: 0.95rem;
    }

    .apx-modern-ui .apx-btn {
        min-width: 110px;
        height: 44px;
    }

    .apx-modern-ui .apx-select,
    .apx-modern-ui .apx-input {
        min-height: 46px;
        font-size: 1rem;
    }
}

/* Hide original Bootstrap btn styles inside the modern UI (safety) */
.apx-modern-ui .btn-group {
    display: none !important;
}