/* ===== COLOR SCHEME VARIABLES ===== */
:root {

    /* === BRAND COLORS === */
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --white-color: #ffffff;
    --blue-color: #007bff;
    
    /* === STATUS COLORS === */
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    
    /* === THEME COLORS === */
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --background-color: none;
    --surface-color: #1e1e1e;
    --border-color: #495057;
    
    /* === TEXT COLORS === */
    --text-color: #ffffff;
    --text-muted: white;
    
    /* === BOOTSTRAP OVERRIDE COLORS === */
    --bs-primary: #007bff;
    --bs-secondary: #6c757d;
    --bs-success: #28a745;
    --bs-danger: #dc3545;
    --bs-warning: #ffc107;
    --bs-info: #17a2b8;
    --bs-light: #f8f9fa;
    --bs-dark: #343a40;
    --bs-white: #ffffff;
    
    /* === BUTTON COLORS === */
    --btn-primary-bg: #007bff;
    --btn-primary-border: #007bff;
    --btn-primary-hover-bg: #0056b3;
    --btn-primary-hover-border: #004085;
    --btn-outline-primary-color: #007bff;
    --btn-outline-primary-border: #007bff;
    --btn-outline-primary-hover-bg: #007bff;
    --btn-outline-secondary-color: #6c757d;
    --btn-outline-secondary-border: #6c757d;
    --btn-outline-success-color: #28a745;
    --btn-outline-success-border: #28a745;
    --btn-outline-danger-color: #dc3545;
    --btn-outline-danger-border: #dc3545;
    
    /* === FORM COLORS === */
    --form-control-bg: var(--surface-color);
    --form-control-border: var(--border-color);
    --form-control-focus-border: var(--primary-color);
    --form-control-focus-shadow: rgba(0, 123, 255, 0.25);
    
    /* === ALERT COLORS === */
    --alert-success-bg: rgba(40, 167, 69, 0.1);
    --alert-success-border: rgba(40, 167, 69, 0.2);
    --alert-success-color: #155724;
    --alert-danger-bg: rgba(220, 53, 69, 0.1);
    --alert-danger-border: rgba(220, 53, 69, 0.2);
    --alert-danger-color: #721c24;
    --alert-info-bg: rgba(23, 162, 184, 0.1);
    --alert-info-border: rgba(23, 162, 184, 0.2);
    --alert-info-color: #0c5460;
    
    /* === PAGINATION COLORS === */
    --pagination-bg: var(--surface-color);
    --pagination-border: var(--border-color);
    --pagination-hover-bg: var(--dark-color);
    --pagination-active-bg: var(--primary-color);
    --pagination-active-border: var(--primary-color);
    
    /* === GRADIENTS === */
    --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --message-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* === CHAT SPECIFIC COLORS === */
    --chat-bubble-user: #007bff;
    --chat-bubble-bot: #6c757d;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scroll */
    -webkit-font-smoothing: antialiased; /* Better font rendering */
    -moz-osx-font-smoothing: grayscale;
}

/* html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
} */

/*/////////////////////////////////////////////////////////////////////////////*/
/*/////////////////////////////////////////////////////////////////////////////*/

/*Navigation Bar specific styles */
/*/////////////////////////////////////////////////////////////////////////////*/

/* Navigation Styles */
.navbar {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    position: relative;
    z-index: 1050;
    min-height: 56px; /* Ensure consistent navbar height */
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    text-decoration: none;
    color: inherit;
}

.navbar-toggler {
    display: block;
    background: none;
    border: 1px solid var(--white-color);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
}

.navbar-toggler-icon {
    display: block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

.navbar-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 8%;
    width: 200px;
    background-color: var(--dark-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    padding: 0.5rem;
    z-index: 1000;
}

.navbar-menu.show {
    display: flex;
}

.navbar-menu .nav-link {
    color: var(--white-color);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.navbar-menu .nav-link:last-child {
    border-bottom: none;
}

.navbar-menu .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/*/////////////////////////////////////////////////////////////////////////////*/
/*/////////////////////////////////////////////////////////////////////////////*/

/*Chat page specific styles */
/*/////////////////////////////////////////////////////////////////////////////*/

.chat-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent page bounce, but allow internal scrolling */
}

.chat-page .main-content {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Important for Firefox flex children */
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.chat-page .footer {
    display: none; /* Hide footer on chat page */
}

.chat-container {
    height: calc(100vh - 60px); /* Subtract navbar height */
    display: flex;
    flex-direction: column;
    background-color: var(--surface-color);
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    max-width: none;
}

.chat-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--background-color);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.message {
    margin-bottom: 20px;
    animation: slideIn 0.3s ease-out;
}

.message-content {
    display: flex;
    gap: 10px;
    max-width: 70%;
}

.user-message {
    justify-content: flex-end;
}

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

.bot-message .message-content {
    margin-right: auto;
}

.message-text {
    background-color: var(--surface-color);
    padding: 10px 15px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.user-message .message-text {
    background: var(--message-gradient);
    color: var(--white-color);
}

.message-text p {
    margin: 0;
    word-wrap: break-word;
}

.message-input {
    padding: 20px;
    border-top: none;
    background-color: var(--surface-color);
    border-radius: 0 0 10px 10px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.message-input .form-control {
    border-radius: 25px;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    color: var(--text-color);
    resize: none;
    overflow-y: hidden;
    min-height: 48px;
    transition: height 0.2s ease;
    padding: 10px;
}

.message-input .form-control:focus {
    background-color: var(--background-color);
    color: var(--text-color);
    border-color: var(--primary-color);
    box-shadow: none;
}

.message-input .btn {
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty State Styles */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.empty-state i {
    opacity: 0.5;
}

/* Bot typing indicator styles */
.bot-typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color, #007bff);
    animation: typingAnimation 1.4s infinite ease-in-out;
}

/* Ensure the loading indicator has the same styling as bot messages */
#bot-loading-indicator {
    opacity: 0.8;
}

@keyframes typingAnimation {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-text {
    font-size: 0.9em;
    color: var(--text-muted, #6c757d);
    font-style: italic;
}

/*/////////////////////////////////////////////////////////////////////////////*/
/*/////////////////////////////////////////////////////////////////////////////*/


/*Profile page specific styles */
/*/////////////////////////////////////////////////////////////////////////////*/

/* Profile Styles */
.profile-header {
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-header h2 {
    margin-bottom: 10px;
}

/* Conversation Cards */
.conversations-section {
    padding: 20px 0;
}

.conversation-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.conversation-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.conversation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Card Header */
.card-header {
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.card-icon.complete {
    background-color: #6366f1;
    color: white;
}

.card-icon.active {
    background-color: #10b981;
    color: white;
}

.card-icon i {
    font-size: 12px;
}

.card-title-section {
    flex: 1;
    min-width: 0;
}

.card-title-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.card-title {
    color: var(--text-color);
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    word-break: break-word;
    flex: 1;
}

.edit-title-btn {
    padding: 4px;
    color: var(--text-muted);
    text-decoration: none;
    border: none;
    background: none;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.edit-title-btn:hover {
    color: var(--primary-color);
    opacity: 1;
}

.edit-title-form {
    margin-bottom: 4px;
}

.card-status {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

/* Card Actions */
.card-actions {
    padding: 12px 16px;
    display: flex;
    justify-content: space-evenly;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    min-width: 60px;
    text-decoration: none;
    font-size: 0.8rem;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    text-decoration: none;
}

.action-btn i {
    font-size: 16px;
}

.action-btn span {
    font-size: 11px;
    font-weight: 500;
}

/* Dropdown styling */
.dropdown .action-btn.dropdown-toggle {
    border: none;
    background: none;
}

.dropdown .action-btn.dropdown-toggle::after {
    display: none; /* Hide the default Bootstrap dropdown arrow */
}

.dropdown-menu {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 140px;
}

.dropdown-item {
    color: var(--text-color);
    font-size: 0.85rem;
    padding: 8px 12px;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.dropdown-item.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn:disabled:hover {
    background-color: transparent;
    color: var(--text-muted);
}



/* Legacy tile styles for backward compatibility */
.tile-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.tile-title-wrapper .tile-title {
    margin-bottom: 0;
}

.section-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.tile-conversation-actions {
    margin-top: 20px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.story-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.no-story {
    text-align: center;
    padding: 20px 0;
}

.no-story .btn {
    margin-top: 10px;
}

/* Story Styles */
.story-header {
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.story-header h2 {
    margin-bottom: 10px;
}

.story-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.story-content {
    line-height: 1.6;
    font-size: 1.1rem;
}

.story-content h1,
.story-content h2,
.story-content h3,
.story-content h4,
.story-content h5,
.story-content h6 {
    margin-top: 20px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.story-content p {
    margin-bottom: 15px;
}

.story-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: var(--text-muted);
}

/* Card Styles */
.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
}

.card-header {
    background-color: var(--dark-color);
    border-bottom: 1px solid var(--border-color);
}

/* Table Styles */
.table-dark {
    --bs-table-bg: var(--surface-color);
    --bs-table-border-color: var(--border-color);
}

/* Profile table column widths */
.profile-table {
    table-layout: fixed;
    width: 100%;
}

.profile-table th:nth-child(1),
.profile-table td:nth-child(1) {
    width: 40%; /* Title column */
}

.profile-table th:nth-child(2),
.profile-table td:nth-child(2) {
    width: 15%; /* Created column */
}

.profile-table th:nth-child(3),
.profile-table td:nth-child(3) {
    width: 25%; /* Story column */
    white-space: nowrap;
}

.profile-table th:nth-child(4),
.profile-table td:nth-child(4) {
    width: 20%; /* Actions column */
}

/* Story button group constraints */
.story-btn-group {
    width: 100%;
    max-width: 120px;
}

.story-btn-group .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
    white-space: nowrap;
}

/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-screen.show {
    opacity: 1;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 2rem;
}

.loading-spinner {
    margin-bottom: 1.5rem;
}

.loading-icon {
    color: var(--primary-color);
    animation: bookFloat 2s ease-in-out infinite;
}

.loading-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.loading-subtext {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
}

@keyframes bookFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Button Styles */
.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}





/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-gradient);
}

/* Footer Styles */
.footer {
    background-color: var(--dark-color);
    border-top: 1px solid var(--border-color);
}

/* Utility Classes */
.text-gradient {
    background: var(--background-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient {
    background: var(--background-gradient);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== BOOTSTRAP OVERRIDES ===== */

/* Button Styles */
.btn-primary {
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-border);
}

.btn-primary:hover {
    background-color: var(--btn-primary-hover-bg);
    border-color: var(--btn-primary-hover-border);
}

.btn-outline-primary {
    color: var(--btn-outline-primary-color);
    border-color: var(--btn-outline-primary-border);
}

.btn-outline-primary:hover {
    background-color: var(--btn-outline-primary-hover-bg);
    border-color: var(--btn-outline-primary-border);
    color: var(--white-color);
}

.btn-outline-secondary {
    color: var(--btn-outline-secondary-color);
    border-color: var(--btn-outline-secondary-border);
}

.btn-outline-success {
    color: var(--btn-outline-success-color);
    border-color: var(--btn-outline-success-border);
}

.btn-outline-danger {
    color: var(--btn-outline-danger-color);
    border-color: var(--btn-outline-danger-border);
}

/* Alert Styles */
.alert-success {
    background-color: var(--alert-success-bg);
    border-color: var(--alert-success-border);
    color: var(--alert-success-color);
}

.alert-danger {
    background-color: var(--alert-danger-bg);
    border-color: var(--alert-danger-border);
    color: var(--alert-danger-color);
}

.alert-info {
    background-color: var(--alert-info-bg);
    border-color: var(--alert-info-border);
    color: var(--alert-info-color);
}

/* Form Styles */
.form-control {
    background-color: var(--form-control-bg);
    border-color: var(--form-control-border);
    color: var(--text-color);
}

.form-control:focus {
    background-color: var(--form-control-bg);
    border-color: var(--form-control-focus-border);
    color: var(--text-color);
    box-shadow: 0 0 0 0.2rem var(--form-control-focus-shadow);
}

/* Pagination Styles */
.pagination .page-link {
    background-color: var(--pagination-bg);
    border-color: var(--pagination-border);
    color: var(--text-color);
}

.pagination .page-link:hover {
    background-color: var(--pagination-hover-bg);
    border-color: var(--pagination-border);
    color: var(--text-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--pagination-active-bg);
    border-color: var(--pagination-active-border);
    color: var(--white-color);
}

/* Text Color Utilities */
.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Background Color Utilities */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-dark {
    background-color: var(--dark-color) !important;
}

/* Focus Styles */
.btn:focus {
    box-shadow: 0 0 0 0.2rem var(--form-control-focus-shadow);
}

/* ===== MODAL STYLES ===== */
.modal-content {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

.modal-title {
    color: var(--text-color);
}

.modal-body {
    color: var(--text-color);
}

/* ===== CENTERED FLASH MESSAGES ===== */
.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.flash-container {
    max-width: 500px;
    width: 90%;
    margin: 0 auto;
}

.flash-overlay .alert {
    background-color: var(--surface-color);
    border: 2px solid;
    border-radius: 15px;
    padding: 2rem;
    margin: 0;
    position: relative;
    animation: flashSlideIn 0.3s ease-out;
}

.flash-overlay .alert-success {
    border-color: var(--success-color);
    color: var(--success-color);
}

.flash-overlay .alert-danger {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.flash-overlay .alert-info {
    border-color: var(--info-color);
    color: var(--info-color);
}

.flash-overlay .alert h5 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.flash-overlay .alert i {
    display: block;
    margin: 0 auto;
}

.flash-overlay .btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: currentColor;
    opacity: 0.8;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flash-overlay .btn-close:hover {
    opacity: 1;
}

/* Flash message animation */
@keyframes flashSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Auto-hide flash messages after 5 seconds */
.flash-overlay {
    animation: flashFadeOut 0.3s ease-in 0.7s forwards;
}

@keyframes flashFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        visibility: hidden;
    }
}


.main-content {
    flex: 1;
    padding: 20px 0;
    width: 100%;
    min-height: 0; /* Firefox flexbox fix */
}


.new-conversation-container {
    /* min-height: calc(100vh - 240px); */
    height: calc(100vh - 240px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.welcome-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.welcome-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.new-conversation-form {
    width: 100%;
}

.initial-message-input {
    font-size: 1.1rem;
    padding: 1rem;
    border-radius: 12px;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.initial-message-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.suggestions-section {
    margin-top: 2rem;
}

.suggestions-label {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.suggestion-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.suggestion-btn {
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.suggestion-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white-color);
    transform: translateY(-2px);
}

.form-actions {
    text-align: center;
    margin-top: 2rem;
}

.start-btn {
    padding: 0.75rem 3rem;
    font-size: 1.1rem;
    border-radius: 30px;
    background-color: var(--primary-color);
    border: none;
    transition: all 0.3s ease;
}

.start-btn:hover {
    background-color: var(--btn-primary-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .welcome-title {
        font-size: 2rem;
    }

    .welcome-subtitle {
        font-size: 1.1rem;
    }

    .suggestion-buttons {
        flex-direction: column;
        width: 100%;
    }

    .suggestion-btn {
        width: 100%;
    }
    .welcome-section {
        margin-bottom: .1rem;
        padding-top: 8rem;
    }
}


/*/////////////////////////////////////////////////////////////////////////////*/
/*/////////////////////////////////////////////////////////////////////////////*/

/* Mobile Optimization */
/*/////////////////////////////////////////////////////////////////////////////*/

/* Resize Conversation Cards */
@media (max-width: 768px) {
    .conversation-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }
/*///////////////////////////*/

/* Modify Chat Header */

    .chat-header {
       flex-direction: column;
       align-items: center; /* Change to center */
       gap: 10px;
       max-width: none;
       margin-top: 0;
       padding: 8px 15px;
       min-height: 44px;
       position: fixed;
       top: 70px; /* Below the navbar */
       left: 0;
       right: 0;
       z-index: 100;
       background-color: var(--surface-color);
       border-bottom: 1px solid var(--border-color);
    }

    .chat-header h4 {
       display: none;
    }
    .welcome-section p {
       display: none;
     }

    .chat-page {
        height: 100vh; /* Use full viewport height */
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        position: relative;
        display: flex;
        overflow: hidden; /* Prevent outer overflow */
    }

    .chat-actions {
       width: 100%;
       display: flex;
       justify-content: center; /* Change to center */
    }

    .chat-actions form {
       margin: 0; /* Remove auto margin */
    }

    .chat-header .btn {
       padding: 0.25rem 0.5rem;
       font-size: 0.75rem;
    }

    .messages-container {
        flex: 1;
        overflow-y: auto; /* Allow scrolling only in the messages area */
        padding: 20px;
        padding-top: 130px; /* Space for navbar (70px) + chat header (44px) + extra padding */
        padding-bottom: 130px; /* Space for fixed input at bottom */
        background-color: var(--background-color);
        min-height: 0; /* Firefox flexbox fix */
    }

    
    .message-input {
        padding: 15px; /* Adjust padding */
        border-top: 1px solid var(--border-color); /* Change the border style */
        background-color: var(--surface-color); /* Change background color */
        border-radius: 0; /* Adjust border radius */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Add a subtle shadow */
        width: 100%; /* Maintain max width */
        margin: 0; /* Remove auto margin to fix gap */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        /* Use safe area insets for devices with home indicators */
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }

    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1050;
        background-color: var(--dark-color) !important;
        min-height: 70px;
        padding: 0.75rem 0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .chat-page .main-content {
        padding-top: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .chat-container {
        height: 100vh;
        margin-top: 0;
        padding-top: 70px; /* Space for fixed navbar */
        padding-bottom: 0;
        display: flex;
        flex-direction: column;
    }

    .profile-header {
        padding-top: 70px;
        padding-bottom: 0;
    }

    .conversations-section {
        padding-top: 0;
    }

    /* Mobile optimization for /new page */
    .new-conversation-container {
        height: auto; /* Remove fixed height constraint */
        min-height: calc(100vh - 70px); /* Account for fixed navbar */
        padding: 1rem;
        padding-top: 90px; /* Space for fixed navbar + breathing room */
        justify-content: flex-start; /* Start from top instead of center */
    }

    .welcome-section {
        margin-bottom: 2rem;
        padding-top: 0; /* Remove excessive top padding */
    }

    .welcome-title {
        font-size: 2rem; /* Slightly smaller on mobile */
    }

    .welcome-subtitle {
        display: block !important; /* Override the hide rule for mobile */
        font-size: 1rem;
    }

    .initial-message-input {
        font-size: 1rem; /* Slightly smaller on mobile */
        padding: 0.75rem;
    }

    .suggestion-buttons {
        gap: 0.5rem;
    }

    .suggestion-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}