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

:root {
    /* Main Colors */
    --base-deep-navy: #0B1D3A;
    --primary-royal-blue: #1E3A8A;
    --accent-cyan: #06B6D4;

    /* Supporting Colors */
    --neutral-soft-gray: #E5E7EB;
    --text-off-white: #F9FAFB;
    --cta-gold: #FBBF24;
    --cta-hover-gold: #e0ac20;
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    /* CORRECTED FOR MOBILE: Reduced bottom padding to 40px */
    padding: 0 0 40px 0; 
    height: 100vh;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-off-white);
    background-color: var(--base-deep-navy);
    background-image: 
        radial-gradient(at 20% 25%, hsla(222, 64%, 32%, 0.3) 0px, transparent 50%),
        radial-gradient(at 80% 85%, hsla(190, 95%, 43%, 0.2) 0px, transparent 50%);
    overflow: hidden;
}

.hidden { display: none !important; }

/* --- Universal Glass Card Style --- */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border-radius: 24px;
}

/* --- Welcome Screen Styles --- */
#welcome-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out;
    padding: 1rem;
    box-sizing: border-box;
}

.welcome-card {
    padding: 2rem;
    text-align: center;
    max-width: 500px;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.logo {
    width: auto;
    height: 80px;
    margin-bottom: 1.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.welcome-title {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    font-size: 2rem;
    color: var(--cta-gold);
}

.welcome-card p {
    color: var(--neutral-soft-gray);
    margin: 0 0 2.5rem 0;
    line-height: 1.6;
}

#start-btn {
    background: var(--cta-gold);
    color: var(--base-deep-navy);
    border: none;
    border-radius: 14px;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#start-btn:hover {
    background: var(--cta-hover-gold);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.3);
}

/* --- Chat Container Styles --- */
.chat-container {
    width: 100%;
    max-width: 800px;
    height: 100%; 
    box-sizing: border-box; 
    padding: 1rem; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    text-align: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid;
    border-image: linear-gradient(to right, transparent, var(--glass-border), transparent) 1;
    flex-shrink: 0;
}

.header-content { display: flex; justify-content: center; align-items: center; gap: 0.75rem; }
.header-logo { height: 32px; }
.header h1 { margin: 0; font-weight: 500; font-size: 1.5rem; color: var(--text-off-white); }
.header p { margin: 0.5rem 0 0; font-size: 0.9rem; color: var(--cta-gold); }
.chat-box { flex-grow: 1; padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }

.chat-message {
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    max-width: 85%;
    line-height: 1.6;
    animation: slideIn 0.4s ease-out;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    position: relative;
    word-wrap: break-word;
}

@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.user-message { background: rgba(30, 58, 138, 0.5); align-self: flex-end; border-bottom-right-radius: 4px; color: var(--text-off-white); }
.assistant-message { background: rgba(229, 231, 235, 0.2); align-self: flex-start; border-bottom-left-radius: 4px; padding-right: 40px; }

/* --- Chat Input Styles --- */
.chat-input-form { display: flex; align-items: center; padding: 1rem; gap: 0.8rem; border-top: 1px solid var(--glass-border); flex-shrink: 0; }
.input-container { flex-grow: 1; position: relative; }
#user-input { width: 100%; box-sizing: border-box; border: 1px solid rgba(251, 191, 36, 0.4); background: rgba(0, 0, 0, 0.2); border-radius: 12px; padding: 0.8rem 1.2rem; color: var(--text-off-white); font-size: 1rem; outline: none; transition: all 0.2s; }
#user-input:focus { border-color: var(--cta-gold); box-shadow: 0 0 15px rgba(251, 191, 36, 0.3); }
.button-container { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.button-container button { background: transparent; border: none; color: var(--cta-gold); padding: 0; width: 48px; height: 48px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.2s, color 0.2s; }
.button-container button:hover { transform: scale(1.2); }
.button-container .fa, .button-container .material-icons { font-size: 24px; vertical-align: middle; }

/* Stop Generating Button */
#stop-generating-container { text-align: center; padding-bottom: 0.5rem; }
#stop-generating-btn { background: var(--primary-royal-blue); color: var(--text-off-white); border: 1px solid var(--glass-border); border-radius: 8px; padding: 0.5rem 1rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem; }
#stop-generating-btn .material-icons { font-size: 20px; }
#stop-generating-btn:hover { background: rgba(30, 58, 138, 0.7); }

/* Copy & Speaker Buttons Container */
.message-actions {
    position: absolute;
    bottom: 8px;
    right: 10px;
    display: flex;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 2px 4px;
    opacity: 0; 
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

.assistant-message:hover .message-actions {
    opacity: 1; 
    visibility: visible;
}

.message-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    padding: 2px;
}

.message-actions button:hover {
    color: rgba(255, 255, 255, 1);
}

.message-actions .fa, .message-actions .material-icons {
    font-size: 16px;
}

/* Typing Animation Cursor */
.typing-cursor { display: inline-block; width: 8px; height: 1em; background-color: var(--cta-gold); animation: blink 1s step-end infinite; vertical-align: bottom; margin-left: 2px;}
@keyframes blink { from, to { background-color: transparent; } 50% { background-color: var(--cta-gold); } }

/* Voice Functionality */
#status-indicator { text-align: center; font-size: 0.9rem; color: var(--accent-cyan); padding: 0 1rem 0.5rem 1rem; opacity: 0; transition: opacity 0.3s ease-in-out; }
#status-indicator:not(.hidden) { opacity: 1; }
#mic-btn.listening .fa-microphone { color: var(--accent-cyan); animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* Custom scrollbar */
.chat-box::-webkit-scrollbar { width: 8px; }
.chat-box::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.2); border-radius: 20px; }

/*MOBILE RESPONSIVE DESIGN */
@media (min-width: 768px) {
    body {
    
        padding: 2rem 2rem 50px 2rem; 
    }
    .chat-container {
        height: 100%; 
        padding: 0; 
    }
    .welcome-card {
        padding: 3rem 4rem;
    }
    .welcome-title {
        font-size: 2.25rem;
    }
}

/*MOBILE CHAT HEIGHT*/
@media (max-width: 767px) {
  .chat-container {
  
    height: calc(100vh - 100px); 
    

    margin-top: 100px;  
    margin-bottom: 150px; 
    margin-left: 15px;   
    margin-right: 15px;  

    padding: 1rem;       
    box-sizing: border-box;
    overflow-y: auto;  
  }
}



/*Footer Credit Styles*/
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;

    padding: 10px 0;
    background-color: rgba(11, 29, 58, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: var(--neutral-soft-gray);
    text-align: center;
    font-size: 0.85em;
    z-index: 1000;
    border-top: 1px solid var(--glass-border);
}

footer p {
    margin: 0;
    padding: 0;
}

footer a {
    color: var(--cta-gold);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

footer a:hover {
    text-decoration: underline;
    color: var(--cta-hover-gold);
}