/*
Chat Size Consistency Fixes
This file resolves sizing conflicts between example chat view and new chat view
*/

/* Ensure consistent chat container sizing */
.chat-container {
    width: 100% !important;
    min-height: calc(100vh - 140px) !important;
    padding: 1.5rem !important;
    padding-bottom: 120px !important; /* Add extra bottom padding to prevent content hiding behind sticky input */
    overflow-y: auto !important;
}

/* Fix welcome message container to match chat view sizing */
.welcome-message {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.5rem 2rem !important;
}

/* Ensure consistent example card sizing */
.example-questions {
    max-width: 56rem !important; /* max-w-4xl equivalent */
    margin: 0 auto !important;
    width: 100% !important;
}

.example-card {
    height: 7rem !important; /* h-28 equivalent - 112px */
    min-height: 7rem !important;
    padding: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.75rem !important;
}

/* Fix message container consistency when chat starts */
.message-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Ensure user and bot messages have consistent spacing */
.user-message, .bot-message {
    margin-bottom: 1rem !important;
    padding: 0.75rem 1rem !important;
    max-width: 85% !important;
}

.user-message {
    margin-left: auto !important;
    margin-right: 0 !important;
}

.bot-message {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Fix input area consistency */
.input-area {
    width: 100% !important;
    padding: 1rem 1.5rem !important;
    position: sticky !important;
    bottom: 0 !important;
}

.input-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
}

/* Override any conflicting legacy styles */
.main-content {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
}

/* Ensure header stays consistent */
.header {
    width: 100% !important;
    padding: 0.5rem 0.75rem !important;
}

/* Fix sidebar width consistency */
.sidebar {
    width: 290px !important;
    flex-shrink: 0 !important;
}

/* Mobile responsiveness fixes */
@media (max-width: 768px) {
    .chat-container {
        padding: 1rem !important;
    }

    .welcome-message {
        padding: 1rem !important;
    }

    .example-questions {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .example-card {
        height: 6rem !important;
        min-height: 6rem !important;
    }

    .input-area {
        padding: 1rem !important;
    }

    /* MOBILE STICKY POSITIONING FIXES */
    /* Force header to stay at top on mobile */
    .header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 999 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-bottom: 1px solid rgba(16, 185, 129, 0.1) !important;
    }

    /* Force input area to stay at bottom on mobile */
    .input-area {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 998 !important;
        background: linear-gradient(to top, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 100%) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        padding: 1rem !important;
        margin: 0 !important;
    }

    /* Adjust chat container to account for fixed header and input */
    .chat-container {
        margin-top: 60px !important; /* Account for fixed header height */
        margin-bottom: 120px !important; /* Account for fixed input area height */
        min-height: calc(100vh - 180px) !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* Ensure main content doesn't interfere with fixed positioning */
    .main-content {
        position: relative !important;
        height: 100vh !important;
        overflow: hidden !important;
    }

    /* Make sure sidebar doesn't interfere on mobile */
    .sidebar {
        z-index: 1000 !important;
    }

    /* Prevent scroll issues on mobile */
    body {
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    .app-container {
        height: 100vh !important;
        overflow: hidden !important;
    }

    /* Ensure proper touch scrolling in chat area only */
    .chat-container {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
    }
}

/* Smooth transitions between states */
.chat-container, .welcome-message, .example-questions {
    transition: all 0.3s ease !important;
}

/* Fix any z-index issues */
.input-area {
    z-index: 10 !important;
}

.header {
    z-index: 20 !important;
}

/* Ensure proper scrolling behavior */
.chat-container {
    scroll-behavior: smooth !important;
}

/* Fix any overflow issues */
.main-content {
    overflow: hidden !important;
}

.chat-container {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
