/* Page Transition Loader with Liquid Glass Effect */
:root {
    --hcai-orange: #FF9E5E;
    --hcai-orange-light: #FFB074;
    --hcai-orange-dark: #FF8842;
}

/* Page Transition Overlay */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--hcai-orange) 0%, var(--hcai-orange-light) 50%, var(--hcai-orange-dark) 100%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    
    /* Liquid Glass Effect */
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    background: linear-gradient(135deg, 
        rgba(255, 158, 94, 0.85) 0%, 
        rgba(255, 176, 116, 0.85) 50%, 
        rgba(255, 136, 66, 0.85) 100%);
}

.page-transition-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Logo Container */
.synapse-logo-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG Logo */
.synapse-logo-svg {
    position: absolute;
    width: 100%;
    height: 100%;
}

/* Node Animation */
.synapse-node {
    fill: white;
    opacity: 0;
    animation: nodeAppear 0.5s ease forwards;
}

.synapse-node:nth-child(1) { animation-delay: 0.2s; }
.synapse-node:nth-child(2) { animation-delay: 0.4s; }
.synapse-node:nth-child(3) { animation-delay: 0.6s; }
.synapse-node:nth-child(4) { animation-delay: 0.8s; }
.synapse-node:nth-child(5) { animation-delay: 1.0s; }
.synapse-node:nth-child(6) { animation-delay: 1.2s; }

/* Quick Animation for Non-Home Pages */
.page-transition-overlay.quick .synapse-node {
    animation: nodeAppear 0.3s ease forwards;
}

.page-transition-overlay.quick .synapse-node:nth-child(1) { animation-delay: 0.05s; }
.page-transition-overlay.quick .synapse-node:nth-child(2) { animation-delay: 0.1s; }
.page-transition-overlay.quick .synapse-node:nth-child(3) { animation-delay: 0.15s; }
.page-transition-overlay.quick .synapse-node:nth-child(4) { animation-delay: 0.2s; }
.page-transition-overlay.quick .synapse-node:nth-child(5) { animation-delay: 0.25s; }
.page-transition-overlay.quick .synapse-node:nth-child(6) { animation-delay: 0.3s; }

/* Connection Lines Animation */
.synapse-connection {
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    fill: none;
    animation: drawLine 0.8s ease forwards;
}

.synapse-connection:nth-child(1) { animation-delay: 0.3s; }
.synapse-connection:nth-child(2) { animation-delay: 0.5s; }
.synapse-connection:nth-child(3) { animation-delay: 0.7s; }
.synapse-connection:nth-child(4) { animation-delay: 0.9s; }
.synapse-connection:nth-child(5) { animation-delay: 1.1s; }
.synapse-connection:nth-child(6) { animation-delay: 1.3s; }

/* Quick Animation for Non-Home Pages */
.page-transition-overlay.quick .synapse-connection {
    animation: drawLine 0.5s ease forwards;
}

.page-transition-overlay.quick .synapse-connection:nth-child(1) { animation-delay: 0.08s; }
.page-transition-overlay.quick .synapse-connection:nth-child(2) { animation-delay: 0.13s; }
.page-transition-overlay.quick .synapse-connection:nth-child(3) { animation-delay: 0.18s; }
.page-transition-overlay.quick .synapse-connection:nth-child(4) { animation-delay: 0.23s; }
.page-transition-overlay.quick .synapse-connection:nth-child(5) { animation-delay: 0.28s; }
.page-transition-overlay.quick .synapse-connection:nth-child(6) { animation-delay: 0.33s; }

/* Central Logo Pulse */
.synapse-center {
    fill: white;
    opacity: 0;
    animation: centerAppear 1s ease forwards 1.5s;
}

.page-transition-overlay.quick .synapse-center {
    animation: centerAppear 0.6s ease forwards 0.4s;
}

/* Logo Text */
.synapse-text {
    fill: white;
    font-size: 48px;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    opacity: 0;
    animation: textAppear 0.8s ease forwards 1.8s;
}

.page-transition-overlay.quick .synapse-text {
    animation: textAppear 0.5s ease forwards 0.5s;
}

/* Branding Text */
.hcai-branding {
    margin-top: 30px;
    text-align: center;
    opacity: 0;
    animation: brandingAppear 0.8s ease forwards 2.2s;
}

.page-transition-overlay.quick .hcai-branding {
    animation: brandingAppear 0.4s ease forwards 0.6s;
}

.hcai-branding p {
    color: white;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.hcai-branding a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.hcai-branding a:hover {
    border-bottom-color: white;
}

/* Animations */
@keyframes nodeAppear {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        transform: scale(1.3) rotate(180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(360deg);
    }
}

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

@keyframes centerAppear {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    60% {
        transform: scale(1.2) rotate(360deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(360deg);
    }
}

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

@keyframes brandingAppear {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse Animation for Center Node */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.synapse-center.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Liquid Glass Shimmer Effect */
.page-transition-overlay::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Loading Spinner (fallback) */
.loading-spinner {
    position: absolute;
    bottom: 80px;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    animation: spinnerAppear 0.5s ease forwards 2.5s;
}

.page-transition-overlay.quick .loading-spinner {
    animation: spinnerAppear 0.3s ease forwards 0.7s;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes spinnerAppear {
    to {
        opacity: 1;
    }
}

/* Footer Signature Style */
.hcai-footer-signature {
    text-align: center;
    padding: 25px 20px;
    margin-top: 40px;
    color: #6c757d;
    font-size: 0.95rem;
    border-top: 1px solid #e9ecef;
    background: linear-gradient(to bottom, transparent, rgba(255, 158, 94, 0.03));
}

.hcai-footer-signature p {
    margin: 0;
    line-height: 1.6;
}

.hcai-footer-signature strong {
    color: var(--hcai-orange);
    font-weight: 600;
}

.hcai-footer-signature a {
    color: var(--hcai-orange);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.hcai-footer-signature a:hover {
    border-bottom-color: var(--hcai-orange);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .synapse-logo-container {
        width: 250px;
        height: 250px;
    }
    
    .synapse-text {
        font-size: 36px;
    }
    
    .hcai-branding p {
        font-size: 14px;
    }
    
    .hcai-footer-signature {
        font-size: 0.85rem;
        padding: 20px 15px;
    }
}

@media (max-width: 480px) {
    .synapse-logo-container {
        width: 200px;
        height: 200px;
    }
    
    .synapse-text {
        font-size: 28px;
    }
    
    .hcai-branding p {
        font-size: 12px;
    }
}
