/* CQ Team Extension Visualization */
.cq-team-extension {
    width: 100%;
    height: 100%;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 1rem;
}

/* Chat Interface */
.chat-interface {
    width: 100%;
    max-width: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 1;
    animation: hideElement 0.5s ease-out 3s forwards;
}

.question-text {
    font-size: 0.8rem;
    color: #1d0c46;
    line-height: 1.4;
    margin: 0;
    opacity: 0;
    animation: typeQuestion 3s ease-in-out forwards;
}

@keyframes typeQuestion {
    0% {
        opacity: 0;
        width: 0;
    }
    100% {
        opacity: 1;
        width: 100%;
    }
}

@keyframes showElement {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes hideElement {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Query Fragments */
.query-fragments {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    animation: showElement 0.5s ease-out 3s forwards, hideElement 0.5s ease-out 5s forwards;
}

.fragment {
    position: absolute;
    background: linear-gradient(135deg, #1d0c46, #6b5b7a);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0;
    transform: scale(0);
    box-shadow: 0 4px 15px rgba(29, 12, 70, 0.3);
}

.fragment-1 {
    top: 20%;
    left: 10%;
    animation: fragmentAppear 0.5s ease-out 3s forwards;
}

.fragment-2 {
    top: 40%;
    right: 10%;
    animation: fragmentAppear 0.5s ease-out 3.2s forwards;
}

.fragment-3 {
    bottom: 20%;
    left: 20%;
    animation: fragmentAppear 0.5s ease-out 3.4s forwards;
}

@keyframes fragmentAppear {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* CQ Logo Core */
.cq-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    opacity: 0;
    animation: showElement 0.5s ease-out 5s forwards, hideElement 0.5s ease-out 7s forwards;
}

.cq-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 15px rgba(202, 169, 104, 0.4));
}

@keyframes coreAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Data Cloud */
.data-cloud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: showElement 0.5s ease-out 5.5s forwards, hideElement 0.5s ease-out 7s forwards;
}

.cloud-node {
    position: absolute;
    width: 8px;
    height: 8px;
    background: rgba(202, 169, 104, 0.3);
    border-radius: 50%;
    opacity: 0;
}

.cloud-node:nth-child(1) {
    top: 15%;
    left: 20%;
    animation: nodePulse 1s ease-in-out 6s infinite;
}

.cloud-node:nth-child(2) {
    top: 30%;
    right: 15%;
    animation: nodePulse 1s ease-in-out 6.2s infinite;
}

.cloud-node:nth-child(3) {
    bottom: 25%;
    left: 15%;
    animation: nodePulse 1s ease-in-out 6.4s infinite;
}

.cloud-node:nth-child(4) {
    bottom: 15%;
    right: 25%;
    animation: nodePulse 1s ease-in-out 6.6s infinite;
}

@keyframes cloudAppear {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes nodePulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
}

/* Data Streams */
.data-stream {
    position: absolute;
    width: 2px;
    background: linear-gradient(to bottom, #CAA968, transparent);
    opacity: 0;
    animation: streamFlow 1s ease-out 6s forwards, hideElement 0.5s ease-out 7s forwards;
}

.stream-1 {
    top: 15%;
    left: 20%;
    height: 30%;
    animation-delay: 6s;
}

.stream-2 {
    top: 30%;
    right: 15%;
    height: 25%;
    animation-delay: 6.2s;
}

.stream-3 {
    bottom: 25%;
    left: 15%;
    height: 35%;
    animation-delay: 6.4s;
}

@keyframes streamFlow {
    0% {
        opacity: 0;
        height: 0;
    }
    100% {
        opacity: 1;
        height: 30%;
    }
}

/* Insight Cluster */
.insight-cluster {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 280px;
    opacity: 0;
    animation: showElement 0.8s ease-out 7s forwards, hideElement 0.5s ease-out 11s forwards;
    padding: 0.5rem;
    box-sizing: border-box;
}

.text-summary {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.summary-text {
    font-size: 0.65rem;
    color: #1d0c46;
    margin: 0;
    font-weight: 600;
}

.line-graph {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.graph-title {
    font-size: 0.6rem;
    color: #1d0c46;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.graph-line {
    width: 100%;
    height: 30px;
    position: relative;
}

.graph-path {
    stroke: #1d0c46;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawLine 1s ease-out 7.5s forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

.recommendation-card {
    background: linear-gradient(135deg, rgba(29, 12, 70, 0.1), rgba(29, 12, 70, 0.05));
    border-radius: 8px;
    padding: 0.8rem;
    border: 1px solid rgba(29, 12, 70, 0.3);
}

.recommendation-title {
    font-size: 0.6rem;
    color: #1d0c46;
    margin: 0 0 0.3rem 0;
    font-weight: 600;
}

.recommendation-text {
    font-size: 0.55rem;
    color: #1d0c46;
    margin: 0;
    line-height: 1.3;
}

/* Metrics Row */
.metrics-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.metric-item {
    flex: 1;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.4rem;
}

.metric-value {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    color: #1d0c46;
    margin-bottom: 0.2rem;
}

.metric-label {
    display: block;
    font-size: 0.5rem;
    color: #1d0c46;
    opacity: 0.8;
}

@keyframes clusterAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Dissolve Animation */
.dissolve-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    animation: showElement 0.5s ease-out 11s forwards;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #CAA968;
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 1s ease-out 11.5s forwards;
}

.particle:nth-child(1) { top: 20%; left: 30%; animation-delay: 11.5s; }
.particle:nth-child(2) { top: 40%; left: 60%; animation-delay: 11.6s; }
.particle:nth-child(3) { top: 60%; left: 20%; animation-delay: 11.7s; }
.particle:nth-child(4) { top: 30%; left: 80%; animation-delay: 11.8s; }
.particle:nth-child(5) { top: 70%; left: 70%; animation-delay: 11.9s; }

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0) translateY(-20px);
    }
}

/* Mobile optimization */
@media (max-width: 768px) {
    .cq-team-extension {
        height: 400px;
        padding: 0.5rem;
    }
    
    .chat-interface {
        max-width: 220px;
        padding: 0.5rem;
    }
    
    .question-text {
        font-size: 0.65rem;
    }
    
    .fragment {
        font-size: 0.55rem;
        padding: 0.2rem 0.4rem;
    }
    
    .cq-core {
        width: 40px;
        height: 40px;
    }
    
    .insight-cluster {
        width: 95%;
        max-width: 350px;
        padding: 0.3rem;
    }
    
    .summary-text {
        font-size: 0.7rem;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .graph-title {
        font-size: 0.65rem;
    }
    
    .recommendation-title {
        font-size: 0.65rem;
    }
    
    .recommendation-text {
        font-size: 0.6rem;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .metrics-row {
        gap: 0.3rem;
        margin-bottom: 0.3rem;
    }
    
    .metric-item {
        padding: 0.3rem;
    }
    
    .metric-value {
        font-size: 0.7rem;
    }
    
    .metric-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .cq-team-extension {
        height: 380px;
        padding: 0.4rem;
    }
    
    .chat-interface {
        max-width: 180px;
        padding: 0.4rem;
    }
    
    .question-text {
        font-size: 0.6rem;
    }
    
    .fragment {
        font-size: 0.5rem;
        padding: 0.15rem 0.3rem;
    }
    
    .cq-core {
        width: 35px;
        height: 35px;
    }
    
    .insight-cluster {
        width: 95%;
        max-width: 320px;
        padding: 0.25rem;
    }
    
    .summary-text {
        font-size: 0.6rem;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .graph-title {
        font-size: 0.55rem;
    }
    
    .recommendation-title {
        font-size: 0.55rem;
    }
    
    .recommendation-text {
        font-size: 0.5rem;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .metrics-row {
        gap: 0.2rem;
        margin-bottom: 0.2rem;
    }
    
    .metric-item {
        padding: 0.25rem;
    }
    
    .metric-value {
        font-size: 0.65rem;
    }
    
    .metric-label {
        font-size: 0.55rem;
    }
}

@media (max-width: 360px) {
    .cq-team-extension {
        height: 360px;
        padding: 0.3rem;
    }
    
    .chat-interface {
        max-width: 160px;
        padding: 0.3rem;
    }
    
    .question-text {
        font-size: 0.55rem;
    }
    
    .fragment {
        font-size: 0.45rem;
        padding: 0.1rem 0.25rem;
    }
    
    .cq-core {
        width: 30px;
        height: 30px;
    }
    
    .insight-cluster {
        width: 95%;
        max-width: 280px;
        padding: 0.2rem;
    }
    
    .summary-text {
        font-size: 0.55rem;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .graph-title {
        font-size: 0.5rem;
    }
    
    .recommendation-title {
        font-size: 0.5rem;
    }
    
    .recommendation-text {
        font-size: 0.45rem;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .metrics-row {
        gap: 0.15rem;
        margin-bottom: 0.15rem;
    }
    
    .metric-item {
        padding: 0.2rem;
    }
    
    .metric-value {
        font-size: 0.6rem;
    }
    
    .metric-label {
        font-size: 0.5rem;
    }
}

@media (max-width: 320px) {
    .cq-team-extension {
        height: 340px;
        padding: 0.25rem;
    }
    
    .chat-interface {
        max-width: 140px;
        padding: 0.25rem;
    }
    
    .question-text {
        font-size: 0.5rem;
    }
    
    .fragment {
        font-size: 0.4rem;
        padding: 0.1rem 0.2rem;
    }
    
    .cq-core {
        width: 25px;
        height: 25px;
    }
    
    .insight-cluster {
        width: 95%;
        max-width: 240px;
        padding: 0.15rem;
    }
    
    .summary-text {
        font-size: 0.55rem;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .graph-title {
        font-size: 0.5rem;
    }
    
    .recommendation-title {
        font-size: 0.5rem;
    }
    
    .recommendation-text {
        font-size: 0.45rem;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .metrics-row {
        gap: 0.1rem;
        margin-bottom: 0.1rem;
    }
    
    .metric-item {
        padding: 0.15rem;
    }
    
    .metric-value {
        font-size: 0.55rem;
    }
    
    .metric-label {
        font-size: 0.45rem;
    }
}
