/* FastAstro Chat - Minimal Design */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    /* Color Palette */
    --primary: #000;
    --secondary: #666;
    --light: #f8f8f8;
    --border: #e0e0e0;
    --white: #fff;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-s: 1rem;
    --space-m: 2rem;
    --space-l: 3rem;
    --space-xl: 4rem;
    
    /* Typography */
    --font-size-s: 0.9rem;
    --font-size-m: 1rem;
    --font-size-l: 1.5rem;
    --font-size-xl: 2rem;
    
    /* Layout */
    --max-width: 1200px;
    --border-radius: 8px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: var(--font-size-m);
    line-height: 1.6;
    color: var(--primary);
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Layout */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-s);
}

.section-chat {
    padding: var(--space-l) 0;
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Cosmic Background */
.cosmic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.stars,
.stars2,
.stars3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.stars {
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #eee, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, rgba(255,255,255,0.9), transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: sparkle 20s linear infinite;
}

.stars2 {
    background-image: 
        radial-gradient(1px 1px at 40px 60px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 120px 25px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 170px 90px, rgba(255,255,255,0.8), transparent);
    background-repeat: repeat;
    background-size: 250px 120px;
    animation: sparkle 25s linear infinite reverse;
}

.stars3 {
    background-image: 
        radial-gradient(1px 1px at 60px 80px, rgba(255,255,255,0.4), transparent),
        radial-gradient(2px 2px at 100px 40px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 150px 60px, rgba(255,255,255,0.3), transparent);
    background-repeat: repeat;
    background-size: 300px 150px;
    animation: sparkle 30s linear infinite;
}

@keyframes sparkle {
    0% { transform: translateX(0); }
    100% { transform: translateX(-200px); }
}

/* Chat */
.chat-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    padding: 0 var(--space-s);
}

.chat-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.chat-header {
    padding: var(--space-xs) var(--space-m);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.logout-button {
    display: flex;
    align-items: center;
    gap: calc(var(--space-xs) * 0.5);
    padding: calc(var(--space-xs) * 0.5) var(--space-xs);
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    text-decoration: none;
    border-radius: calc(var(--border-radius) * 0.5);
    font-size: var(--font-size-s);
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.logout-button:hover {
    background: rgba(220, 53, 69, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.header-center {
    display: flex;
    align-items: center;
    gap: calc(var(--space-xs) * 0.5);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.cosmic-icon-small {
    color: rgba(0, 0, 0, 0.6);
    animation: rotate 20s linear infinite, pulse 3s ease-in-out infinite;
    display: flex;
    align-items: center;
}

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

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

.chat-title {
    font-weight: 500;
    margin: 0;
    color: var(--primary);
    margin-left: calc(var(--space-xs) * -0.25);
}

.chat-iframe {
    width: 100%;
    height: 80vh;
    min-height: 700px;
    border: none;
    display: block;
    background: var(--white);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
}

.loading-spinner {
    text-align: center;
    color: var(--primary);
}

.spinner-orbit {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-s);
}

.spinner-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 2s ease-in-out infinite;
}

.spinner-ring,
.spinner-ring-2,
.spinner-ring-3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-radius: 50%;
    animation: rotate 3s linear infinite;
}

.spinner-ring {
    border-top: 2px solid var(--primary);
    border-right: 2px solid rgba(0, 0, 0, 0.1);
    animation-duration: 2s;
}

.spinner-ring-2 {
    border-right: 2px solid var(--secondary);
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    animation-duration: 2.5s;
    animation-direction: reverse;
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
}

.spinner-ring-3 {
    border-left: 2px solid var(--primary);
    border-top: 2px solid rgba(0, 0, 0, 0.1);
    animation-duration: 3s;
    width: 40px;
    height: 40px;
    top: 20px;
    left: 20px;
}

.loading-text {
    margin: 0;
    font-weight: 500;
    color: var(--secondary);
    animation: fade 2s ease-in-out infinite;
}

.astro-fact {
    margin: var(--space-s) 0 0;
    font-weight: 400;
    color: var(--primary);
    font-size: var(--font-size-s);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    text-align: center;
    min-height: 1.2em;
    line-height: 1.4;
    max-width: 280px;
}

@keyframes fade {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    :root {
        --font-size-xl: 1.75rem;
        --font-size-l: 1.25rem;
        --space-xs: 0.25rem;
        --space-s: 0.75rem;
        --space-m: 1.5rem;
    }
    
    .section-chat {
        padding: var(--space-s);
        min-height: 100vh;
        display: flex;
        align-items: stretch;
    }
    
    .container {
        padding: 0 var(--space-xs);
    }
    
    .chat-container {
        padding: 0;
        width: 100%;
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    .chat-card {
        margin: 0;
        border-radius: var(--space-xs);
        height: calc(100vh - var(--space-s) * 2);
        display: flex;
        flex-direction: column;
    }
    
    .chat-header {
        padding: var(--space-xs) var(--space-s);
        flex-shrink: 0;
        flex-direction: column;
        gap: var(--space-xs);
    }
    
    .header-center {
        position: static;
        transform: none;
    }
    
    .logout-button {
        align-self: flex-end;
        font-size: calc(var(--font-size-s) * 0.9);
        padding: calc(var(--space-xs) * 0.25) calc(var(--space-xs) * 0.5);
    }
    
    .logout-button svg {
        width: 14px;
        height: 14px;
    }
    
    .chat-title {
        font-size: var(--font-size-s);
        margin-left: calc(var(--space-xs) * -0.5);
    }
    
    .cosmic-icon-small svg {
        width: 20px;
        height: 20px;
    }
    
    .chat-iframe {
        height: 100%;
        min-height: unset;
        flex: 1;
        border-radius: 0 0 var(--space-xs) var(--space-xs);
    }
    
    .stars,
    .stars2,
    .stars3 {
        background-size: 120px 60px, 140px 70px, 160px 80px;
    }
    
    .spinner-orbit {
        width: 60px;
        height: 60px;
    }
    
    .spinner-ring-2 {
        width: 45px;
        height: 45px;
        top: 7.5px;
        left: 7.5px;
    }
    
    .spinner-ring-3 {
        width: 30px;
        height: 30px;
        top: 15px;
        left: 15px;
    }
    
    .loading-text {
        font-size: var(--font-size-s);
    }
    
    .astro-fact {
        font-size: calc(var(--font-size-s) * 0.9);
        max-width: 240px;
        margin: calc(var(--space-s) * 0.8) 0 0;
    }
}

@media (max-width: 480px) {
    :root {
        --space-xs: 0.125rem;
        --space-s: 0.5rem;
        --space-m: 1rem;
    }
    
    .section-chat {
        padding: var(--space-xs);
    }
    
    .chat-card {
        height: calc(100vh - var(--space-xs) * 2);
    }
    
    .chat-header {
        padding: calc(var(--space-xs) * 1.5) var(--space-s);
    }
    
    .chat-title {
        font-size: calc(var(--font-size-s) * 0.9);
    }
    
    .cosmic-icon-small svg {
        width: 18px;
        height: 18px;
    }
}