/* Novo componente visual para REST API */
.api-visual {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}

/* Círculo central de dados */
.api-data-circle {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0077ff, #00c3ff);
    box-shadow: 0 0 30px rgba(0, 195, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    animation: pulse 3s infinite ease-in-out;
}

.api-data-circle::before {
    content: '';
    position: absolute;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    animation: spin 2s linear infinite;
}

.api-data-circle::after {
    content: '';
    position: absolute;
    width: 60%;
    height: 60%;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-bottom: 3px solid #ffffff;
    animation: spin 3s linear infinite reverse;
}

/* Ícone central */
.api-icon {
    color: white;
    font-size: 24px;
    z-index: 3;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
}

/* Linhas de conexão */
.api-connections {
    position: absolute;
    width: 200px;
    height: 200px;
    z-index: 1;
}

.connection-line {
    position: absolute;
    top: 50%;
    left: 50%;
    height: 2px;
    background: linear-gradient(90deg, rgba(0, 195, 255, 0.8), rgba(0, 119, 255, 0.2));
    transform-origin: left center;
}

.connection-line::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #00c3ff;
    transform: translateY(-50%);
    box-shadow: 0 0 8px #00c3ff;
}

.connection-line:nth-child(1) {
    width: 80px;
    transform: rotate(0deg) translateY(-50%);
    animation: dataFlow 2s infinite;
}

.connection-line:nth-child(2) {
    width: 70px;
    transform: rotate(45deg) translateY(-50%);
    animation: dataFlow 2s infinite 0.2s;
}

.connection-line:nth-child(3) {
    width: 90px;
    transform: rotate(90deg) translateY(-50%);
    animation: dataFlow 2s infinite 0.4s;
}

.connection-line:nth-child(4) {
    width: 75px;
    transform: rotate(135deg) translateY(-50%);
    animation: dataFlow 2s infinite 0.6s;
}

.connection-line:nth-child(5) {
    width: 85px;
    transform: rotate(180deg) translateY(-50%);
    animation: dataFlow 2s infinite 0.8s;
}

.connection-line:nth-child(6) {
    width: 65px;
    transform: rotate(225deg) translateY(-50%);
    animation: dataFlow 2s infinite 1s;
}

.connection-line:nth-child(7) {
    width: 80px;
    transform: rotate(270deg) translateY(-50%);
    animation: dataFlow 2s infinite 1.2s;
}

.connection-line:nth-child(8) {
    width: 70px;
    transform: rotate(315deg) translateY(-50%);
    animation: dataFlow 2s infinite 1.4s;
}

/* Pacotes de dados */
.data-packet {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #ffffff;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    opacity: 0;
}

.data-packet:nth-child(1) {
    top: 30%;
    left: 20%;
    animation: packetMove 3s infinite 0.2s;
}

.data-packet:nth-child(2) {
    top: 70%;
    left: 30%;
    animation: packetMove 3s infinite 0.7s;
}

.data-packet:nth-child(3) {
    top: 40%;
    left: 80%;
    animation: packetMove 3s infinite 1.2s;
}

.data-packet:nth-child(4) {
    top: 60%;
    left: 70%;
    animation: packetMove 3s infinite 1.7s;
}

.data-packet:nth-child(5) {
    top: 50%;
    left: 50%;
    animation: packetMove 3s infinite 2.2s;
}

/* Código API */
.api-code-container {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #00c3ff;
    overflow: hidden;
    border-left: 3px solid #00c3ff;
}

.api-code-text {
    display: block;
    white-space: nowrap;
    animation: codeTyping 8s infinite linear;
}

/* Animações */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(0, 195, 255, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(0, 195, 255, 0.9);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dataFlow {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

@keyframes packetMove {
    0% {
        transform: scale(0.5) translate(0, 0);
        opacity: 0;
    }
    20% {
        transform: scale(1) translate(20px, -10px);
        opacity: 1;
    }
    80% {
        transform: scale(1) translate(60px, 30px);
        opacity: 1;
    }
    100% {
        transform: scale(0.5) translate(80px, 40px);
        opacity: 0;
    }
}

@keyframes codeTyping {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Tema claro */
html.light-mode .api-data-circle {
    background: linear-gradient(135deg, #0056b3, #0077b6);
    box-shadow: 0 0 30px rgba(0, 119, 182, 0.5);
}

html.light-mode .connection-line {
    background: linear-gradient(90deg, rgba(0, 119, 182, 0.8), rgba(0, 86, 179, 0.2));
}

html.light-mode .connection-line::after {
    background-color: #0077b6;
    box-shadow: 0 0 8px #0077b6;
}

html.light-mode .api-code-container {
    background: rgba(0, 0, 0, 0.1);
    border-left: 3px solid #0077b6;
    color: #0077b6;
}

/* Responsividade */
@media screen and (max-width: 576px) {
    .api-data-circle {
        width: 80px;
        height: 80px;
    }
    
    .api-connections {
        width: 160px;
        height: 160px;
    }
    
    .connection-line:nth-child(1) { width: 60px; }
    .connection-line:nth-child(2) { width: 55px; }
    .connection-line:nth-child(3) { width: 70px; }
    .connection-line:nth-child(4) { width: 60px; }
    .connection-line:nth-child(5) { width: 65px; }
    .connection-line:nth-child(6) { width: 50px; }
    .connection-line:nth-child(7) { width: 60px; }
    .connection-line:nth-child(8) { width: 55px; }
}
