/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Ubuntu", sans-serif;
}

body {
    background-image: url("back.jpg");
    background-size: 100%;
    background-repeat: none;
    color: #333;
    overflow-x: hidden;
    position: relative;
    /* Ensure footer aligns correctly */
    display: flex;
    flex-direction: column;
}
html{
      -webkit-text-size-adjust: 100%;
}

/* Header Section */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: rgba(255, 255, 255, 0.027);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.logo-icon {
    height: 30px;
    width: auto;
    /* Placeholder fallback styling */
    display: block;
}

/* Hero Section (Welcome State) */
.hero-section {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
    max-width: 600px;
}

/* Container */
.hero-greeting {
  font-size: 3rem;
  color: white;
  margin-bottom: 0.5rem;
  font-weight: 400;

  position: relative;
  height: 1.3em;

  display: flex;
  justify-content: center;
  align-items: center;

  overflow: hidden;
}

/* Animated text */
.greeting-text {
  position: absolute;
  width: 100%;
  text-align: center;

  opacity: 0;

  animation: textCycle 6s infinite ease-in-out;

  will-change: opacity, transform, filter;
  transform: translate3d(0, 10px, 0) scale(0.98);

  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Timing */
.greeting-text:nth-child(1) {
  animation-delay: 0s;
}

.greeting-text:nth-child(2) {
  animation-delay: 3s;
}

/* Keyframes with subtle blur */
@keyframes textCycle {
  0%, 100% {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.98);
    filter: blur(1px);
  }

  15%, 45% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0px);
  }

  60% {
    opacity: 0;
    transform: translate3d(0, -8px, 0) scale(0.98);
    filter: blur(.5px);
  }
}

.hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

/* Main Chat Area */
.chat-container {
    flex: 1;
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    padding: 80px 1rem 140px;
    /* Top padding for header, Bottom for footer */
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

/* Chat Bubbles */
.message-bubble {
    padding: 12px 20px;
    border-radius: 16px;
    font-size: 1rem;
    line-height: 1.5;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User Bubble (Right) */
.user-bubble {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.9);
    border-bottom-right-radius: 4px;
    color: #1a202c;
}

/* Archie Bubble (Left - Red) */
.archie-bubble {
    align-self: flex-start;
    background: #b7caff;
    font-weight: 450;
    border-bottom-left-radius: 4px;
    color: #05194e;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Markdown Styling within Archie Bubble */
.archie-bubble p {
    margin-bottom: 10px;
}

.archie-bubble p:last-child {
    margin-bottom: 0;
}

.archie-bubble ul,
.archie-bubble ol {
    padding-left: 20px;
    margin-bottom: 10px;
}

.archie-bubble li {
    margin-bottom: 8px;
}

.archie-bubble h1,
.archie-bubble h2,
.archie-bubble h3,
.archie-bubble h4,
.archie-bubble h5,
.archie-bubble h6 {
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
}

.archie-bubble h1 {
    font-size: 1.4rem;
}

.archie-bubble h2 {
    font-size: 1.3rem;
}

.archie-bubble h3 {
    font-size: 1.2rem;
}

.archie-bubble strong {
    font-weight: 700;
}

.archie-bubble em {
    font-style: italic;
}

.archie-bubble code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.archie-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 10px;
}

.archie-bubble pre code {
    background: transparent;
    padding: 0;
}

/* Loading Pulse Indicator */
.loading-pulse {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 10px;
    margin-top: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    animation: pulseFade 1.5s infinite ease-in-out;
}

.hidden {
    display: none !important;
}

@keyframes pulseFade {
    0% {
        opacity: 1;
    }
    
    50% {
        opacity: 0.4;
    }
    
    100% {
        opacity: 1;
    }
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: white;
    border-radius: 50%;
    display: inline-block;
}

/* Footer / Input Area */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.1rem 1rem 1rem;
    /* Slightly more top padding for the fade */
    z-index: 100;
    /* Dark semi-transparent blurred overlay as requested */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 40%, rgba(0, 0, 0, 0.8) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.input-area {
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50px;
    /* Pill shape */
    padding: 8px 16px;
    display: flex;
    align-items: flex-end;
    /* Align bottom for multiline */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 10px;
    font-size: 1rem;
    resize: none;
    max-height: 120px;
    color: #2d3748;
    min-height: 48px;
    /* Center text vertically for single line */
    line-height: 1.5;
}

.message-input::placeholder {
    color: #718096;
}

.send-btn {
    background: #0a2365;
    /* Deep/Slate Blue */
    color: white;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 10px;
    flex-shrink: 0;
    margin-bottom: 3px;
    /* Align slightly with input text bottom */
}

.send-btn:hover {
    background: #2d3748;
}

.sub-footer {
    text-align: center;
    padding-top: 10px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.sub-footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.sub-footer a:hover {
    text-decoration: underline;
}

.separator {
    margin: 0 0.5rem;
    opacity: 0.5;
}

/* Responsive Desgin */
@media (max-width: 768px) {
    .chat-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .hero-greeting {
        font-size: 2rem;
    }
    
    .input-area {
        border-radius: 24px;
        /* Slightly less rounded on mobile if preferred, or keep 50px */
        width: 100%;
    }
    
    .app-footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}