/* Tailwind CSS Integration & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Custom Tailwind overrides for premium design */
.bg-gradient-premium {
    background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
}

.text-gradient-premium {
    background: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Custom animations for psychological triggers */
@keyframes pulse-gentle {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.animate-pulse-gentle {
    animation: pulse-gentle 2s ease-in-out infinite;
}

/* Subtle glass effects without heavy blur */
.glass-effect {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Premium button hover effects */
.btn-premium {
    background: linear-gradient(135deg, #FFD700, #FF8C00);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-premium:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}

/* Developer Settings Styling - Ensure proper visibility for form switches */
.form-check-input {
    width: 1.5em !important;
    height: 0.75em !important;
    margin-top: 0.25em !important;
    vertical-align: top !important;
    background-color: transparent !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    border: 1px solid #adb5bd !important;
    appearance: none !important;
    color-adjust: exact !important;
}

.form-check-input[type="checkbox"] {
    border-radius: 0.25em !important;
}

.form-check-input:checked {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
}

.form-switch .form-check-input {
    width: 2.5em !important;
    margin-left: -2.5em !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%2830, 30, 30, 0.25%29'/%3e%3c/svg%3e") !important;
    background-position: left center !important;
    border-radius: 2em !important;
    transition: background-position 0.15s ease-in-out !important;
}

.form-switch .form-check-input:checked {
    background-position: right center !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255, 255, 255, 1.0%29'/%3e%3c/svg%3e") !important;
}

/* Developer Settings styling - clean and professional */
#premiumAccessToggle {
    transition: all 0.2s ease !important;
}

/* Root variables for theme and text size */
:root {
    /* Light theme colors */
    --bg-primary: #f7f7f7;
    --bg-secondary: white;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #e9ecef;
    --shadow-color: rgba(0, 0, 0, 0.1);

    /* Text sizes */
    --font-size-base: 1rem;
    --font-size-sm: 0.875rem;
    --font-size-lg: 1.125rem;
}

/* Dark theme */
.dark-theme {
    --bg-primary: #2a3441;
    --bg-secondary: #364559;
    --text-primary: #ffffff;
    --text-secondary: #b8c5d6;
    --border-color: #4a5568;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* Personality Dropdown Styling */
.personality-dropdown {
    position: relative;
    z-index: 1050;
}

.personality-dropdown .dropdown-menu {
    min-width: min(450px, 90vw);
    max-width: min(500px, 95vw);
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px var(--shadow-color);
    background: var(--bg-secondary);
    padding: 0.5rem;
    z-index: 1060;
}

.personality-dropdown .dropdown-item {
    border: 2px solid transparent;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    padding: 0;
    background: none;
}

.personality-dropdown .dropdown-item:hover,
.personality-dropdown .dropdown-item:focus {
    background: none;
    border-color: #0d6efd;
}

.personality-dropdown .dropdown-item.active {
    background: none;
    border-color: #0d6efd;
}

.personality-option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    text-align: left;
    background: var(--bg-secondary);
    border: none;
    width: 100%;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.personality-option:hover {
    background: var(--bg-primary);
    transform: translateY(-1px);
}

.personality-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.personality-info {
    flex: 1;
    min-width: 0;
}

.personality-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.personality-tone {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.personality-bio {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.premium-badge {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #8b4513;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lock-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* Ensure proper dropdown positioning and layering */
.personality-dropdown .dropdown-menu {
    transform: translateY(0.5rem);
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0.5rem);
    }
}

/* Hide lock icons when subscribed */
.premium-lock-icon {
    transition: opacity 0.3s ease;
}

.subscribed .premium-lock-icon {
    opacity: 0;
}

/* Premium Upgrade Button Styling */
.premium-upgrade-btn {
    background: linear-gradient(45deg, #ffd700, #ffed4e) !important;
    border: none !important;
    color: #8b4513 !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3) !important;
    transition: all 0.3s ease !important;
    border-radius: 20px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.premium-upgrade-btn:hover {
    background: linear-gradient(45deg, #ffed4e, #ffd700) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4) !important;
    color: #8b4513 !important;
}

.premium-upgrade-btn:active {
    transform: translateY(0) !important;
}

/* Fix button height consistency */
.btn-sm {
    height: 32px !important;
    line-height: 1.2 !important;
    padding: 0.375rem 0.75rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Professional Header Layout */
.chat-header {
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Header Controls Container */
.header-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

/* Control Rows */
.controls-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.primary-row {
    justify-content: space-between;
    align-items: center;
}

.secondary-row {
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* Premium Upgrade Button - Prominent CTA */
.premium-upgrade-btn {
    background: linear-gradient(135deg, #ffd700, #ffed4e) !important;
    border: 2px solid #ffd700 !important;
    color: #8b4513 !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: 25px !important;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3) !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    min-width: fit-content !important;
}

.premium-upgrade-btn:hover {
    background: linear-gradient(135deg, #ffed4e, #ffd700) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4) !important;
}

/* Secondary Buttons */
.secondary-row .btn {
    font-size: 0.8rem !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 15px !important;
    transition: all 0.2s ease !important;
}

/* Tip Jar Button */
#tipJarButton {
    background: rgba(255, 193, 7, 0.1) !important;
    border: 1px solid #ffc107 !important;
    color: #8b4513 !important;
}

#tipJarButton:hover {
    background: rgba(255, 193, 7, 0.2) !important;
    border-color: #ffb302 !important;
    transform: translateY(-1px) !important;
}

/* Responsive Design */
@media (max-width: 992px) {
    .chat-header {
        padding: 1rem;
    }

    .premium-upgrade-btn {
        font-size: 0.85rem !important;
        padding: 0.6rem 1rem !important;
    }

    .secondary-row .btn {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.6rem !important;
    }
}

@media (max-width: 768px) {
    .primary-row {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    /* Mobile grid button layout - 3x3 grid */
    .flex.flex-col.items-center.gap-2 {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        grid-template-rows: auto auto auto !important;
        gap: 0.75rem !important;
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto !important;
    }

    /* First row: Jo dropdown, Tip, Share */
    .flex.flex-col.items-center.gap-2 .dropdown:first-child {
        grid-column: 1;
        grid-row: 1;
        width: 100% !important;
    }

    .flex.flex-col.items-center.gap-2 button[id="tipJarButton"] {
        grid-column: 2;
        grid-row: 1;
        width: 100% !important;
    }

    .flex.flex-col.items-center.gap-2 button[id="shareJoButton"] {
        grid-column: 3;
        grid-row: 1;
        width: 100% !important;
    }

    /* Second row: Settings, Delete, Key */
    .flex.flex-col.items-center.gap-2 button[id="settingsToggle"] {
        grid-column: 1;
        grid-row: 2;
        width: 100% !important;
    }

    .flex.flex-col.items-center.gap-2 button[onclick="clearChat()"] {
        grid-column: 2;
        grid-row: 2;
        width: 100% !important;
    }

    .flex.flex-col.items-center.gap-2 button[onclick="showApiKeyModal()"] {
        grid-column: 3;
        grid-row: 2;
        width: 100% !important;
    }

    .personality-dropdown {
        width: 100%;
        min-width: unset;
    }

    .premium-upgrade-btn {
        flex: 1;
        text-align: center !important;
        font-size: 0.75rem !important;
        padding: 0.5rem 0.75rem !important;
        min-height: 44px !important;
        white-space: nowrap;
    }

    .secondary-row {
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .secondary-row .btn {
        flex: 1;
        min-width: 60px;
        text-align: center;
        min-height: 44px !important;
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }

    /* New horizontal layout for mobile buttons */
    .flex.flex-col.sm\\:flex-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        width: 100% !important;
        align-items: center;
    }

    /* Personality dropdown takes more space */
    .flex.flex-col.sm\\:flex-row > .dropdown:first-child {
        flex: 2;
        min-width: 140px;
    }

    /* Other buttons in a compact row */
    .flex.flex-col.sm\\:flex-row > .position-relative,
    .flex.flex-col.sm\\:flex-row > button {
        flex: 1;
        min-width: 60px;
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
        text-align: center;
        min-height: 40px;
    }

    /* Make tip button more compact */
    .flex.flex-col.sm\\:flex-row > button#tipJarButton {
        font-size: 0.7rem;
        padding: 0.4rem 0.2rem;
        min-width: 50px;
    }

    /* Icon-only buttons */
    .flex.flex-col.sm\\:flex-row > button[id="settingsToggle"],
    .flex.flex-col.sm\\:flex-row > button[onclick="clearChat()"],
    .flex.flex-col.sm\\:flex-row > button[onclick="showApiKeyModal()"] {
        min-width: 44px;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .chat-header {
        padding: 0.75rem;
    }

    .header-controls {
        gap: 0.5rem;
    }

    .secondary-row {
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
        flex-wrap: wrap;
    }

    .secondary-row .btn {
        flex: 1;
        min-width: 50px;
        max-width: 80px;
        padding: 0.4rem 0.2rem !important;
        min-height: 40px !important;
        font-size: 0.7rem;
    }

    /* Keep horizontal layout even on very small screens */
    .flex.flex-col.sm\\:flex-row {
        gap: 0.25rem !important;
        flex-wrap: wrap !important;
    }

    .flex.flex-col.sm\\:flex-row > .dropdown:first-child {
        flex: 2;
        min-width: 120px;
    }

    .flex.flex-col.sm\\:flex-row > button,
    .flex.flex-col.sm\\:flex-row > .position-relative {
        flex: 1;
        min-width: 50px;
        font-size: 0.7rem !important;
        padding: 0.4rem 0.2rem !important;
    }

    /* Make tip button even more compact */
    .flex.flex-col.sm\\:flex-row > button#tipJarButton {
        font-size: 0.65rem;
        padding: 0.3rem 0.1rem;
        min-width: 45px;
    }

    /* Icon buttons */
    /* Mobile grid button styling */
    .flex.flex-col.items-center.gap-2 > button {
        min-height: 44px !important;
        font-size: 0.7rem !important;
        padding: 0.5rem 0.4rem !important;
        border-radius: 12px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.3rem !important;
    }

    /* Specific button styling for grid */
    .flex.flex-col.items-center.gap-2 button[id="tipJarButton"],
    .flex.flex-col.items-center.gap-2 button[id="shareJoButton"] {
        font-size: 0.65rem !important;
        padding: 0.5rem 0.3rem !important;
    }

    /* Icon-only buttons styling */
    .flex.flex-col.items-center.gap-2 button[id="settingsToggle"],
    .flex.flex-col.items-center.gap-2 button[onclick="clearChat()"],
    .flex.flex-col.items-center.gap-2 button[onclick="showApiKeyModal()"] {
        font-size: 0.8rem !important;
        padding: 0.5rem !important;
    }

    /* Personality dropdown in grid */
    .flex.flex-col.items-center.gap-2 .dropdown .btn {
        font-size: 0.65rem !important;
        padding: 0.5rem 0.4rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.3rem !important;
    }
}

/* Personality dropdown mobile improvements */
@media (max-width: 768px) {
    .personality-dropdown .dropdown-menu {
        min-width: min(300px, 85vw);
        max-width: min(350px, 90vw);
        padding: 0.75rem;
    }

    .personality-option {
        padding: 1rem;
        gap: 0.75rem;
        min-height: 70px;
        border-radius: 12px;
    }

    .personality-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    /* Improve text sizing in dropdown */
    .personality-name {
        font-size: 1rem;
        font-weight: 600;
    }

    .personality-tone {
        font-size: 0.875rem;
        line-height: 1.4;
    }

    .personality-bio {
        font-size: 0.8rem;
        line-height: 1.3;
    }
}

/* Text size variations */
.text-small {
    --font-size-base: 0.875rem;
    --font-size-sm: 0.75rem;
    --font-size-lg: 1rem;
}

.text-large {
    --font-size-base: 1.125rem;
    --font-size-sm: 1rem;
    --font-size-lg: 1.25rem;
}

/* iPad and tablet optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
    .personality-dropdown .dropdown-menu {
        min-width: 450px;
        max-width: 550px;
    }

    /* Better use of tablet space */
    .max-w-6xl {
        max-width: 90%;
    }

    .chat-messages {
        height: 550px;
    }

    /* Touch target improvements for tablet */
    .btn {
        min-height: 48px;
    }

    .personality-option {
        padding: 1.25rem;
        min-height: 80px;
    }
}

/* Large screen optimizations (1200px+) */
@media (min-width: 1200px) {
    .container-fluid {
        max-width: 1400px;
        margin: 0 auto;
    }

    .personality-dropdown .dropdown-menu {
        min-width: 500px;
        max-width: 600px;
    }

    .chat-messages {
        height: 600px;
    }

    /* Better desktop button sizing */
    .btn {
        min-height: 40px;
    }
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Extra small devices (320px - 480px) */
@media (max-width: 480px) {
    /* Critical iPhone SE fixes - viewport height management */
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    .min-h-screen {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    /* Chat container height fixes for short screens */
    .chat-messages {
        height: calc(100vh - 150px) !important;
        min-height: 450px !important;
        max-height: 700px !important;
        padding: 0.75rem;
    }

    /* Bottom safe area padding */
    .flex-1 {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    /* Modal improvements for very small screens */
    .modal-dialog {
        margin: 0.25rem;
        max-width: calc(100vw - 0.5rem);
        max-height: calc(100vh - 1rem);
        display: flex;
        align-items: center;
    }

    .modal-content {
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }

    .modal-lg {
        max-width: calc(100vw - 0.5rem);
    }

    /* Subscription modal column stacking */
    .modal .row .col-md-6 {
        margin-bottom: 1rem;
    }

    .modal .card {
        margin-bottom: 1rem;
    }

    /* Improve input areas for touch */
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 12px;
    }

    /* Better chat input area */
    #messageInput {
        min-height: 32px;
        font-size: 16px;
        padding: 0.4rem 0.6rem;
    }

    /* Larger send button for touch */
    #sendButton {
        min-width: 40px;
        min-height: 32px;
    }

    /* Tip jar buttons touch optimization */
    .tip-option {
        min-height: 60px;
        padding: 1rem;
        font-size: 1rem;
    }

    /* Typography improvements for mobile */
    .badge {
        font-size: 0.75rem !important;
        min-height: 24px;
        display: inline-flex;
        align-items: center;
        padding: 0.375rem 0.75rem;
    }

    /* Personality dropdown touch improvements */
    .personality-option {
        min-height: 60px;
        padding: 1rem;
    }

    .personality-dropdown .dropdown-menu {
        min-width: min(280px, 85vw) !important;
        max-width: min(320px, 90vw) !important;
        max-height: 60vh;
    }

    /* Header improvements */
    .text-2xl {
        font-size: 1.375rem;
    }

    /* Button improvements */
    .btn-sm {
        min-height: 44px !important;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    /* Close button improvements */
    .btn-close {
        width: 44px;
        height: 44px;
        padding: 0;
        font-size: 1.5rem;
    }

    /* Fix very small screens (iPhone SE, small Android) */
    .container-fluid {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    /* Improve message bubbles for small screens */
    .max-width-75 {
        max-width: 85%;
    }

    /* Better form input styling */
    .input-group {
        border-radius: 16px;
        overflow: hidden;
    }

    /* Social proof improvements */
    .social-proof-section {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }

    /* Android specific fixes */
    input[type="text"], input[type="password"], textarea {
        -webkit-appearance: none;
        appearance: none;
    }

    /* Prevent horizontal scroll on very small screens */
    * {
        max-width: 100vw;
        box-sizing: border-box;
    }
}

/* Android device optimizations */
@media (max-width: 393px) {
    /* Pixel 7 and similar narrow Android devices */
    .personality-dropdown .dropdown-menu {
        min-width: min(260px, 80vw) !important;
        max-width: min(300px, 85vw) !important;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
    }

    .text-2xl {
        font-size: 1.25rem;
    }
}

/* Galaxy Fold and ultra-narrow screens */
@media (max-width: 344px) {
    .personality-dropdown .dropdown-menu {
        min-width: min(240px, 75vw) !important;
        max-width: min(280px, 80vw) !important;
    }

    /* Keep 2x2 grid even on very small screens */
    .flex.flex-col.sm\\:flex-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto auto !important;
        gap: 0.5rem !important;
    }

    .btn {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.75rem !important;
        min-height: 40px !important;
    }
}

.container-fluid {
    min-height: 100vh;
    padding: 0;
    display: flex;
    justify-content: center; /* Center the chat interface */
    align-items: flex-start;
    padding-top: 2rem;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Landscape mobile optimizations */
@media (max-width: 896px) and (max-height: 414px) and (orientation: landscape) {
    /* Compact header for landscape */
    header {
        padding: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    .text-2xl {
        font-size: 1.25rem;
    }

    .chat-messages {
        height: calc(100vh - 200px) !important;
        min-height: 200px !important;
    }

    /* Hide social proof banner in landscape */
    .social-proof-section {
        display: none;
    }

    /* Compact modals for landscape */
    .modal-dialog {
        max-height: calc(100vh - 1rem);
        margin: 0.5rem;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding-top: 1rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Button consistency for mobile */
    .btn-sm {
        min-height: 44px;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    /* Header optimizations */
    .flex-col.md\\:flex-row {
        gap: 1rem;
    }

    /* Better button wrapping */
    .flex.flex-col.sm\\:flex-row {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* Clean, modern chat styling */
.chat-messages {
    scroll-behavior: smooth;
}

.max-width-75 {
    max-width: 75%;
}

/* Custom button styling */
.btn {
    border-radius: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-height: 44px; /* WCAG AA compliant touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Dropdown toggle improvements */
.dropdown-toggle {
    min-height: 44px;
    padding: 0.75rem 1rem;
    position: relative;
}

.dropdown-toggle::after {
    margin-left: 0.5rem;
    font-size: 1.2rem;
}

/* Accessibility improvements */
.form-check-input:focus {
    box-shadow: 0 0 0 2px #007bff;
}

.dropdown-item:focus {
    background-color: #e9ecef;
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

/* Better color contrast for accessibility */
.text-muted {
    color: #495057 !important;
}

.badge {
    font-weight: 600;
    letter-spacing: 0.025em;
}

/* iOS specific improvements */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific styles */
    .modal-dialog {
        transform: translate3d(0, 0, 0);
    }

    input, textarea, select {
        font-size: 16px; /* Prevents zoom */
        border-radius: 12px;
    }

    /* Fix iOS viewport units with dynamic address bar */
    .chat-messages {
        height: calc(100vh - 300px);
        height: calc(100dvh - 300px); /* Dynamic viewport height */
    }

    /* iOS safe areas */
    .flex-1 {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* iPhone 14 Pro/Pro Max notch handling */
@media (max-width: 430px) and (min-height: 800px) {
    .flex-1 {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
}

/* Performance optimizations for older devices */
@media (max-resolution: 1.5dppx) {
    .btn {
        transform: none;
    }

    .btn:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
}

/* Gradient backgrounds */
.bg-gradient-to-r {
    background: linear-gradient(to right, var(--tw-gradient-from), var(--tw-gradient-to));
}

.from-purple-400 {
    --tw-gradient-from: #a855f7;
}

.to-blue-400 {
    --tw-gradient-to: #60a5fa;
}

.from-purple-500 {
    --tw-gradient-from: #8b5cf6;
}

.to-blue-500 {
    --tw-gradient-to: #3b82f6;
}

/* Advanced Monetization Styles */

/* Sticky Upgrade Button - Enhanced Design (PERMANENTLY HIDDEN) */
.sticky-upgrade-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 16px 24px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 700;
    font-size: 14px;
    max-width: 220px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    /* Permanently hide this button */
    display: none !important;
    visibility: hidden !important;
}

.sticky-upgrade-btn::before {
    content: '';
    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;
}

.sticky-upgrade-btn:hover::before {
    left: 100%;
}

.sticky-upgrade-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.sticky-upgrade-btn:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

.sticky-upgrade-btn.urgent {
    background: linear-gradient(135deg, #ff6b6b, #ffa726);
    animation: pulse-urgent 2s infinite;
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.5);
}

.sticky-upgrade-btn.urgent:hover {
    box-shadow: 0 12px 40px rgba(255, 107, 107, 0.7);
}

@keyframes pulse-urgent {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 8px 32px rgba(255, 107, 107, 0.5);
    }
    50% { 
        transform: scale(1.08);
        box-shadow: 0 12px 40px rgba(255, 107, 107, 0.8);
    }
}

.upgrade-btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
}

.upgrade-text {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.trial-countdown, .trial-offer, .trial-expired {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 500;
}

.trial-offer {
    color: #ffd700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.trial-expired {
    color: #ff6b6b;
    font-weight: 600;
}

/* Social Proof Section */
.social-proof-section {
    border: 1px solid rgba(124, 58, 237, 0.1);
}

/* Modern Modal Styles */
.modern-modal {
    border: none;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
    animation: modalSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modern-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.modern-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.crown-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #ffd700;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.header-text .modal-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-weight: 500;
}

.modern-modal-body {
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Hero Section */
.hero-section {
    margin-bottom: 2rem;
}

.hero-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 32px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    animation: float 3s ease-in-out infinite;
}

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

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.2rem;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Pricing Container */
.pricing-container {
    margin-bottom: 2rem;
}

.pricing-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
    animation: cardFadeIn 0.6s ease-out;
}

@keyframes cardFadeIn {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.pricing-card:nth-child(1) {
    animation-delay: 0.1s;
}

.pricing-card:nth-child(2) {
    animation-delay: 0.2s;
}

.pricing-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.pricing-card:hover::before {
    opacity: 0.05;
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.pricing-card.popular {
    border-color: #10b981;
    transform: scale(1.05);
}

.pricing-card.popular:hover {
    transform: scale(1.05) translateY(-5px);
}

.popular-badge {
    position: absolute;
    top: -1px;
    right: 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 8px 16px;
    border-radius: 0 0 12px 12px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
}

.pricing-card .card-header {
    background: transparent;
    border: none;
    padding: 1.5rem 1.5rem 1rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.plan-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 20px;
    color: white;
}

.yearly-card .plan-icon {
    background: linear-gradient(135deg, #10b981, #059669);
}

.plan-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 1rem;
}

.plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 1rem;
}

.currency {
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
}

.yearly-card .currency {
    color: #10b981;
}

.amount {
    font-size: 3rem;
    font-weight: 800;
    color: #1a202c;
}

.period {
    font-size: 1rem;
    color: #64748b;
    font-weight: 500;
}

.savings-badge {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 0.5rem;
}

.pricing-card .card-body {
    padding: 0 1.5rem 1.5rem;
    position: relative;
    z-index: 1;
}

.features-list {
    margin-bottom: 1.5rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 15px;
    color: #374151;
}

.feature-item i {
    color: #10b981;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.feature-item.premium i {
    color: #f59e0b;
}

.btn-monthly, .btn-yearly {
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    border: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-monthly {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-yearly {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-monthly:hover, .btn-yearly:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.btn-monthly:active, .btn-yearly:active {
    transform: translateY(0);
}

/* Trust Section */
.trust-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.trust-items {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.trust-item i {
    color: #10b981;
    font-size: 16px;
}

.trust-text {
    color: #94a3b8;
    font-size: 13px;
    margin: 0;
}

/* Responsive Design for Modal */
@media (max-width: 768px) {
    .modern-modal-header {
        padding: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .crown-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .header-text .modal-title {
        font-size: 1.5rem;
    }

    .modal-subtitle {
        font-size: 1rem;
    }

    .modern-modal-body {
        padding: 2rem 1.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .pricing-card.popular {
        transform: none;
    }

    .pricing-card.popular:hover {
        transform: translateY(-5px);
    }

    .trust-items {
        gap: 1rem;
    }

    .trust-item {
        font-size: 13px;
    }

    .plan-price {
        flex-direction: column;
        gap: 0;
    }

    .amount {
        font-size: 2.5rem;
    }

    .btn-monthly, .btn-yearly {
        padding: 14px 20px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .modern-modal-header {
        padding: 1rem;
    }

    .modern-modal-body {
        padding: 1.5rem 1rem;
    }

    .hero-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-description {
        font-size: 0.9rem;
    }

    .pricing-card .card-header {
        padding: 1.5rem 1.5rem 1rem;
    }

    .pricing-card .card-body {
        padding: 0 1.5rem 1.5rem;
    }

    .plan-title {
        font-size: 1.25rem;
    }

    .amount {
        font-size: 2rem;
    }

    .feature-item {
        font-size: 14px;
    }

    .btn-monthly, .btn-yearly {
        padding: 12px 16px;
        font-size: 14px;
    }

    .trust-items {
        flex-direction: column;
        gap: 0.5rem;
    }
}

.social-proof {
    color: #6B7280;
    font-size: 14px;
}

.social-proof i {
    margin-right: 8px;
    animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.value-framing {
    color: #9CA3AF;
    font-weight: 500;
}

/* Subscription Modal Styles */
.subscription-plans {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.plan-card {
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.plan-card:hover {
    border-color: #7C3AED;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.1);
}

.plan-card.recommended {
    border-color: #7C3AED;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05), rgba(59, 130, 246, 0.05));
}

.plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #7C3AED, #3B82F6);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.plan-price {
    margin: 15px 0;
}

.plan-price .price {
    font-size: 24px;
    font-weight: 700;
    color: #1F2937;
}

.plan-price .period {
    font-size: 14px;
    color: #6B7280;
}

.plan-savings {
    color: #059669;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 15px;
}

.features-list {
    list-style: none;
    padding: 0;
    text-align: left;
}

.features-list li {
    padding: 5px 0;
    font-size: 14px;
}

.features-list i {
    margin-right: 8px;
    width: 16px;
}

/* Tip Jar Modal Styles */
.tip-amounts {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.tip-amount-btn {
    border-radius: 25px;
    padding: 12px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 80px;
}

.tip-amount-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* Personality Display Styles */
.personality-display {
    padding: 0;
}

.personality-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.personality-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED, #3B82F6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
}

.personality-info {
    flex: 1;
}

.personality-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
}

.personality-description {
    margin: 5px 0 0 0;
    color: #6B7280;
    font-size: 14px;
}

.personality-details {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #E5E7EB;
}

.personality-quote {
    background: #F8FAFC;
    border-left: 4px solid #7C3AED;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-style: italic;
    color: #4B5563;
}

.personality-quote i {
    color: #7C3AED;
    margin-right: 8px;
}

.personality-facts ul {
    list-style: none;
    padding: 0;
}

.personality-facts li {
    padding: 5px 0;
    color: #6B7280;
    font-size: 14px;
}

.personality-facts li:before {
    content: "✨";
    margin-right: 8px;
}

/* Referral Section Styles */
.referral-content h6 {
    color: #1F2937;
    margin-bottom: 8px;
}

.referral-stats {
    margin: 10px 0;
}

.referral-stats .badge {
    margin-right: 8px;
}

.referral-link-container {
    display: flex;
    gap: 8px;
}

.referral-link-container input {
    font-family: monospace;
    font-size: 12px;
}

/* Loading and Toast Styles */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.toast-notification {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

.toast-success {
    border-left: 4px solid #10B981;
}

.toast-error {
    border-left: 4px solid #EF4444;
}

.toast-info {
    border-left: 4px solid #3B82F6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sticky-upgrade-btn {
        top: 10px;
        right: 10px;
        padding: 12px 16px;
        max-width: 180px;
        font-size: 13px;
        border-radius: 25px;
    }

    .upgrade-text {
        font-size: 14px;
    }

    .trial-countdown, .trial-offer, .trial-expired {
        font-size: 11px;
    }
}

    .upgrade-text {
        font-size: 12px;
    }

    .trial-countdown, .trial-expired {
        font-size: 10px;
    }

    .subscription-plans {
        grid-template-columns: 1fr;
    }

    .tip-amounts {
        flex-direction: column;
        align-items: center;
    }

    .personality-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .referral-link-container {
        flex-direction: column;
    }
}

/* Smart Upsell Toast Styles */
.smart-upsell-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(124, 58, 237, 0.2);
    max-width: 320px;
    min-width: 280px;
    opacity: 0;
    transform: translateX(100%) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.smart-upsell-toast.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.smart-upsell-toast.fade-out {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
}

.smart-upsell-content {
    padding: 20px;
    position: relative;
}

.smart-upsell-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 14px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.smart-upsell-close:hover {
    background: #F3F4F6;
    color: #374151;
}

.smart-upsell-header h6 {
    margin: 0 20px 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    line-height: 1.3;
}

.smart-upsell-message {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #6B7280;
    line-height: 1.4;
}

.smart-upsell-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.smart-upsell-actions .btn {
    flex: 1;
    min-width: 100px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.smart-upsell-primary {
    background: linear-gradient(135deg, #7C3AED, #3B82F6) !important;
    border: none !important;
    color: white !important;
}

.smart-upsell-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3) !important;
}

.smart-upsell-secondary {
    background: white !important;
    border: 1px solid #E5E7EB !important;
    color: #6B7280 !important;
}

.smart-upsell-secondary:hover {
    background: #F9FAFB !important;
    border-color: #D1D5DB !important;
    color: #374151 !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .smart-upsell-toast {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
    }

    .smart-upsell-content {
        padding: 16px;
    }

    .smart-upsell-actions {
        flex-direction: column;
    }

    .smart-upsell-actions .btn {
        flex: none;
        width: 100%;
    }
}

/* Pulse animation for urgent upsells */
@keyframes upsell-pulse {
    0%, 100% { 
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15); 
    }
    50% { 
        box-shadow: 0 8px 32px rgba(124, 58, 237, 0.25); 
    }
}

.smart-upsell-toast.urgent {
    animation: upsell-pulse 2s ease-in-out infinite;
}

/* Special styling for different trigger types */
.smart-upsell-toast[data-trigger="positive_feedback"] {
    border-color: rgba(16, 185, 129, 0.3);
}

.smart-upsell-toast[data-trigger="positive_feedback"] .smart-upsell-header h6 {
    color: #059669;
}

.smart-upsell-toast[data-trigger="message_count"] {
    border-color: rgba(59, 130, 246, 0.3);
}

.smart-upsell-toast[data-trigger="time_spent"] {
    border-color: rgba(245, 158, 11, 0.3);
}

.smart-upsell-toast[data-trigger="personality_switch"] {
    border-color: rgba(124, 58, 237, 0.3);
}

.row {
    margin: 0;
}

.col-12 {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header Styles */
.chat-header {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.ai-avatar-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin: 0 auto;
}

/* Chat History Container */
/* This is the main area that holds all the chat messages */
.chat-container {
    flex: 1; /* Take up all available space */
    display: flex; /* Use flexbox layout */
    flex-direction: column; /* Stack items vertically */
    background: white; /* Clean white background */
    overflow: hidden; /* Hide content that goes outside the container */
}

/* Chat Messages Display Area */
/* This div shows all the conversation messages and handles scrolling */
.chat-messages {
    flex: 1; /* Take up all available vertical space */
    padding: 1.5rem; /* Add generous space around the messages */
    overflow-y: auto; /* Enable vertical scrolling when messages overflow */
    scroll-behavior: smooth; /* Make scrolling smooth instead of jumpy */
    background: #fafafa; /* Keep light background for message area */
}

/* Custom scrollbar for better aesthetics */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 3rem 2rem;
    text-align: center;
}

.welcome-message h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
}

.welcome-message p {
    color: #6c757d;
    max-width: 400px;
    line-height: 1.6;
    font-size: 1rem;
}

/* Message Styles */
.message {
    display: flex;
    margin-bottom: 1rem;
    animation: messageSlideIn 0.3s ease-out;
}

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

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.message-content {
    max-width: 70%;
    word-wrap: break-word;
}

.message-text {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    line-height: 1.4;
    font-size: var(--font-size-sm);
    transition: font-size 0.3s ease;
}

.message-time {
    font-size: var(--font-size-sm);
    margin-top: 0.25rem;
    opacity: 0.7;
    color: var(--text-secondary);
    transition: color 0.3s ease, font-size 0.3s ease;
}

/* User Messages - Modern chat bubbles on the right */
.user-message {
    justify-content: flex-end; /* Align message to the right side */
    margin-bottom: 1rem;
}

.user-message .message-avatar {
    background: #495057; /* Darker gray for better contrast */
    color: white;
    margin-left: 0.75rem;
    order: 2; /* Put avatar after the message content */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-message .message-content {
    order: 1; /* Put message content before the avatar */
    text-align: right; /* Align text to the right */
    max-width: 70%;
}

.user-message .message-text {
    background: #495057; /* Dark gray background for user messages */
    color: white; /* White text - consistent in both themes */
    padding: 1rem 1.25rem; /* More generous padding */
    border-radius: 1.5rem; /* Extra rounded corners (2xl) */
    border-bottom-right-radius: 0.5rem; /* Slight tail effect */
    font-size: var(--font-size-base); /* Responsive font size */
    font-weight: 500; /* Medium weight for better readability */
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(73, 80, 87, 0.15); /* Soft drop shadow */
    word-wrap: break-word;
    transition: font-size 0.3s ease;
}

.user-message .message-time {
    color: #6c757d; /* Gray timestamp */
    font-size: 0.75rem;
    margin-top: 0.5rem;
    margin-right: 0.5rem;
}

/* AI Messages - Modern chat bubbles on the left */
.ai-message {
    justify-content: flex-start; /* Align message to the left side */
    margin-bottom: 1rem;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, #4f8ef7 0%, #667eea 100%); /* Beautiful blue gradient */
    color: white;
    margin-right: 0.75rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-message .message-content {
    max-width: 70%;
}

.ai-message .message-text {
    background: var(--bg-primary); /* Theme-aware background */
    color: var(--text-primary); /* Theme-aware text */
    border: 1px solid var(--border-color); /* Subtle border for dark mode */
    padding: 1rem 1.25rem; /* More generous padding */
    border-radius: 1.5rem; /* Extra rounded corners (2xl) */
    border-bottom-left-radius: 0.5rem; /* Slight tail effect */
    font-size: var(--font-size-base); /* Responsive font size */
    font-weight: 400; /* Normal weight for friendly feel */
    line-height: 1.6; /* Better line spacing */
    box-shadow: 0 2px 8px var(--shadow-color); /* Theme-aware shadow */
    word-wrap: break-word;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, font-size 0.3s ease;
}

.ai-message .message-time {
    color: #6c757d; /* Gray timestamp */
    font-size: 0.75rem;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
}

/* Typing Indicator - Modern 3-dot animation */
.typing-indicator {
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.3s ease forwards;
}

.typing-text {
    background: var(--bg-secondary); /* Theme-aware background for typing indicator */
    padding: 1rem 1.25rem;
    border-radius: 1.5rem;
    border-bottom-left-radius: 0.5rem; /* Tail effect like AI messages */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(79, 142, 247, 0.1);
    border: 1px solid rgba(79, 142, 247, 0.1);
    min-width: 100px;
    color: #6c757d;
    font-style: italic;
    font-size: 0.9rem;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4f8ef7; /* Blue dots to match theme */
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

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

/* Smooth bouncing animation for typing dots */
@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8) translateY(0);
        opacity: 0.6;
    }
    40% {
        transform: scale(1.1) translateY(-4px);
        opacity: 1;
    }
}

/* Fade in animation for typing indicator */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade out animation for typing indicator */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-5px);
    }
}

/* Typing cursor animation for AI message typing effect */
.typing-cursor {
    animation: blink 1s infinite;
    color: #4f8ef7;
    font-weight: bold;
}

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

/* Modern Input Area - Sticks to bottom */
.chat-input-container {
    padding: 1.25rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.chat-input-container .form-control {
    border: 2px solid var(--border-color);
    padding: 1rem 1.25rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 1.5rem; /* Rounded edges */
    font-size: var(--font-size-base);
    font-family: inherit;
    transition: all 0.2s ease;
    flex: 1;
}

.chat-input-container .form-control::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.chat-input-container .form-control:focus {
    outline: none;
    border-color: #4f8ef7;
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.1);
}

.chat-input-container .btn-primary {
    background: linear-gradient(135deg, #4f8ef7 0%, #667eea 100%);
    border: none;
    border-radius: 1.25rem;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.75rem;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 60px;
}

.chat-input-container .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 142, 247, 0.3);
    background: linear-gradient(135deg, #3d7ce6 0%, #5a6fd8 100%);
}

.chat-input-container .btn-primary:active {
    transform: translateY(0);
}

/* Loading state for send button */
.chat-input-container .btn-primary.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.chat-input-container .btn-primary.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: buttonSpin 0.8s linear infinite;
}

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

/* Smooth message animations - Initial state for new messages */
.message.new-message {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    animation: messageSlideIn 0.4s ease forwards;
}

/* Existing messages should be visible */
.message:not(.new-message) {
    opacity: 1;
    transform: translateY(0) scale(1);
}

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

/* Subtle pulse for new messages */
.message.new-message {
    animation: messageSlideIn 0.4s ease forwards, subtlePulse 0.6s ease 0.2s;
}

@keyframes subtlePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.005);
    }
}

/* Modern Settings Panel Styling */
.settings-panel {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.1);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

.settings-panel:hover {
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

/* Settings Header */
.settings-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.settings-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.1) 100%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.settings-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1;
    position: relative;
}

.settings-icon {
    font-size: 1.5rem;
    color: white;
    animation: rotate 2s ease-in-out infinite;
}

@keyframes rotate {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

.settings-title-text {
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.settings-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1;
    position: relative;
}

.settings-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Settings Content */
.settings-content {
    padding: 2rem;
}

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

/* Setting Item */
.setting-item {
    background: white;
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.setting-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.05), transparent);
    transition: left 0.5s;
}

.setting-item:hover::before {
    left: 100%;
}

.setting-item:hover {
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.1);
    transform: translateY(-2px);
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.setting-icon-small {
    color: #667eea;
    font-size: 1rem;
    width: 16px;
    text-align: center;
}

/* Custom Select Styling */
.custom-select-wrapper {
    position: relative;
    display: block;
}

.custom-select {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-right: 3rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    outline: none;
}

.custom-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #f8fafc;
}

.custom-select:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.select-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.875rem;
    pointer-events: none;
    transition: all 0.3s ease;
}

.custom-select:focus + .select-arrow {
    color: #667eea;
    transform: translateY(-50%) rotate(180deg);
}

/* Custom Toggle Styling */
.toggle-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.custom-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-input {
    display: none;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: #e5e7eb;
    border-radius: 13px;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-input:checked + .toggle-label .toggle-slider {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.toggle-input:checked + .toggle-label .toggle-slider::before {
    transform: translateX(24px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.toggle-text {
    color: #6b7280;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.toggle-input:checked + .toggle-label .toggle-text {
    color: #374151;
    font-weight: 600;
}

/* Current Settings Display */
.current-settings-display {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.settings-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.summary-icon {
    color: #3b82f6;
    font-size: 1.25rem;
    flex-shrink: 0;
}

#currentSettings {
    color: #1e40af;
    font-size: 0.95rem;
    line-height: 1.5;
}

#currentSettings strong {
    color: #1d4ed8;
    font-weight: 700;
}

/* Settings toggle button */
#settingsToggle {
    transition: all 0.2s ease;
}

#settingsToggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Extra small mobile screens */
@media (max-width: 480px) {
    /* Smaller grid for very small screens */
    .flex.flex-col.items-center.gap-2 {
        max-width: 280px !important;
        gap: 0.5rem !important;
    }

    .flex.flex-col.items-center.gap-2 > button {
        min-height: 40px !important;
        font-size: 0.6rem !important;
        padding: 0.4rem 0.3rem !important;
    }

    .flex.flex-col.items-center.gap-2 button[id="tipJarButton"],
    .flex.flex-col.items-center.gap-2 button[id="shareJoButton"] {
        font-size: 0.55rem !important;
        padding: 0.4rem 0.2rem !important;
    }

    .flex.flex-col.items-center.gap-2 button[id="settingsToggle"],
    .flex.flex-col.items-center.gap-2 button[onclick="clearChat()"],
    .flex.flex-col.items-center.gap-2 button[onclick="showApiKeyModal()"] {
        font-size: 0.7rem !important;
        padding: 0.4rem !important;
    }

    .flex.flex-col.items-center.gap-2 .dropdown .btn {
        font-size: 0.55rem !important;
        padding: 0.4rem 0.3rem !important;
        min-height: 40px !important;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .settings-content {
        padding: 1.5rem;
    }

    .settings-header {
        padding: 1.25rem 1.5rem;
    }

    .setting-item {
        padding: 1.25rem;
    }

    .settings-title-text {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .settings-content {
        padding: 1rem;
    }

    .settings-header {
        padding: 1rem;
    }

    .setting-item {
        padding: 1rem;
    }

    .custom-toggle {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

.chat-input-container .btn-primary:hover {
    transform: scale(1.05);
}

.chat-input-container .btn-primary:disabled {
    opacity: 0.5;
    transform: none;
}

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

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Alert Styling */
.alert {
    border: none;
    border-radius: 0.75rem;
    margin: 1rem 1.5rem 0;
}

/* Modal Customization */
.modal-content {
    border-radius: 1rem;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 1rem 1rem 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0 0 1rem 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.5rem;
        padding-top: 1rem;
    }

    .chat-main-container {
        max-width: 100%;
        margin: 0;
        border-radius: 0.75rem;
    }

    .chat-header {
        padding: 1rem 1.25rem;
    }

    .chat-header h5 {
        font-size: 1.1rem;
    }

    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    .chat-messages {
        padding: 1rem;
    }

    .message-text {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .user-message .message-text,
    .ai-message .message-text {
        border-radius: 1.25rem;
    }

    .chat-input-container {
        padding: 1rem;
    }

    .chat-input-container .form-control {
        font-size: 0.95rem;
        padding: 0.875rem 1rem;
    }

    .message-content {
        max-width: 85%;
    }

    .ai-avatar {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .welcome-message {
        padding: 2rem 1.5rem;
    }

    .welcome-message h4 {
        font-size: 1.25rem;
    }

    .ai-avatar-large {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    /* Mobile Header Button Layout - Horizontal Row */
    .flex.flex-col.sm\\:flex-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        width: 100% !important;
        align-items: center;
    }

    /* Personality dropdown takes more space */
    .flex.flex-col.sm\\:flex-row > .dropdown:first-child {
        flex: 2 !important;
        min-width: 140px !important;
    }

    /* All other buttons in a compact horizontal row */
    .flex.flex-col.sm\\:flex-row > .position-relative,
    .flex.flex-col.sm\\:flex-row > button {
        flex: 1 !important;
        min-width: 60px !important;
        font-size: 0.75rem !important;
        padding: 0.5rem 0.25rem !important;
        text-align: center !important;
        min-height: 40px !important;
        justify-content: center !important;
    }

    /* Make tip button more compact */
    .flex.flex-col.sm\\:flex-row > button#tipJarButton {
        font-size: 0.7rem !important;
        padding: 0.4rem 0.2rem !important;
        min-width: 50px !important;
    }

    /* Icon-only buttons */
    .flex.flex-col.sm\\:flex-row > button[id="settingsToggle"],
    .flex.flex-col.sm\\:flex-row > button[onclick="clearChat()"],
    .flex.flex-col.sm\\:flex-row > button[onclick="showApiKeyModal()"] {
        min-width: 44px !important;
        padding: 0.5rem !important;
        font-size: 0.8rem !important;
    }

    /* Hide upgrade button if not visible */
    .flex.flex-col.sm\\:flex-row > .position-relative[style*="display: none"] {
        display: none !important;
    }
}

/* Premium modal styling */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header.bg-primary {
    border-radius: 15px 15px 0 0;
}

.modal-footer {
    border-top: none;
    padding: 1.5rem;
}

/* Premium personality indicators */
.personality-option.locked {
    opacity: 0.7;
    position: relative;
}

.personality-option.locked:hover {
    opacity: 0.9;
}

.personality-option.locked:hover .premium-indicators {
    filter: brightness(1.2);
}

/* Premium indicators styling */
.premium-indicators {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.premium-lock-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.premium-badge {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Crown icon styling */
.fa-crown {
    filter: drop-shadow(0 0 3px rgba(255, 193, 7, 0.5));
}

/* Premium personality option styling */
.premium-personality {
    transition: all 0.3s ease;
}

.premium-personality.locked {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.05));
    border-left: 3px solid rgba(255, 193, 7, 0.5);
}

/* Subscribe button styling */
#subscribeButton {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

#subscribeButton:hover {
    background: linear-gradient(45deg, #0056b3, #003d82);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
}

@media (max-width: 576px) {
    .chat-main-container {
        border-radius: 0;
        margin: -0.5rem;
        height: 100vh;
    }

    .container-fluid {
        padding: 0;
    }

    .message-content {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 90%;
    }

    .message-text {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

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

/* Loading States */
.btn .spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
}

/* Focus States for Accessibility */
.btn:focus,
.form-control:focus {
    outline: none;
}

.message-text {
    position: relative;
}

/* Animation for new messages */
.message.new-message {
    animation: newMessageAppear 0.5s ease-out;
}

/* AI message bubble for dynamically created messages */
.ai-message-bubble {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

@keyframes newMessageAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Clear any conflicting dropdown styles */
.dropdown-menu.personality-dropdown-menu {
    background-color: white !important;
    border: 2px solid #333 !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
    padding: 0 !important;
    margin: 0 !important;
    position: absolute !important;
    z-index: 10000 !important;
    min-width: 350px !important;
    max-width: 400px !important;
    max-height: 400px !important;
    overflow-y: auto !important;
    top: 100% !important;
    left: auto !important;
    right: 0 !important;
}

@media (max-width: 768px) {
    .dropdown-menu.personality-dropdown-menu {
        min-width: 280px !important;
        max-width: 90vw !important;
        right: 0 !important;
        left: auto !important;
    }

    .dropdown-menu.personality-dropdown-menu .personality-option {
        padding: 0.75rem !important;
    }

    .dropdown-menu.personality-dropdown-menu .personality-option div div:first-child {
        font-size: 1rem !important;
    }

    .dropdown-menu.personality-dropdown-menu .personality-option div div:nth-child(2) {
        font-size: 0.8rem !important;
    }

    .dropdown-menu.personality-dropdown-menu .personality-option div div:nth-child(3) {
        font-size: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    .dropdown-menu.personality-dropdown-menu {
        min-width: 250px !important;
        max-width: 95vw !important;
        left: -100px !important;
        right: auto !important;
    }
}

.dropdown-menu.personality-dropdown-menu li {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    border-bottom: 1px solid #eee !important;
}

.dropdown-menu.personality-dropdown-menu .personality-option {
    display: block !important;
    width: 100% !important;
    padding: 1rem !important;
    background: white !important;
    color: #333 !important;
    border: none !important;
    text-align: left !important;
    cursor: pointer !important;
    white-space: normal !important;
}

.dropdown-menu.personality-dropdown-menu .personality-option:hover {
    background-color: #f8f9fa !important;
    color: #333 !important;
}

.dropdown-menu.personality-dropdown-menu .personality-option:focus {
    background-color: #f8f9fa !important;
    color: #333 !important;
    box-shadow: none !important;
}

.dropdown-menu.personality-dropdown-menu .personality-option.active {
    background-color: #e3f2fd !important;
    color: #333 !important;
    border-left: 4px solid #667eea !important;
}

/* Responsive personality dropdown */
@media (max-width: 768px) {
    .personality-dropdown {
        min-width: 280px;
    }

    .personality-item {
        padding: 0.4rem 0;
    }

    .personality-bio {
        font-size: 0.75rem;
    }
}
