:root {
    --primary-color: #6B21A8; /* Purple */
    --secondary-color: #F97316; /* Orange */
    --light-purple: #9333EA;
    --dark-purple: #4C1D95;
    --white: #FFFFFF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Google Sans', sans-serif;
}

body {
    background-color: var(--dark-purple);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(-45deg, var(--dark-purple), #4c1d95, #6d28d9, var(--primary-color), #f97316, #ea580c);
    background-size: 400% 400%;
    animation: gradientBackground 15s ease infinite;
    position: relative;
}

/* Hi-Tech Animated Background */
.app-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, transparent 97%, rgba(147, 51, 234, 0.15) 3%),
        linear-gradient(0deg, transparent 97%, rgba(249, 115, 22, 0.15) 3%);
    background-size: 40px 40px;
    opacity: 0.4;
    z-index: 0;
    pointer-events: none;
    animation: gridMove 30s linear infinite;
    box-shadow: inset 0 0 100px rgba(147, 51, 234, 0.2), inset 0 0 50px rgba(249, 115, 22, 0.2);
}

/* Glowing Lines */
.app-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(147, 51, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(249, 115, 22, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(147, 51, 234, 0.05) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
    animation: pulseGlow 8s ease-in-out infinite;
}

/* Additional Tech Elements */
.tech-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

/* Tech Dots and Flares */
.tech-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: rgba(147, 51, 234, 0.4);
    box-shadow: 0 0 10px 2px rgba(147, 51, 234, 0.3);
    animation: pulseDot 4s ease-in-out infinite;
    z-index: 0;
    opacity: 0.3;
}

/* Light Flares */
.light-flare {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.2) 0%, rgba(249, 115, 22, 0.1) 30%, transparent 70%);
    filter: blur(8px);
    opacity: 0;
    z-index: 0;
    animation: flareAnimation 8s ease-in-out infinite;
}

.light-flare:nth-child(12) {
    top: 20%;
    left: 15%;
    animation-delay: 0s;
    width: 200px;
    height: 200px;
}

.light-flare:nth-child(13) {
    top: 70%;
    left: 80%;
    animation-delay: 4s;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.2) 0%, rgba(147, 51, 234, 0.1) 30%, transparent 70%);
}

/* Energy Pulse */
.energy-pulse {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(147, 51, 234, 0.3);
    opacity: 0;
    z-index: 0;
    animation: pulseRing 6s linear infinite;
}

.energy-pulse:nth-child(14) {
    top: 30%;
    left: 50%;
    animation-delay: 0s;
}

.energy-pulse:nth-child(15) {
    top: 60%;
    left: 30%;
    animation-delay: 3s;
    border-color: rgba(249, 115, 22, 0.3);
}

.tech-dot:nth-child(8) {
    top: 15%;
    left: 20%;
    animation-delay: 0s;
}

.tech-dot:nth-child(9) {
    top: 25%;
    left: 80%;
    animation-delay: 1.5s;
    background-color: rgba(249, 115, 22, 0.4);
    box-shadow: 0 0 10px 2px rgba(249, 115, 22, 0.3);
}

.tech-dot:nth-child(10) {
    top: 75%;
    left: 30%;
    animation-delay: 2.5s;
    background-color: rgba(249, 115, 22, 0.4);
    box-shadow: 0 0 10px 2px rgba(249, 115, 22, 0.3);
}

.tech-dot:nth-child(11) {
    top: 85%;
    left: 70%;
    animation-delay: 3.5s;
}

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

.tech-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(147, 51, 234, 0.5), rgba(249, 115, 22, 0.5), transparent);
    width: 100%;
    animation: techLineScan 8s linear infinite;
    opacity: 0.2;
}

.tech-line:nth-child(1) {
    top: 20%;
    animation-delay: 0s;
}

.tech-line:nth-child(2) {
    top: 40%;
    animation-delay: 2s;
}

.tech-line:nth-child(3) {
    top: 60%;
    animation-delay: 4s;
}

.tech-line:nth-child(4) {
    top: 80%;
    animation-delay: 6s;
}

.tech-vertical-line {
    position: absolute;
    width: 1px;
    background: linear-gradient(0deg, transparent, rgba(147, 51, 234, 0.5), rgba(249, 115, 22, 0.5), transparent);
    height: 100%;
    animation: techVerticalLineScan 12s linear infinite;
    opacity: 0.2;
}

.tech-vertical-line:nth-child(5) {
    left: 25%;
    animation-delay: 1s;
}

.tech-vertical-line:nth-child(6) {
    left: 50%;
    animation-delay: 3s;
}

.tech-vertical-line:nth-child(7) {
    left: 75%;
    animation-delay: 5s;
}

@keyframes gridMove {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

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

@keyframes techVerticalLineScan {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

@keyframes gradientBackground {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes flareAnimation {
    0% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(0.8); }
}

@keyframes pulseRing {
    0% { width: 20px; height: 20px; opacity: 0; }
    20% { width: 20px; height: 20px; opacity: 0.3; }
    100% { width: 300px; height: 300px; opacity: 0; }
}

@keyframes pulseGlow {
    0% { opacity: 0.3; }
    50% { opacity: 0.7; }
    100% { opacity: 0.3; }
}

/* Data Streams */
.data-stream {
    position: absolute;
    width: 2px;
    background: linear-gradient(to bottom, transparent, rgba(147, 51, 234, 0.7), rgba(249, 115, 22, 0.7), transparent);
    opacity: 0.2;
    z-index: 0;
    animation: dataStream 3s linear infinite;
}

.data-stream:nth-child(16) {
    left: 10%;
    height: 150px;
    animation-delay: 0s;
}

.data-stream:nth-child(17) {
    left: 40%;
    height: 100px;
    animation-delay: 1s;
}

.data-stream:nth-child(18) {
    left: 70%;
    height: 180px;
    animation-delay: 2s;
}

.data-stream:nth-child(19) {
    left: 90%;
    height: 120px;
    animation-delay: 1.5s;
}

@keyframes dataStream {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(1000%); }
}

/* Avatar Background */
.avatar-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center; /* Changed from flex-start to center */
    z-index: 1;
}

.main-avatar {
    width: 100%; /* Changed to ensure 100% width on all screens */
    height: auto; /* Auto height to maintain aspect ratio */
    max-height: 100%; /* Ensure it doesn't exceed the screen height */
    object-fit: contain;
}

.status-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 10;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #10B981; /* Green */
    border-radius: 50%;
    margin-right: 8px;
}

.status-text {
    color: var(--white);
    font-weight: 500;
}



/* Chat Interface */
.chat-interface {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55%;
    display: flex;
    flex-direction: column;
    z-index: 2;
    background: transparent;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    padding-top: 20px;
    overflow: hidden;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px 60px 120px; /* Increased left/right padding and bottom padding */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-color) var(--dark-purple);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 20px;
}

.bot-message, .user-message {
    display: flex;
    margin-bottom: 20px;
    max-width: 85%;
    position: relative;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--secondary-color);
    margin-top: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    background-color: rgba(147, 51, 234, 0.85);
    border-radius: 22px;
    padding: 16px 22px;
    margin: 0 12px;
    color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    font-size: 1.1rem;
    backdrop-filter: blur(8px);
    position: relative;
    z-index: 1;
}

.user-message .message-content {
    background-color: rgba(249, 115, 22, 0.85);
}

/* Add a subtle glow effect to the messages */
.message-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 22px;
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.3);
    opacity: 0.5;
    z-index: -1;
}

.user-message .message-content::after {
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.3);
}

/* Action Buttons */
.action-buttons {
    position: absolute;
    bottom: 40px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 60px; /* Increased gap between buttons */
    z-index: 10;
}

.action-button {
    width: 105px; /* Increased by 50% from 70px */
    height: 105px; /* Increased by 50% from 70px */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.7rem; /* Increased by 50% from 1.8rem */
    background-color: var(--secondary-color);
    color: var(--white);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    border: 4px solid rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}

.action-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.action-button:active {
    transform: scale(0.95);
}

.voice-action {
    background-color: var(--secondary-color);
}

.chat-action {
    background-color: var(--light-purple);
}

/* Hidden Class */
.hidden {
    display: none !important;
}

/* Voice Feedback */
.voice-feedback {
    position: absolute;
    bottom: 160px; /* Adjusted to be just above the buttons */
    left: 50%;
    transform: translateX(-50%); /* Center horizontally */
    width: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center content vertically */
    text-align: center; /* Center text */
    color: var(--white);
    font-size: 1.2rem;
    font-weight: 500;
    z-index: 5;
    background-color: rgba(76, 29, 149, 0.6); /* Semi-transparent background */
    padding: 15px 0;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.voice-animation {
    display: flex;
    align-items: flex-end;
    height: 60px;
    margin-bottom: 15px;
}

.voice-wave {
    width: 8px;
    height: 20px;
    margin: 0 3px;
    border-radius: 4px;
    background-color: var(--secondary-color);
    animation: voice-wave-animation 1.2s infinite ease-in-out;
}

.voice-wave:nth-child(2) {
    animation-delay: 0.2s;
    height: 35px;
}

.voice-wave:nth-child(3) {
    animation-delay: 0.4s;
    height: 50px;
}

@keyframes voice-wave-animation {
    0% { height: 10px; }
    50% { height: 40px; }
    100% { height: 10px; }
}

/* Chat Input */
.chat-input {
    position: absolute;
    bottom: 160px; /* Adjusted to be just above the buttons */
    left: 0;
    width: 100%;
    padding: 0;
    z-index: 5;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
}

.input-container {
    display: flex;
    align-items: center;
    background-color: rgba(76, 29, 149, 0.6);
    border-radius: 20px;
    padding: 10px 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    width: 80%;
}

#message-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 15px 20px;
    color: var(--white);
    font-size: 1.2rem;
    outline: none;
}

#message-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Send Button */
.send-button {
    background-color: var(--secondary-color);
    color: var(--white);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    margin-right: 5px;
}

.send-button:hover {
    background-color: #E86C00;
    transform: scale(1.05);
}

/* Loading Animation */
.loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid var(--secondary-color);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Voice Animation */
.pulsating {
    animation: pulse 1.5s infinite;
}

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

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    margin: 10px 0;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: var(--white);
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: typing 1.5s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

/* Responsive adjustments for vertical screens */
@media (min-height: 800px) {
    .main-avatar {
        /*width: 85%;*/
    }
    
    .bot-message, .user-message {
        max-width: 75%;
    }
    
    .message-content {
        font-size: 1.2rem;
    }
    
    .chat-interface {
        height: 50%;
    }
    
    .action-button {
        width: 120px;
        height: 120px;
        font-size: 3rem;
    }
    
    .voice-feedback {
        bottom: 200px;
    }
    
    .chat-input {
        bottom: 200px;
    }
}

@media (min-height: 1200px) {
    .main-avatar {
        /*width: 80%;*/
    }
    
    .chat-interface {
        height: 45%;
    }
    
    .message-content {
        font-size: 1.4rem;
        padding: 18px 24px;
    }
    
    .avatar {
        width: 50px;
        height: 50px;
    }
    
    #message-input {
        font-size: 1.3rem;
        padding: 16px 24px;
    }
    
    .send-button {
        width: 54px;
        height: 54px;
        font-size: 1.4rem;
    }
    
    .action-button {
        width: 135px;
        height: 135px;
        font-size: 3.3rem;
        border-width: 5px;
    }
    
    .action-buttons {
        bottom: 50px;
        gap: 90px;
    }
    
    .voice-feedback {
        bottom: 250px;
        font-size: 1.6rem;
        max-width: 70%;
        padding: 20px 0;
    }
    
    .chat-input {
        bottom: 250px;
    }
    
    .input-container {
        width: 70%;
        padding: 15px 20px;
    }
}

/* For very large screens like TVs */
@media (min-height: 1800px) {
    .main-avatar {
        /*width: 75%;*/
    }
    
    .chat-interface {
        height: 40%;
        border-top-left-radius: 40px;
        border-top-right-radius: 40px;
    }
    
    .chat-messages {
        padding: 40px 60px 140px;
    }
    
    .message-content {
        font-size: 1.8rem;
        padding: 24px 30px;
    }
    
    .avatar {
        width: 70px;
        height: 70px;
    }
    
    .action-button {
        width: 180px;
        height: 180px;
        font-size: 4.5rem;
        border-width: 6px;
    }
    
    .action-buttons {
        bottom: 80px;
        gap: 120px;
    }
    
    .voice-feedback {
        bottom: 300px;
        font-size: 1.8rem;
        max-width: 60%;
        padding: 25px 0;
        border-radius: 30px;
    }
    
    .voice-animation {
        height: 80px;
    }
    
    .voice-wave {
        width: 12px;
        margin: 0 5px;
    }
    
    .chat-input {
        bottom: 300px;
    }
    
    .input-container {
        width: 60%;
        padding: 20px 25px;
        border-radius: 30px;
    }
    
    #message-input {
        font-size: 1.8rem;
        padding: 20px 30px;
    }
    
    .send-button {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
}
