/**
 * Cosmic Layout CSS - A three-part cosmic design with:
 * - Galaxies in the header
 * - Cosmic Tree of Life in the middle
 * - Blockchain in the footer
 */

/* Base cosmic styles */
.cosmic-container {
    position: relative;
    min-height: 100vh;
    background-color: #0a0a14;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* --------- GALAXIES HEADER --------- */
.galaxies-header {
    position: relative;
    min-height: 180px;
    overflow: hidden;
    background: linear-gradient(to bottom, #0a0a14 0%, #152264 50%, #0a0a14 100%);
    padding: 20px 0;
    z-index: 10;
    border-bottom: 1px solid rgba(64, 196, 255, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.galaxy {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.08) 40%, rgba(0,0,0,0) 70%);
    box-shadow: 0 0 25px rgba(180, 180, 255, 0.4);
    opacity: 0.8;
    animation: rotate 240s infinite linear;
    filter: drop-shadow(0 0 10px rgba(120, 120, 255, 0.3));
}

.galaxy::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90%;
    height: 90%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.03) 30%, rgba(0,0,0,0) 60%);
    border-radius: 50%;
}

.galaxy::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 60%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.02) 30%, rgba(0,0,0,0) 60%);
    border-radius: 50%;
}

.galaxy-1 {
    top: -20px;
    left: 10%;
    width: 100px;
    height: 100px;
    transform: rotate(15deg);
}

.galaxy-2 {
    top: 30px;
    right: 15%;
    width: 140px;
    height: 140px;
    transform: rotate(-10deg);
}

.galaxy-3 {
    bottom: -30px;
    left: 30%;
    width: 120px;
    height: 120px;
    transform: rotate(5deg);
    opacity: 0.5;
}

.star {
    position: absolute;
    background-color: #fff;
    border-radius: 50%;
    opacity: 0.8;
    animation: twinkle 4s infinite ease-in-out;
}

/* --------- COSMIC TREE MIDDLE --------- */
.cosmic-tree-container {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    background: radial-gradient(ellipse at center, #0f1729 0%, #0a0a14 100%);
    overflow: hidden;
    z-index: 5;
}

.cosmic-tree {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: auto;
    z-index: 10;
    animation: gentle-float 15s infinite ease-in-out;
    filter: drop-shadow(0 0 15px rgba(39, 174, 96, 0.3));
}

.cosmic-tree-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/images/cosmic-meditation-tree.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.4; /* Reduced opacity for subtle background appearance */
    z-index: -1;
    filter: blur(3px); /* Slight blur for a dreamy effect */
}

.cosmic-energy {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(126, 87, 194, 0.3) 0%, rgba(126, 87, 194, 0.1) 50%, rgba(0,0,0,0) 70%);
    filter: blur(5px);
    animation: pulse 8s infinite alternate;
}

.cosmic-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: rgba(255,255,255,0.7);
    border-radius: 50%;
    z-index: 1;
    animation: float 15s infinite ease-in-out;
}

.cosmic-dragon {
    position: absolute;
    width: 100px;
    height: 40px;
    background: linear-gradient(90deg, 
        rgba(39, 174, 96, 0.1), 
        rgba(39, 174, 96, 0.3) 50%, 
        rgba(39, 174, 96, 0.1)
    );
    border-radius: 50%;
    filter: blur(5px);
    opacity: 0.5;
    z-index: 2;
    animation: dragon-flow 25s infinite ease-in-out;
    transform-origin: center center;
    box-shadow: 0 0 15px rgba(39, 174, 96, 0.3);
}

.cosmic-dragon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(39, 174, 96, 0), 
        rgba(39, 174, 96, 0.7) 50%, 
        rgba(39, 174, 96, 0)
    );
    transform: translateY(-50%);
}

.cosmic-dragon::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 75%;
    width: 15px;
    background: radial-gradient(ellipse at center, 
        rgba(39, 174, 96, 0.4) 0%, 
        rgba(39, 174, 96, 0) 70%
    );
    border-radius: 50%;
}

/* --------- BLOCKCHAIN FOOTER --------- */
.blockchain-footer {
    position: relative;
    min-height: 140px;
    background: linear-gradient(to top, #0a0a14 0%, #152264 50%, #0a0a14 100%);
    overflow: hidden;
    padding: 20px 0;
    z-index: 10;
    border-top: 1px solid rgba(64, 196, 255, 0.2);
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.blockchain-container {
    position: relative;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blockchain-line {
    position: absolute;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, 
        rgba(0,0,0,0) 0%, 
        rgba(64, 196, 255, 0.3) 20%, 
        rgba(64, 196, 255, 0.7) 50%, 
        rgba(64, 196, 255, 0.3) 80%, 
        rgba(0,0,0,0) 100%);
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 10px rgba(64, 196, 255, 0.4);
    animation: pulse 5s infinite alternate;
}

.block {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0f192a 0%, #1a2742 100%);
    border: 1px solid rgba(64, 196, 255, 0.3);
    border-radius: 4px;
    margin: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(64, 196, 255, 0.7);
    font-size: 12px;
    animation: pulse 3s infinite alternate, float-slow 20s infinite ease-in-out;
    position: relative;
    z-index: 5;
}

.block::before {
    content: '';
    position: absolute;
    width: 15px;
    height: 1px;
    background: rgba(64, 196, 255, 0.5);
    left: -15px;
    top: 50%;
}

.block:first-child::before {
    display: none;
}

.block::after {
    content: attr(data-hash);
    position: absolute;
    bottom: -20px;
    font-size: 8px;
    color: rgba(64, 196, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.data-flow {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: rgba(64, 196, 255, 0.8);
    filter: blur(1px);
    animation: data-flow 5s linear infinite;
}

/* Animations */
@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes twinkle {
    0% { opacity: 0.2; }
    50% { opacity: 0.8; }
    100% { opacity: 0.2; }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 0.7; }
    100% { transform: scale(1); opacity: 0.5; }
}

@keyframes float {
    0% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-15px) translateX(10px); }
    50% { transform: translateY(0) translateX(20px); }
    75% { transform: translateY(15px) translateX(10px); }
    100% { transform: translateY(0) translateX(0); }
}

@keyframes float-slow {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

@keyframes data-flow {
    0% {
        left: 0;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

@keyframes gentle-float {
    0% { transform: translateY(0); }
    25% { transform: translateY(-8px) scale(1.01); }
    50% { transform: translateY(0) scale(1); }
    75% { transform: translateY(8px) scale(0.99); }
    100% { transform: translateY(0); }
}

@keyframes dragon-flow {
    0% { 
        transform: translateY(0) translateX(0) rotate(0deg); 
        opacity: 0.4;
    }
    25% { 
        transform: translateY(-30px) translateX(20px) rotate(5deg); 
        opacity: 0.6;
    }
    50% { 
        transform: translateY(-10px) translateX(40px) rotate(0deg); 
        opacity: 0.7;
    }
    75% { 
        transform: translateY(10px) translateX(20px) rotate(-5deg); 
        opacity: 0.6;
    }
    100% { 
        transform: translateY(0) translateX(0) rotate(0deg); 
        opacity: 0.4;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .blockchain-container {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0 20px;
    }
    
    .cosmic-tree {
        max-width: 90%;
    }
    
    .galaxies-header,
    .blockchain-footer {
        min-height: 100px;
    }
}