* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Orbitron', sans-serif;
}

body {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(rgba(44, 62, 80, 0.8), rgba(44, 62, 80, 0.8)), url('https://i.ibb.co/przSTLNS/background.jpg') no-repeat center center fixed;
    background-size: cover;
    color: #ecf0f1;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 15px;
}

.form-container {
    width: 100%;
    max-width: 400px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.form-container h2 {
    margin-bottom: 20px;
    color: #ffffff;
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.form-container input {
    width: 100%;
    margin: 10px 0;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-container input:focus {
    border-color: #007bff;
}

.form-container button {
    width: 100%;
    padding: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    transition: background 0.3s ease, transform 0.2s ease;
}

.form-container button:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

.message {
    text-align: center;
    color: #ff3333;
    margin-top: 10px;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
}

.toggle-link {
    text-align: center;
    margin-top: 20px;
    cursor: pointer;
    color: #007bff;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    transition: color 0.3s ease;
}

.toggle-link:hover {
    color: #0056b3;
}

.hidden {
    display: none;
}

.container {
    width: 100%;
    padding: 15px;
    background: rgba(44, 62, 80, 0.9);
    text-align: center;
    border-bottom: 1px solid rgba(236, 240, 241, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.container h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    color: #ecf0f1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-container {
    flex: 1;
    width: 100%;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: linear-gradient(rgba(44, 62, 80, 0.85), rgba(44, 62, 80, 0.85)), url('https://i.ibb.co/Y4zwq2qh/background2.jpg') no-repeat center center;
    background-size: 100% 100%;
    -webkit-overflow-scrolling: touch;
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(236, 240, 241, 0.3);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.user-chat-box, .ai-chat-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 70%;
    animation: slideIn 0.3s ease-out;
}

.user-chat-box {
    margin-left: auto;
    flex-direction: row-reverse;
}

.ai-chat-box {
    margin-right: auto;
}

.user-chat-area, .ai-chat-area {
    padding: 12px 18px;
    border-radius: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-size: clamp(0.875rem, 2vw, 1rem);
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.user-chat-area {
    background: #000000;
    color: #ffffff;
    border-radius: 15px 15px 0 15px;
}

.ai-chat-area {
    background: #5d6d7e;
    color: #ffffff;
    border-radius: 15px 15px 15px 0;
}

#userImage, #aiImage {
    width: clamp(70px, 5vw, 50px);
    height: clamp(70px, 5vw, 50px);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

.chat-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    margin-top: 10px;
    object-fit: contain;
}

.prompt-area {
    width: 100%;
    padding: 15px;
    background: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    border-top: 1px solid rgba(236, 240, 241, 0.1);
}

.prompt-area input {
    flex: 1;
    padding: 12px 20px;
    background: #000000;
    border: none;
    border-radius: 20px;
    color: #bdc3c7;
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    outline: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    max-width: 70%;
}

.prompt-area input::placeholder {
    color: #bdc3c7;
}

.prompt-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #000000;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.prompt-button:hover {
    background: #333333;
    transform: scale(1.1);
}

.prompt-button img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

#image-preview.choose {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.loading-dots {
    display: flex;
    gap: 5px;
}

.loading-dots span {
    width: clamp(8px, 1.5vw, 10px);
    height: clamp(8px, 1.5vw, 10px);
    background: #ffffff;
    border-radius: 50%;
    animation: dots 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dots {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.logout-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: #ff3333;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    transition: background 0.3s ease, transform 0.2s ease;
    z-index: 1000;
}

.logout-btn:hover {
    background: #cc0000;
    transform: translateY(-2px);
}

footer {
    padding: 10px;
    text-align: center;
    background: #2c3e50;
    color: #ecf0f1;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
}

footer span {
    color: #e74c3c;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1024px) {
    .user-chat-box, .ai-chat-box {
        max-width: 85%;
    }

    .prompt-area input {
        max-width: 65%;
    }
}

@media (max-width: 768px) {
    .form-container {
        padding: 20px;
    }

    .user-chat-box, .ai-chat-box {
        max-width: 90%;
    }

    .prompt-area {
        padding: 10px;
    }

    .prompt-area input {
        max-width: 60%;
    }

    .prompt-button {
        width: 40px;
        height: 40px;
    }

    .prompt-button img {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .form-container {
        max-width: 90%;
        padding: 15px;
    }

    .container h1 {
        font-size: clamp(1.2rem, 5vw, 1.5rem);
    }

    .user-chat-box, .ai-chat-box {
        max-width: 95%;
    }

    .prompt-area {
        gap: 5px;
    }

    .prompt-area input {
        max-width: 50%;
    }

    .prompt-button {
        width: 35px;
        height: 35px;
    }

    .prompt-button img {
        width: 18px;
        height: 18px;
    }

    .logout-btn {
        top: 10px;
        right: 10px;
        padding: 8px 15px;
    }
}