/* Cosmic CSS - Ultra Modern Redesign */
:root {
    --cosmic-purple: #8b5cf6;
    --void-black: #0a0a0f;
    --nebula-blue: #3b82f6;
    --starlight: #f59e0b;
    --quantum-teal: #06d6a0;
    --dark-matter: #1e1b4b;
    --cosmic-pink: #ec4899;
    --energy-blue: #00d4ff;
    --cosmic-gradient: linear-gradient(135deg, #8b5cf6, #3b82f6, #06d6a0);
    --nebula-gradient: linear-gradient(45deg, #1e1b4b, #312e81, #1e40af);
    --energy-gradient: linear-gradient(90deg, #00d4ff, #ec4899, #8b5cf6);
    --header-height: 70px;
    --chat-input-height: 80px;
}

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

body {
    font-family: 'Exo 2', 'Segoe UI', system-ui, sans-serif;
    background: var(--void-black);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Cosmic Background Animations */
.cosmic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 4s infinite;
}

.star:nth-child(1) { top: 20%; left: 10%; width: 2px; height: 2px; animation-delay: 0s; }
.star:nth-child(2) { top: 60%; left: 80%; width: 3px; height: 3px; animation-delay: 1s; }
.star:nth-child(3) { top: 80%; left: 30%; width: 1px; height: 1px; animation-delay: 2s; }

.nebula {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    filter: blur(40px);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Access Gate Styles */
.access-body {
    background: linear-gradient(45deg, #000428, #004e92, #000428);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: 'Orbitron', sans-serif;
}

.access-container {
    text-align: center;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
}

.cosmic-gateway {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 3rem 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.cosmic-gateway::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: var(--energy-gradient);
    animation: rotate 10s linear infinite;
    opacity: 0.1;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.stargate {
    width: 120px;
    height: 120px;
    border: 3px solid var(--energy-blue);
    border-radius: 50%;
    margin: 0 auto 2rem;
    position: relative;
    animation: spin 20s linear infinite;
    box-shadow: 0 0 30px var(--energy-blue);
}

.stargate-inner {
    width: 80px;
    height: 80px;
    border: 2px solid var(--cosmic-pink);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: spin-reverse 15s linear infinite;
}

.energy-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ring {
    position: absolute;
    border: 1px solid;
    border-radius: 50%;
    animation: pulse 3s ease-in-out infinite;
}

.ring-1 { width: 100px; height: 100px; border-color: var(--energy-blue); animation-delay: 0s; }
.ring-2 { width: 80px; height: 80px; border-color: var(--cosmic-pink); animation-delay: 1s; }
.ring-3 { width: 60px; height: 60px; border-color: var(--quantum-teal); animation-delay: 2s; }

@keyframes pulse {
    0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.portal-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    background: var(--energy-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.portal-subtitle {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.access-form {
    margin: 2rem 0;
}

.input-container {
    position: relative;
    margin-bottom: 1.5rem;
}

#accessCode {
    width: 100%;
    padding: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1.2rem;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

#accessCode:focus {
    outline: none;
    border-color: var(--energy-blue);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.input-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    background: var(--energy-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

#accessCode:focus + .input-glow {
    opacity: 0.1;
}

.access-btn {
    position: relative;
    background: var(--cosmic-gradient);
    color: white;
    border: none;
    padding: 1.2rem 2.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.access-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(139, 92, 246, 0.4);
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.access-btn:hover .btn-glow {
    left: 100%;
}

/* Main App Styles */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: var(--nebula-gradient);
    padding: 1rem 2rem;
    position: relative;
    overflow: hidden;
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
}

.header-content h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    background: var(--energy-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.header-content p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    white-space: nowrap;
}

.header-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

/* Agents Grid */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.agent-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.agent-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    transition: left 0.6s;
}

.agent-card:hover::before {
    left: 100%;
}

.agent-card:hover {
    transform: translateY(-5px);
    border-color: var(--energy-blue);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.agent-avatar {
    position: relative;
    flex-shrink: 0;
}

.agent-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--energy-blue);
}

.avatar-fallback {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--cosmic-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid var(--energy-blue);
}

.online-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background: var(--quantum-teal);
    border-radius: 50%;
    border: 2px solid var(--void-black);
}

.agent-info {
    flex: 1;
}

.agent-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: white;
    font-weight: 600;
}

.agent-info p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.agent-stats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.agent-stats .stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.selection-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    background: var(--energy-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.agent-card:hover .selection-glow {
    opacity: 0.1;
}

/* Enhanced Chat Interface */
.chat-container {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    margin: 20px;
}

/* Compact Chat Header */
.chat-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 70px;
    flex-shrink: 0;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-2px);
}

.agent-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.header-avatar {
    position: relative;
    text-align: center;
    flex-shrink: 0;
}

.header-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--energy-blue);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--quantum-teal);
    margin-top: 0.2rem;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--quantum-teal);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.header-text {
    min-width: 0;
    flex: 1;
}

.header-text h2 {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
    background: var(--energy-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-text p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.export-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Fluid Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    min-height: 0;
}

.welcome-message {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid var(--energy-blue);
    margin-bottom: 1rem;
}

.welcome-avatar {
    font-size: 2rem;
    flex-shrink: 0;
}

.welcome-text h3 {
    margin-bottom: 0.5rem;
    color: white;
    font-size: 1.2rem;
}

.welcome-text p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    font-size: 0.95rem;
}

.message {
    display: flex;
    gap: 0.8rem;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

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

.user-message {
    margin-left: auto;
    flex-direction: row-reverse;
}

.agent-message {
    margin-right: auto;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--energy-blue);
}

.user-message .message-avatar {
    background: var(--cosmic-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
}

.message-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.2rem;
    border-radius: 18px;
    position: relative;
    flex: 1;
    min-width: 0;
}

.user-message .message-content {
    background: var(--cosmic-gradient);
    border-bottom-right-radius: 4px;
}

.agent-message .message-content {
    background: rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 4px;
    border-left: 3px solid var(--energy-blue);
}

.message-text {
    line-height: 1.5;
    color: white;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-text p {
    margin-bottom: 0.5rem;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message-content:hover .message-actions {
    opacity: 1;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Compact Chat Input */
.chat-input-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: 0.8rem;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 0.95rem;
    resize: none;
    min-height: 44px;
    max-height: 100px;
    font-family: inherit;
    transition: all 0.3s ease;
    line-height: 1.4;
}

#messageInput:focus {
    outline: none;
    border-color: var(--energy-blue);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

#messageInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.send-btn {
    background: var(--cosmic-gradient);
    border: none;
    color: white;
    padding: 0.8rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-features {
    margin-top: 0.5rem;
    text-align: center;
}

.feature-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.app-footer {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.8rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.app-footer p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.access-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.success {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.5);
    color: #86efac;
}

/* Streaming animation */
.streaming-cursor::after {
    content: '▊';
    animation: blink 1s infinite;
    color: var(--energy-blue);
    font-weight: bold;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Enhanced Responsive Design */
@media (max-width: 1200px) {
    .chat-container {
        margin: 15px;
        height: calc(100vh - 30px);
    }
    
    .agents-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 0.8rem 1rem;
        gap: 0.8rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .header-content h1 {
        font-size: 1.4rem;
    }
    
    .header-content p {
        font-size: 0.9rem;
    }
    
    .header-stats {
        gap: 0.5rem;
    }
    
    .stat {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .agents-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chat-container {
        margin: 10px;
        height: calc(100vh - 20px);
        border-radius: 16px;
    }
    
    .chat-header {
        padding: 0.6rem 1rem;
        gap: 0.8rem;
        flex-wrap: wrap;
    }
    
    .back-btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem;
    }
    
    .agent-header-info {
        order: -1;
        width: 100%;
        margin-bottom: 0.5rem;
        justify-content: flex-start;
    }
    
    .header-text h2 {
        font-size: 1.1rem;
    }
    
    .header-text p {
        font-size: 0.75rem;
    }
    
    .header-avatar img {
        width: 40px;
        height: 40px;
    }
    
    .chat-messages {
        padding: 1rem;
        gap: 1rem;
    }
    
    .message {
        max-width: 95%;
        gap: 0.6rem;
    }
    
    .message-content {
        padding: 0.8rem 1rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }
    
    .chat-input-container {
        padding: 0.8rem 1rem;
    }
    
    .input-wrapper {
        gap: 0.6rem;
    }
    
    #messageInput {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
        padding: 0.7rem;
    }
    
    .portal-title {
        font-size: 2rem;
    }
    
    .cosmic-gateway {
        padding: 2rem 1rem;
    }
}

@media (max-width: 480px) {
    .agent-card {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        gap: 0.8rem;
    }
    
    .agent-info {
        width: 100%;
    }
    
    .header-stats, .agent-stats {
        justify-content: center;
    }
    
    .stat {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }
    
    .chat-header {
        min-height: 60px;
    }
    
    .back-btn span.material-icons {
        font-size: 18px;
    }
    
    .export-btn span.material-icons {
        font-size: 18px;
    }
    
    .welcome-message {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.8rem;
    }
    
    .welcome-avatar {
        font-size: 1.8rem;
    }
    
    .welcome-text h3 {
        font-size: 1.1rem;
    }
    
    .welcome-text p {
        font-size: 0.9rem;
    }
}

@media (max-height: 700px) {
    .chat-container {
        height: calc(100vh - 10px);
        margin: 5px;
    }
    
    .chat-messages {
        padding: 1rem;
        gap: 0.8rem;
    }
    
    .message-content {
        padding: 0.7rem 1rem;
    }
    
    .chat-input-container {
        padding: 0.8rem 1rem;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--cosmic-pink);
}

/* Smooth scrolling */
.chat-messages {
    scroll-behavior: smooth;
}

/* Message selection */
.message-content {
    user-select: text;
}

/* Focus states for accessibility */
button:focus-visible,
#messageInput:focus-visible {
    outline: 2px solid var(--energy-blue);
    outline-offset: 2px;
}

/* Loading states */
.send-btn.loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .message-content {
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .agent-card {
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}
/* Enhanced Fluid Layout Improvements */

/* Fluid height calculations for better space utilization */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flex children to respect container bounds */
}

/* Improved chat area fluidity */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* Better message bubble sizing */
.message {
    max-width: min(85%, 800px);
}

.user-message {
    margin-left: auto;
}

.agent-message {
    margin-right: auto;
}

/* Improved text readability */
.message-text {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Compact but readable input area */
.chat-input-container {
    flex-shrink: 0;
}

/* Better header spacing */
.chat-header {
    flex-shrink: 0;
}

/* Responsive message padding */
@media (max-width: 768px) {
    .message {
        max-width: 92%;
    }
    
    .message-content {
        padding: 0.8rem 1rem;
    }
}

@media (max-width: 480px) {
    .message {
        max-width: 95%;
    }
    
    .message-content {
        padding: 0.7rem 0.9rem;
    }
}

/* Improved avatar sizing for different screens */
.message-avatar {
    width: clamp(32px, 4vw, 40px);
    height: clamp(32px, 4vw, 40px);
}

/* Better input field responsiveness */
#messageInput {
    min-height: clamp(44px, 6vh, 60px);
    max-height: clamp(80px, 20vh, 120px);
}

/* Enhanced header compactness */
.chat-header {
    padding: clamp(0.6rem, 2vh, 1rem) clamp(1rem, 3vw, 1.5rem);
}

/* Improved message gap spacing */
.chat-messages {
    gap: clamp(0.8rem, 2vh, 1.2rem);
}

/* Fluid typography scaling */
.message-text {
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

.header-text h2 {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
}

/* Better container margins */
.chat-container {
    margin: clamp(10px, 2vh, 20px);
}

/* Enhanced scrollbar visibility */
.chat-messages::-webkit-scrollbar {
    width: clamp(4px, 0.5vw, 6px);
}

/* Loading state improvements */
.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Focus management for better accessibility */
.message-content:focus-within .message-actions {
    opacity: 1;
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {
    .back-btn,
    .export-btn,
    .copy-btn,
    .send-btn {
        min-height: 44px; /* Apple HIG recommendation */
        min-width: 44px;
    }
    
    .message-actions {
        opacity: 1; /* Always show on mobile for easier access */
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .message {
        animation: none;
    }
}

/* High DPI screen optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .message-text {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print styles */
@media print {
    .chat-header,
    .chat-input-container {
        display: none;
    }
    
    .chat-messages {
        overflow: visible;
        height: auto;
    }
    
    .message {
        break-inside: avoid;
    }
}