/* Portfolio AI Assistant */
.portfolio-assistant {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1200;
    font-family: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #f8fbff;
}

.assistant-toggle {
    width: auto;
    min-width: 168px;
    min-height: 52px;
    border: 1px solid rgba(90, 231, 255, 0.48);
    border-radius: 999px;
    background:
        linear-gradient(135deg, rgba(0, 217, 255, 0.16), rgba(255, 64, 129, 0.1)),
        #071227;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 18px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38), 0 0 24px rgba(0, 217, 255, 0.2);
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.assistant-toggle:hover,
.assistant-toggle:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(0, 245, 255, 0.9);
    box-shadow: 0 22px 58px rgba(0, 0, 0, 0.45), 0 0 30px rgba(0, 217, 255, 0.34);
    outline: none;
}

.assistant-toggle-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: relative;
    display: block;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.92) 0 10%, transparent 11%),
        radial-gradient(circle at 50% 50%, rgba(0, 245, 255, 0.35) 0 38%, transparent 39%),
        rgba(0, 217, 255, 0.14);
    color: #00e5ff;
    font-size: 0;
    line-height: 1;
    box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.15), 0 0 16px rgba(0, 229, 255, 0.36);
    isolation: isolate;
}

.assistant-toggle-icon::before,
.assistant-toggle-icon::after {
    content: '';
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(0, 245, 255, 0.74);
    border-radius: 50%;
    transform: rotate(26deg) scaleX(0.62);
}

.assistant-toggle-icon::after {
    border-color: rgba(255, 64, 129, 0.62);
    transform: rotate(-34deg) scaleX(0.7);
}

.assistant-icon-core {
    position: absolute;
    inset: 11px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.95);
    z-index: 2;
}

.assistant-icon-node {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #00f5ff;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.95);
    z-index: 3;
}

.assistant-icon-node.node-a {
    top: 5px;
    right: 7px;
}

.assistant-icon-node.node-b {
    left: 6px;
    bottom: 6px;
    background: #ff4081;
    box-shadow: 0 0 10px rgba(255, 64, 129, 0.85);
}

.assistant-icon-scan {
    position: absolute;
    left: 7px;
    right: 7px;
    top: 8px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #ffffff, transparent);
    opacity: 0.9;
    animation: assistantIconScan 2.8s ease-in-out infinite;
    z-index: 4;
}

.assistant-panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: min(390px, calc(100vw - 32px));
    height: min(640px, calc(100vh - 120px));
    min-height: 480px;
    display: none;
    grid-template-rows: auto 1fr auto;
    background: rgba(5, 10, 24, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(18px);
}

.portfolio-assistant.is-open .assistant-panel {
    display: grid;
}

.assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.12), rgba(124, 77, 255, 0.12));
}

.assistant-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.assistant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    position: relative;
    display: block;
    overflow: hidden;
    background:
        radial-gradient(circle at 28% 24%, rgba(0, 245, 255, 0.28), transparent 30%),
        linear-gradient(135deg, #071227 0%, #102a44 54%, #071227 100%);
    border: 1px solid rgba(0, 217, 255, 0.58);
    box-shadow: inset 0 0 18px rgba(0, 217, 255, 0.18), 0 0 22px rgba(0, 217, 255, 0.18);
    flex: 0 0 auto;
}

.assistant-avatar::before,
.assistant-avatar::after {
    content: '';
    position: absolute;
    background: rgba(0, 217, 255, 0.55);
}

.assistant-avatar::before {
    left: 6px;
    right: 6px;
    top: 19px;
    height: 1px;
}

.assistant-avatar::after {
    top: 6px;
    bottom: 6px;
    left: 19px;
    width: 1px;
}

.assistant-avatar span {
    margin: 0;
    color: inherit;
    font-size: 0;
    line-height: 1;
}

.assistant-avatar-ring {
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    border: 1px solid rgba(0, 245, 255, 0.78);
    box-shadow: 0 0 14px rgba(0, 245, 255, 0.2);
    z-index: 2;
}

.assistant-avatar-bolt {
    position: absolute;
    left: 13px;
    top: 8px;
    width: 15px;
    height: 24px;
    background: linear-gradient(180deg, #ffffff, #62f2ff 58%, #ff4f9a);
    clip-path: polygon(55% 0, 16% 43%, 44% 43%, 31% 100%, 86% 35%, 58% 35%);
    filter: drop-shadow(0 0 7px rgba(0, 245, 255, 0.74));
    z-index: 4;
}

.assistant-avatar-node {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00f5ff;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.88);
    z-index: 3;
}

.assistant-avatar-node.node-one {
    top: 6px;
    right: 8px;
}

.assistant-avatar-node.node-two {
    bottom: 7px;
    left: 7px;
    background: #ff4081;
    box-shadow: 0 0 10px rgba(255, 64, 129, 0.82);
}

.assistant-title strong {
    display: block;
    font-size: 15px;
    line-height: 1.25;
    color: #ffffff;
}

.assistant-title > div > span {
    display: block;
    margin-top: 2px;
    color: #aebbd2;
    font-size: 12px;
    line-height: 1.35;
}

.assistant-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.assistant-close:hover,
.assistant-close:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    outline: none;
}

.assistant-messages {
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.assistant-message {
    max-width: 92%;
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.assistant-message.assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    color: #eef6ff;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.assistant-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #00bcd4, #376cff);
    color: #ffffff;
}

.assistant-message.loading {
    color: #b8c5d6;
}

.assistant-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.assistant-chip {
    border: 1px solid rgba(0, 217, 255, 0.28);
    border-radius: 999px;
    background: rgba(0, 217, 255, 0.08);
    color: #dffbff;
    padding: 7px 10px;
    font-size: 12px;
    cursor: pointer;
}

.assistant-chip:hover,
.assistant-chip:focus-visible {
    background: rgba(0, 217, 255, 0.16);
    outline: none;
}

.assistant-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(2, 7, 18, 0.95);
}

.assistant-input {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    padding: 12px 13px;
    font: inherit;
    font-size: 14px;
}

.assistant-input::placeholder {
    color: #8190aa;
}

.assistant-input:focus {
    outline: none;
    border-color: rgba(0, 217, 255, 0.72);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.14);
}

.assistant-send {
    min-width: 74px;
    border: 0;
    border-radius: 10px;
    background: #00d9ff;
    color: #061122;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    padding: 0 16px;
}

.assistant-send:hover,
.assistant-send:focus-visible {
    background: #35e6ff;
    outline: none;
}

.assistant-disclaimer {
    grid-column: 1 / -1;
    margin: -2px 2px 0;
    color: #7d8ba4;
    font-size: 11px;
    line-height: 1.4;
}

@media (max-width: 520px) {
    .portfolio-assistant {
        right: 14px;
        bottom: 14px;
    }

    .assistant-toggle {
        min-width: 56px;
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 50%;
    }

    .assistant-toggle-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .assistant-toggle-icon {
        width: 34px;
        height: 34px;
    }

    .assistant-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 70px;
        width: auto;
        height: min(620px, calc(100vh - 98px));
        min-height: 420px;
    }
}

/* JARVIS project mark */
.jarvis-media {
    background:
        radial-gradient(circle at 50% 42%, rgba(0, 217, 255, 0.24), transparent 34%),
        linear-gradient(135deg, #071025 0%, #111c3e 52%, #1d1242 100%);
}

.jarvis-project-icon {
    --jarvis-size: 62px;
    width: var(--jarvis-size);
    height: var(--jarvis-size);
    position: relative;
    display: grid;
    place-items: center;
    isolation: isolate;
}

.jarvis-project-icon-large {
    --jarvis-size: 128px;
}

.jarvis-project-icon-compact {
    --jarvis-size: 50px;
    margin-right: 10px;
    flex: 0 0 auto;
}

.jarvis-chip {
    width: 64%;
    height: 64%;
    position: relative;
    border: 1px solid rgba(0, 245, 255, 0.72);
    border-radius: 18%;
    background:
        linear-gradient(135deg, rgba(0, 217, 255, 0.2), rgba(124, 77, 255, 0.16)),
        #071225;
    box-shadow:
        inset 0 0 18px rgba(0, 217, 255, 0.18),
        0 0 26px rgba(0, 217, 255, 0.24),
        0 18px 34px rgba(0, 0, 0, 0.28);
    animation: jarvisFloat 3.2s ease-in-out infinite;
}

.jarvis-chip::before,
.jarvis-chip::after {
    content: '';
    position: absolute;
    left: 18%;
    right: 18%;
    height: 8%;
    background:
        repeating-linear-gradient(90deg, transparent 0 10%, rgba(0, 245, 255, 0.68) 10% 18%, transparent 18% 28%);
}

.jarvis-chip::before {
    top: -14%;
}

.jarvis-chip::after {
    bottom: -14%;
}

.jarvis-eye-row {
    position: absolute;
    top: 32%;
    left: 22%;
    right: 22%;
    display: flex;
    justify-content: space-between;
}

.jarvis-eye-row i {
    width: 24%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #00f5ff;
    box-shadow: 0 0 12px rgba(0, 245, 255, 0.9);
    animation: jarvisBlink 4.4s ease-in-out infinite;
}

.jarvis-mouth {
    position: absolute;
    left: 30%;
    right: 30%;
    bottom: 28%;
    height: 7%;
    border-radius: 999px;
    background: rgba(248, 251, 255, 0.72);
}

.jarvis-scan {
    position: absolute;
    left: 10%;
    right: 10%;
    top: 18%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffffff, transparent);
    opacity: 0.72;
    animation: jarvisScan 2.4s ease-in-out infinite;
}

.jarvis-node {
    position: absolute;
    width: 10%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #00f5ff;
    box-shadow: 0 0 16px rgba(0, 245, 255, 0.72);
    opacity: 0.86;
}

.node-one {
    top: 4%;
    right: 12%;
}

.node-two {
    left: 6%;
    bottom: 18%;
    background: #7c4dff;
    box-shadow: 0 0 16px rgba(124, 77, 255, 0.72);
}

.node-three {
    right: 16%;
    bottom: 4%;
    background: #ff4081;
    box-shadow: 0 0 16px rgba(255, 64, 129, 0.6);
}

.jarvis-project-icon::before,
.jarvis-project-icon::after {
    content: '';
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    border: 1px solid rgba(0, 245, 255, 0.24);
    z-index: -1;
}

.jarvis-project-icon::after {
    inset: 0;
    border-color: rgba(124, 77, 255, 0.22);
    transform: rotate(28deg) scaleX(0.82);
}

.project-category.ai-category {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #00e5ff;
    border: 1px solid rgba(0, 217, 255, 0.28);
    background: rgba(0, 217, 255, 0.1);
}

.project-category.ai-category::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00e5ff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.9);
}

@keyframes jarvisFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4%); }
}

@keyframes jarvisScan {
    0%, 100% { top: 18%; opacity: 0.28; }
    50% { top: 78%; opacity: 0.84; }
}

@keyframes assistantIconScan {
    0%, 100% { top: 8px; opacity: 0.25; }
    50% { top: 21px; opacity: 0.9; }
}

@keyframes jarvisBlink {
    0%, 92%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.16); }
}

@media (prefers-reduced-motion: reduce) {
    .jarvis-chip,
    .jarvis-eye-row i,
    .jarvis-scan,
    .assistant-icon-scan {
        animation: none;
    }
}
