/* ==========================================================================
   Iris AI Assistant — Siri-Style Overlay & Animation
   ========================================================================== */

/* ── Full-Screen Overlay ── */
.iris-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 95000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(60px) saturate(150%);
    -webkit-backdrop-filter: blur(60px) saturate(150%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.iris-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ── Animated Orb (Siri Style) ── */
.iris-orb-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 30px;
    flex-shrink: 0;
    cursor: pointer;
}

.iris-orb {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%,
        rgba(147, 112, 219, 0.8),
        rgba(75, 0, 130, 0.6) 40%,
        rgba(30, 144, 255, 0.5) 60%,
        rgba(255, 105, 180, 0.4) 80%,
        rgba(0, 191, 255, 0.3)
    );
    box-shadow:
        0 0 60px rgba(138, 43, 226, 0.4),
        0 0 120px rgba(75, 0, 130, 0.2),
        inset 0 0 40px rgba(255, 255, 255, 0.1);
    animation: irisOrbFloat 4s ease-in-out infinite, irisOrbGradient 8s ease infinite;
    transition: transform 0.3s ease;
}

/* Orb states */
.iris-orb.listening {
    animation: irisOrbFloat 2s ease-in-out infinite, irisOrbPulse 1.5s ease-in-out infinite, irisOrbGradient 4s ease infinite;
    box-shadow:
        0 0 80px rgba(138, 43, 226, 0.5),
        0 0 160px rgba(75, 0, 130, 0.3),
        inset 0 0 50px rgba(255, 255, 255, 0.15);
}

.iris-orb.thinking {
    animation: irisOrbFloat 1.5s ease-in-out infinite, irisOrbSpin 2s linear infinite, irisOrbGradient 3s ease infinite;
    box-shadow:
        0 0 100px rgba(0, 191, 255, 0.5),
        0 0 200px rgba(138, 43, 226, 0.3),
        inset 0 0 60px rgba(255, 255, 255, 0.2);
}

/* Reacts to Iris voice output */
.iris-orb.speaking {
    animation: irisOrbFloat 1.2s ease-in-out infinite, irisOrbSpeakingPulse 0.9s ease-in-out infinite, irisOrbGradient 2.2s ease infinite;
    box-shadow:
        0 0 90px rgba(0, 191, 255, 0.7),
        0 0 170px rgba(138, 43, 226, 0.55),
        0 0 240px rgba(255, 105, 180, 0.4),
        inset 0 0 55px rgba(255, 255, 255, 0.35);
}

@keyframes irisOrbSpeakingPulse {
    0%, 100% { transform: scale(1.02) translateY(0); filter: saturate(150%) brightness(1.1); }
    50% { transform: scale(1.14) translateY(-5px); filter: saturate(200%) brightness(1.3); }
}

/* Glow ring around orb */
.iris-orb::after {
    content: '';
    position: absolute;
    top: -8px; left: -8px;
    right: -8px; bottom: -8px;
    border-radius: 50%;
    border: 2px solid rgba(138, 43, 226, 0.2);
    animation: irisRingPulse 3s ease-in-out infinite;
}

.iris-orb.speaking::after {
    border-color: rgba(0, 191, 255, 0.5);
    animation: irisRingPulse 1.2s ease-in-out infinite;
}

@keyframes irisOrbFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes irisOrbPulse {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.05) translateY(-5px); }
}

@keyframes irisOrbSpin {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes irisOrbGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes irisRingPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

/* ── Waveform Bars (under orb, listening & speaking states) ── */
.iris-waveform {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 32px;
    margin-top: -15px;
    margin-bottom: 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.iris-waveform.active,
.iris-waveform.speaking {
    opacity: 1;
}

.iris-waveform-bar {
    width: 3.5px;
    background: linear-gradient(to top, #8a2be2, #00bfff);
    border-radius: 3px;
    animation: waveformBounce 0.8s ease-in-out infinite;
    transition: height 0.08s ease;
}

.iris-waveform.speaking .iris-waveform-bar {
    background: linear-gradient(to top, #ff69b4, #00bfff, #8a2be2);
    animation-duration: 0.45s;
}

.iris-waveform-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.iris-waveform-bar:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.iris-waveform-bar:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.iris-waveform-bar:nth-child(4) { height: 18px; animation-delay: 0.3s; }
.iris-waveform-bar:nth-child(5) { height: 28px; animation-delay: 0.15s; }
.iris-waveform-bar:nth-child(6) { height: 12px; animation-delay: 0.25s; }
.iris-waveform-bar:nth-child(7) { height: 20px; animation-delay: 0.05s; }

@keyframes waveformBounce {
    0%, 100% { transform: scaleY(0.35); }
    50% { transform: scaleY(1.15); }
}

/* ── Live Speech Transcript Bubble ── */
.iris-live-transcript {
    width: 100%;
    max-width: 580px;
    padding: 9px 16px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    margin-bottom: 12px;
    display: none;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: irisTranscriptIn 0.2s ease-out;
}

.iris-live-transcript.active {
    display: flex;
}

@keyframes irisTranscriptIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Ambient "Hey Iris" Status Pill ── */
.iris-wake-status {
    position: absolute;
    top: 20px;
    left: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.7);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.iris-wake-status:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.iris-wake-status.listening {
    background: rgba(0, 122, 255, 0.25);
    border-color: #007aff;
    color: #fff;
    box-shadow: 0 0 12px rgba(0, 122, 255, 0.4);
}

/* ── Iris Label ── */
.iris-label {
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

/* ── Conversation Area ── */
.iris-conversation {
    flex: 1;
    width: 100%;
    max-width: 600px;
    overflow-y: auto;
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.iris-message {
    max-width: 90%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    animation: irisMessageSlideIn 0.3s ease;
}

@keyframes irisMessageSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.iris-message.user {
    align-self: flex-end;
    background: #007aff;
    color: #fff;
    border-bottom-right-radius: 6px;
}

.iris-message.iris {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.iris-message.iris strong {
    color: #fff;
}

.iris-message.iris a {
    color: #64b5f6;
    text-decoration: underline;
}

/* Typing indicator */
.iris-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 18px;
    align-self: flex-start;
}

.iris-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    animation: irisTypingBounce 1.2s ease-in-out infinite;
}

.iris-typing-dot:nth-child(1) { animation-delay: 0s; }
.iris-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.iris-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes irisTypingBounce {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-4px); }
}

/* ── Input Area ── */
.iris-input-area {
    width: 100%;
    max-width: 600px;
    padding: 16px 20px 24px;
    flex-shrink: 0;
}

.iris-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 4px 6px 4px 18px;
    transition: border-color 0.2s;
}

.iris-input-wrapper:focus-within {
    border-color: rgba(138, 43, 226, 0.5);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.15);
}

.iris-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    font-family: var(--font-ui);
    outline: none;
    padding: 10px 0;
}

.iris-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.iris-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8a2be2, #007aff);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, opacity 0.15s;
    flex-shrink: 0;
}

.iris-send-btn:hover {
    transform: scale(1.08);
}

.iris-send-btn:active {
    transform: scale(0.95);
}

.iris-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Close Button ── */
.iris-close-btn {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ccc;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.iris-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ── Suggested Prompts ── */
.iris-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 600px;
    padding: 0 20px;
    margin-bottom: 16px;
}

.iris-suggestion {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: var(--font-ui);
}

.iris-suggestion:hover {
    background: rgba(138, 43, 226, 0.2);
    border-color: rgba(138, 43, 226, 0.4);
    color: #fff;
}

/* ── Microphone Button ── */
.iris-mic-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #eee;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.iris-mic-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: scale(1.05);
}

.iris-mic-btn.listening {
    background: #ff3b30;
    border-color: #ff3b30;
    color: #fff;
    animation: siriMicPulse 1.2s infinite;
}

@keyframes siriMicPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); }
}

/* ── Apple Intelligence Screen Border Glow ── */
.iris-siri-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 94990;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.iris-siri-glow.active {
    opacity: 1;
    box-shadow: inset 0 0 45px 12px rgba(0, 191, 255, 0.5),
                inset 0 0 110px 35px rgba(138, 43, 226, 0.4),
                inset 0 0 180px 60px rgba(255, 105, 180, 0.3);
    animation: siriEdgePulse 2.5s ease-in-out infinite alternate;
}

@keyframes siriEdgePulse {
    0% {
        box-shadow: inset 0 0 35px 8px rgba(0, 191, 255, 0.4),
                    inset 0 0 80px 25px rgba(138, 43, 226, 0.3),
                    inset 0 0 140px 45px rgba(255, 105, 180, 0.2);
    }
    100% {
        box-shadow: inset 0 0 60px 18px rgba(0, 191, 255, 0.65),
                    inset 0 0 130px 45px rgba(138, 43, 226, 0.5),
                    inset 0 0 200px 70px rgba(255, 105, 180, 0.38);
    }
}

/* ── Action Card in Siri Responses ── */
.iris-action-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: transform 0.2s ease, background 0.2s ease;
}

.iris-action-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.iris-action-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #007aff, #5856d6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

.iris-action-info {
    flex: 1;
    min-width: 0;
}

.iris-action-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.iris-action-subtitle {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.iris-action-btn {
    padding: 5px 12px;
    border-radius: 999px;
    border: none;
    background: #007aff;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.iris-action-btn:hover {
    opacity: 0.9;
}

/* ── Dock Icon Gradient ── */
.dock-icon-bg.bg-iris {
    background: linear-gradient(135deg, #8a2be2 0%, #ff69b4 35%, #00bfff 65%, #8a2be2 100%);
    background-size: 300% 300%;
    animation: irisDockGlow 4s ease infinite;
}

@keyframes irisDockGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .iris-orb-container {
        width: 120px;
        height: 120px;
    }

    .iris-conversation {
        max-width: 100%;
    }

    .iris-input-area {
        max-width: 100%;
    }

    .iris-suggestions {
        max-width: 100%;
    }
}

/* ── Cited answers ─────────────────────────────────────────────────────── */
.iris-sources {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 0.5px solid rgba(255, 255, 255, 0.1);
}
.iris-sources-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin-right: 2px;
}
.iris-source {
    font: inherit;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.08);
    border: 0.5px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 3px 9px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.iris-source:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.iris-source:disabled { cursor: default; opacity: 0.6; }
.iris-source:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.iris-wake-status { font: inherit; color: inherit; cursor: pointer; }

/* Focus belongs to the rounded pill, not a square ring inside it. */
.iris-input:focus-visible { outline: none; }
.iris-input-wrapper:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent), 0 10px 30px rgba(0, 0, 0, 0.35); }
