@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Boilerplate */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(145deg, #050505, #0a0a0a, #070707);
    color: #cccccc; /* Softer grey for primary text */
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Container for Header with proper vertical spacing */
.container {
    width: 100%;
    min-height: 25vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding-top: 40px;
    padding-bottom: 20px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.container h1 {
    font-size: 8vw;
    background: linear-gradient(to right, #e0e0e0, #a0a0a0, #606060);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
    letter-spacing: -2.5px;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 0, 0, 0.4);
    animation: fadeInDown 1s ease-out;
    font-weight: 700;
}

.container h2 {
    font-size: 2.8vw;
    color: rgba(150, 150, 150, 0.9);
    font-weight: 300;
    opacity: 0.95;
    margin-bottom: 30px;
    letter-spacing: 0.8px;
    animation: fadeIn 1.5s ease-out;
}

/* Chat container */
.chatcont {
    flex-grow: 1;
    width: 90%;
    max-width: 900px;
    margin: 0 auto 140px auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 25px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 25px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(30, 30, 30, 0.5);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 80px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 1s ease-out;
}

/* Base styles for all chat messages (user and AI) */
.userchat,
.aichat {
    max-width: 70%;
    padding: 16px 22px;
    border-radius: 28px; /* Default large rounding, specific tails overridden below */
    color: #e0e0e0;
    font-size: 17px;
    line-height: 1.5;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
    word-break: break-word;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out, background-image 0.3s ease;
    position: relative;
    display: flex; /* Flex container for text content and copy button */
    flex-direction: column;
}

/* USER Message specific styles */
.userchat {
    align-self: flex-end;
    background-image: linear-gradient(to right bottom, #1a1a1a, #0d0d0d);
    border-radius: 28px 28px 8px 28px; /* More rounded, distinct tail */
}

.userchat:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.9);
    background-image: linear-gradient(to right bottom, #2a2a2a, #1a1a1a);
}

/* AI Message specific styles */
.aichat {
    align-self: flex-start;
    background-image: linear-gradient(to left top, #101010, #050505);
    border-radius: 28px 28px 28px 8px; /* More rounded, distinct tail */
}

.aichat:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.9), 0 0 20px rgba(15, 15, 15, 0.4);
    background-image: linear-gradient(to left top, #202020, #0a0a0a);
}

/* Style for the text content within chat messages to give space for button */
.chat-text-content {
    margin-bottom: 10px; /* Space between text and copy button */
}

/* Copy button specific styles */
.copy-button {
    align-self: flex-end; /* Align to the right within the chat bubble */
    background-color: transparent; /* Initially transparent */
    border: 1px solid rgba(50, 50, 50, 0.3); /* Subtle dark border */
    border-radius: 5px; /* Slightly rounded corners */
    padding: 6px 10px; /* Smaller padding */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Hidden by default */
    transform: translateY(5px); /* Start slightly below */
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    font-size: 14px;
    color: #cccccc;
    gap: 5px; /* Space between icon and text */
}

/* Hover effect for copy button when its parent chat bubble is hovered */
.userchat:hover .copy-button,
.aichat:hover .copy-button {
    opacity: 1; /* Fade in on chat hover */
    transform: translateY(0); /* Move into place */
    background-color: rgba(30, 30, 30, 0.6); /* Dark background on hover */
    border-color: rgba(70, 70, 70, 0.5); /* Slightly lighter border */
}

.copy-button:active {
    background-color: rgba(50, 50, 50, 0.8); /* Darker on click */
    transform: translateY(0) scale(0.98);
}

.copy-button svg {
    width: 16px; /* Icon size */
    height: 16px;
    filter: invert(0.8); /* Light grey icon */
}

.copy-button span {
    font-size: 12px;
}


/* Chat image (avatar/logo) - If you use it within the chat messages */
.chat-avatar {
    width: 45px; /* Slightly larger */
    height: 45px;
    object-fit: cover;
    border-radius: 50%;
    margin-right: 12px; /* Increased margin */
    flex-shrink: 0;
    border: 2px solid rgba(50, 50, 50, 0.4); /* Subtle dark border for avatar */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Deeper dark avatar shadow */
}

/* Prompt input area */
.prompt {
    width: 100%;
    height: 120px;
    position: fixed;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 20px;
    background: rgba(0, 0, 0, 0.85); /* Darker, more opaque background */
    backdrop-filter: blur(18px); /* Even stronger blur for a sleek look */
    border-top: 1px solid rgba(40, 40, 40, 0.4); /* Lighter, subtle dark border */
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.7); /* Deeper dark shadow for the fixed bar */
    z-index: 10;
}

#prompt {
    background: #0d0d0d; /* Very dark, integrated background */
    width: 75%; /* Wider prompt input */
    height: 60px; /* Optimal height */
    padding: 18px 25px;
    font-size: 18px;
    outline: none;
    border: none;
    border-radius: 30px; /* Sleeker rounding */
    color: #e0e0e0;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.3); /* More refined dark shadow */
    transition: all 0.4s ease; /* Smoother transitions */
}

#prompt:focus {
    box-shadow: inset 0 0 15px rgba(10, 10, 10, 0.8), 0 0 20px rgba(30, 30, 30, 0.6); /* More prominent, slightly glowing dark focus */
    background-color: #1a1a1a; /* Slightly lighter on focus */
    transform: translateY(-2px); /* Subtle lift on focus */
}

/* Upload Image Icon */
.upload-icon {
    margin-right: 18px; /* Increased margin */
    height: 58px; /* Slightly larger */
    width: 58px;
    background-color: #1a1a1a; /* Darker, more solid background for visibility */
    border: 1px solid rgba(40, 40, 40, 0.3); /* Subtle dark border */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); /* Deeper dark shadow */
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.upload-icon:hover {
    background-color: #2a2a2a; /* Lighter dark tint on hover */
    transform: translateY(-3px) scale(1.12); /* More pronounced lift and scale */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8); /* More glowing dark shadow on hover */
}

.upload-icon svg {
    width: 60%;
    height: 60%;
    object-fit: contain;
    filter: invert(0.9); /* Makes the SVG light grey */
}

/* Send Button */
#btn {
    margin-left: 18px; /* Increased margin */
    height: 60px; /* Matches prompt input height */
    width: 60px; /* Matches prompt input height */
    background-image: linear-gradient(to right top, #222222, #111111); /* Deeper dark grey gradient */
    border: 1px solid rgba(40, 40, 40, 0.3); /* Subtle dark border */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6); /* Initial dark shadow */
    transition: transform 0.3s ease, background-image 0.3s ease, box-shadow 0.3s ease;
}

#btn:hover {
    background-image: linear-gradient(to right top, #3a3a3a, #2a2a2a); /* Lighter dark gradient on hover */
    transform: translateY(-3px) scale(1.1); /* More pronounced lift and scale on hover */
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.9); /* Stronger, more diffuse dark shadow on hover */
}

#btn svg {
    width: 60%;
    height: 60%;
    object-fit: contain;
    filter: invert(0.9); /* Makes the SVG light grey */
}

/* Loader icon animation */
.load {
    margin-top: 10px;
    animation: pulse 1s infinite ease-in-out;
}

/* Scrollbar */
.chatcont::-webkit-scrollbar {
    width: 8px;
}
.chatcont::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #3a3a3a, #2a2a2a); /* Dark gradient scrollbar thumb */
    border-radius: 6px;
    border: 1px solid #1a1a1a;
}
.chatcont::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2); /* Slightly more visible dark track */
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.6; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    .container h1 {
        font-size: 10vw;
    }

    .container h2 {
        font-size: 4vw;
    }

    .chatcont {
        width: 95%;
        margin-bottom: 120px;
        padding: 20px;
    }

    .prompt {
        height: 100px;
        padding-bottom: 15px;
    }

    #prompt {
        width: 70%;
        height: 55px;
        padding: 15px 20px;
        font-size: 16px;
        border-radius: 28px;
    }

    .upload-icon {
        height: 50px;
        width: 50px;
        margin-right: 12px;
    }

    #btn {
        height: 55px;
        width: 55px;
        margin-left: 12px;
    }

    .userchat, .aichat {
        max-width: 90%;
        font-size: 15px;
        padding: 14px 20px;
    }

    .chat-avatar {
        width: 40px;
        height: 40px;
    }

    .copy-button {
        padding: 5px 8px;
        font-size: 13px;
    }

    .copy-button svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .container h1 {
        font-size: 12vw;
        letter-spacing: -1.5px;
    }

    .container h2 {
        font-size: 5vw;
        font-weight: 400;
    }

    .chatcont {
        width: 98%;
        padding: 15px;
        margin-bottom: 100px;
    }

    .prompt {
        height: 80px;
        padding-bottom: 10px;
    }

    #prompt {
        width: 65%;
        height: 48px;
        font-size: 14px;
        padding: 12px 18px;
        border-radius: 24px;
    }

    .upload-icon {
        height: 42px;
        width: 42px;
        margin-right: 10px;
    }

    #btn {
        height: 48px;
        width: 48px;
        margin-left: 10px;
    }

    .userchat, .aichat {
        font-size: 14px;
        padding: 12px 18px;
        border-radius: 24px 24px 6px 24px;
    }

    .copy-button {
        padding: 4px 7px;
        font-size: 12px;
    }

    .copy-button svg {
        width: 12px;
        height: 12px;
    }
}
