/* --------------------------------------------------------------------------
   DESIGN SYSTEM & VARIABLES
   -------------------------------------------------------------------------- */
:root {
    --bg-dark: hsl(220, 20%, 5%);
    --card-bg: hsla(220, 15%, 10%, 0.7);
    --border-color: hsla(140, 20%, 50%, 0.15);
    --border-hover: hsla(140, 40%, 60%, 0.3);
    
    /* Elegant HSL Greens and Gold */
    --accent-emerald: hsl(150, 70%, 45%);
    --accent-glow: hsla(150, 70%, 45%, 0.2);
    --accent-gold: hsl(45, 80%, 55%);
    --text-primary: hsl(0, 0%, 95%);
    --text-secondary: hsl(220, 10%, 75%);
    --text-muted: hsl(220, 10%, 55%);
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
}

/* --------------------------------------------------------------------------
   BASE STYLES
   -------------------------------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background animated glow */
.background-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    filter: blur(80px);
    z-index: 1;
    pointer-events: none;
    animation: pulseGlow 15s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
    0% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    100% { opacity: 0.9; transform: translateX(-50%) scale(1.1); }
}

/* --------------------------------------------------------------------------
   LAYOUT & CONTAINER
   -------------------------------------------------------------------------- */
.app-container {
    width: 100%;
    max-width: 580px;
    padding: 24px;
    margin-top: 40px;
    z-index: 10;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    padding: 40px;
    box-shadow: var(--shadow-premium);
    display: none;
    flex-direction: column;
    transition: var(--transition-smooth);
    animation: fadeIn 0.5s ease-out;
}

.card.active {
    display: flex;
}

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

/* --------------------------------------------------------------------------
   HEADER
   -------------------------------------------------------------------------- */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    font-size: 3rem;
    margin-bottom: 15px;
    display: inline-block;
    animation: floatLogo 4s infinite alternate ease-in-out;
}

@keyframes floatLogo {
    0% { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(-8px) rotate(3deg); }
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-emerald) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.subtitle {
    font-family: var(--font-heading);
    color: var(--accent-gold);
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 2px;
}

.intro-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 35px;
}

/* --------------------------------------------------------------------------
   FORM ELEMENTS
   -------------------------------------------------------------------------- */
#checkin-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    padding-left: 4px;
}

.input-group input,
.input-group textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 18px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    outline: none;
    width: 100%;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--accent-emerald);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 15px var(--accent-glow);
}

.input-group textarea {
    resize: none;
}

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, hsl(160, 80%, 35%) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary .arrow {
    transition: transform 0.3s ease;
}

.btn-primary:hover .arrow {
    transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   CHAT SCREEN
   -------------------------------------------------------------------------- */
.chat-header {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.chat-avatar {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-meta h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
}

.status-indicator {
    font-size: 0.75rem;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.status-indicator::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--accent-gold);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-gold);
}

.chat-messages {
    flex-grow: 1;
    min-height: 280px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
}

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

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

/* Chat bubble styling */
.bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.95rem;
    animation: bubbleFadeIn 0.3s ease-out;
}

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

.bubble.aspirant {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    align-self: flex-start;
    border-top-left-radius: 4px;
}

.bubble.guest {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, hsl(160, 80%, 30%) 100%);
    color: white;
    align-self: flex-end;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.bubble .timestamp {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
}

.bubble.guest .timestamp {
    color: rgba(255, 255, 255, 0.6);
}

/* Chat Input Area */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

#chat-message-input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    resize: none;
    min-height: 64px;
    max-height: 140px;
    transition: var(--transition-smooth);
}

#chat-message-input:focus {
    border-color: var(--accent-emerald);
    background: rgba(255, 255, 255, 0.05);
}

.btn-voice,
.btn-send {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.btn-voice:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.btn-voice.recording {
    background: hsl(0, 80%, 45%);
    color: white;
    border-color: hsl(0, 80%, 45%);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
    animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

.btn-send:hover {
    background: var(--accent-emerald);
    color: white;
    border-color: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* --------------------------------------------------------------------------
   WAIT/PENDING STATE OVERLAY
   -------------------------------------------------------------------------- */
.wait-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 20, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 100;
    transition: var(--transition-smooth);
}

.wait-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.wait-overlay p {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--accent-gold);
    letter-spacing: 0.5px;
    text-align: center;
    padding: 0 20px;
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
.app-footer {
    padding: 30px;
    text-align: center;
    z-index: 10;
}

.app-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   SESSION RESUMPTION & SECONDARY BUTTONS
   -------------------------------------------------------------------------- */
.resume-session-container {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.resume-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.resume-text a {
    color: var(--accent-emerald);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.resume-text a:hover {
    color: var(--accent-gold);
    text-shadow: 0 0 8px var(--accent-glow);
}

.resume-input-area {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    animation: fadeIn 0.35s ease-out;
}

.resume-input-area.hidden {
    display: none;
}

.resume-input-area input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
}

.resume-input-area input:focus {
    border-color: var(--accent-emerald);
    background: rgba(255, 255, 255, 0.04);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 16px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.btn-secondary:hover {
    background: var(--border-hover);
    border-color: var(--accent-emerald);
    color: white;
}

/* Chat Header Key Display */
.chat-key-info {
    margin-left: auto;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.key-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.key-value {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.key-value:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-gold);
    color: white;
}

/* --------------------------------------------------------------------------
   IMAGE ATTACHMENT & DISPLAY STYLES
   -------------------------------------------------------------------------- */
.btn-attach {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.btn-attach:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-emerald);
    border-color: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-glow);
}

.chat-image-container {
    margin-top: 8px;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-block;
}

.chat-image-container:hover {
    transform: scale(1.02);
    border-color: var(--accent-emerald);
    box-shadow: 0 0 15px var(--accent-glow);
}

.chat-image {
    max-width: 100%;
    max-height: 200px;
    display: block;
    object-fit: contain;
}

