/* ===========================
   Processing Engine Toggle — Gemini (Profile 2)
   =========================== */

/* Section spacing */
#engine-toggle-section {
    margin-bottom: 4px;
    position: relative;
    z-index: 100;
}

#engine-toggle-section .saa-profile-label {
    margin-bottom: 6px;
}

/* Toggle group — pill-shaped segmented control with three engines
   (Gemini / Claude / Custom). Keep in sync with the button count in
   the template. */
.engine-toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    overflow: visible;
    margin-top: 6px;
}

/* Individual toggle buttons */
.engine-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-family: inherit;
    line-height: 1;
}

.engine-toggle-btn:hover {
    color: #ffffff;
    background: rgba(30, 41, 59, 0.4);
}

.engine-toggle-btn.active {
    color: #e2e8f0;
    background: rgba(30, 41, 59, 0.8);
}

/* Standard active — blue accent */
.engine-toggle-btn[data-engine="standard"].active {
    box-shadow: inset 0 -2px 0 #3b82f6;
}

/* Gemini active — orange accent with glow */
.engine-toggle-btn[data-engine="gemini"].active {
    box-shadow: inset 0 -2px 0 #f97316, 0 0 12px rgba(249, 115, 22, 0.15);
    color: #fed7aa;
}

/* Custom active — cyan accent, matches the Save button in the profile form */
.engine-toggle-btn[data-engine="custom"].active {
    box-shadow: inset 0 -2px 0 #22d3ee, 0 0 12px rgba(34, 211, 238, 0.18);
    color: #a5f3fc;
}

/* Custom disabled / locked (signed-out state) */
.engine-toggle-btn[data-engine="custom"]:disabled,
.engine-toggle-btn[data-engine="custom"].engine-toggle-btn-locked {
    opacity: 0.75;
    cursor: not-allowed;
    color: #cbd5e1;
}
.engine-toggle-btn[data-engine="custom"]:disabled:hover,
.engine-toggle-btn[data-engine="custom"].engine-toggle-btn-locked:hover {
    background: transparent;
    color: #cbd5e1;
}

/* Custom icon — star, no pulse animation */
.engine-toggle-btn[data-engine="custom"] .engine-toggle-icon {
    font-size: 10px;
    color: #22d3ee;
}
.engine-toggle-btn[data-engine="custom"]:disabled .engine-toggle-icon,
.engine-toggle-btn[data-engine="custom"].engine-toggle-btn-locked .engine-toggle-icon {
    color: rgba(148, 163, 184, 0.4);
}

/* Version tag (v8) */
.engine-toggle-version {
    font-size: 9px;
    opacity: 0.5;
    font-weight: 400;
}

/* Lightning icon */
.engine-toggle-icon {
    font-size: 11px;
}

/* Gemini active icon pulse */
.engine-toggle-btn[data-engine="gemini"].active .engine-toggle-icon {
    animation: gemini-pulse 2s ease-in-out infinite;
}

@keyframes gemini-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===========================
   Engine Toggle Tooltips — positioned BELOW the toggle
   =========================== */

.engine-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

/* Arrow pointing UP toward the toggle */
.engine-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(15, 23, 42, 0.98);
}

.engine-toggle-btn:hover .engine-tooltip {
    display: block;
}

/* Keep tooltips on screen for left/right buttons */
.engine-toggle-btn:first-child .engine-tooltip {
    left: 0;
    transform: translateX(0);
}
.engine-toggle-btn:first-child .engine-tooltip::after {
    left: 40px;
}
.engine-toggle-btn:last-child .engine-tooltip {
    right: 0;
    left: auto;
    transform: translateX(0);
}
.engine-toggle-btn:last-child .engine-tooltip::after {
    left: auto;
    right: 40px;
}

/* Pill shape via border-radius on buttons */
.engine-toggle-btn:first-child {
    border-radius: 8px 0 0 8px;
}
.engine-toggle-btn:last-child {
    border-radius: 0 8px 8px 0;
}
