/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* Variables */
:root {
    /* Dark Theme (Default) - AI Futuristic */
    --primary-gradient: linear-gradient(135deg, #00DDFF, #0044FF);
    --accent-color: #00CCFF;
    --accent-light: rgba(0, 204, 255, 0.25);
    --accent-hover: #00A3FF;
    --glow-color: rgba(0, 204, 255, 0.7);
    --text-primary: #F0F9FF;
    --text-secondary: rgba(240, 249, 255, 0.75);
    --text-tertiary: rgba(240, 249, 255, 0.45);
    --bg-dark: #070B14;
    --bg-panel: rgba(15, 23, 42, 0.85);
    --bg-element: rgba(30, 41, 59, 0.65);
    --bg-hover: rgba(0, 204, 255, 0.18);
    --border-color: rgba(0, 204, 255, 0.2);
    --panel-radius: 16px;
    --element-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --glow: 0 0 15px var(--glow-color);
    --glow-strong: 0 0 25px var(--glow-color), 0 0 50px var(--glow-color);
    --danger-color: #FF3A5E;
    --glass-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.6));
    --glass-border: 1px solid rgba(0, 204, 255, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --neon-shadow: 0 0 10px var(--accent-color), 0 0 25px var(--accent-color);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

/* Particle Background */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

#particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 80% 10%, rgba(139, 92, 246, 0.1), transparent 40%),
        radial-gradient(circle at 10% 90%, rgba(79, 70, 229, 0.1), transparent 40%);
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    overflow: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg-panel);
    border-radius: 5px;
}

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

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

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
}

#menu-toggle-btn {
    background: var(--primary-gradient);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

#menu-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--glow);
}

/* Side Panel Styles */
.side-panel {
    width: 260px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: var(--glass-border);
    box-shadow: var(--glass-shadow);
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    position: relative;
    overflow-y: visible;
    z-index: 10;
}

.brand {
    margin-bottom: 3rem;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ai-logo {
    width: 70px;
    height: 70px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.logo-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #4F46E5;
    border-bottom-color: #8B5CF6;
    animation: spin 3s linear infinite;
}

.logo-core {
    position: absolute;
    width: 80%;
    height: 80%;
    background: var(--primary-gradient);
    border-radius: 50%;
    box-shadow: var(--glow-strong);
    animation: pulse 3s ease infinite alternate;
}

.ai-logo i {
    font-size: 1.5rem;
    color: white;
    position: relative;
    z-index: 2;
}

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

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

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.brand h3 {
    font-family: 'Audiowide', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 2px;
    text-align: center;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    /* text-shadow: var(--neon-shadow); */
}

.nav-menu {
    margin-top: 1rem;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.2rem;
    margin-bottom: 0.8rem;
    border-radius: var(--element-radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    backdrop-filter: blur(5px);
}

.menu-item:hover {
    background: var(--bg-hover);
    transform: translateX(3px);
}

.menu-item.active {
    background: var(--glass-bg);
    box-shadow: inset 3px 0 0 var(--accent-color);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--element-radius);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
    opacity: 0.5;
    pointer-events: none;
}

.menu-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.8rem;
    border-radius: 50%;
    background: var(--glass-bg);
    box-shadow: var(--glass-shadow);
}

.menu-item i {
    font-size: 1.1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.menu-item span {
    font-weight: 500;
}

/* Base tooltip styles for header buttons */
.header-actions button[data-tooltip] {
    position: relative;
}

/* Tooltip content */
.header-actions button[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--element-radius);
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);

    /* Position below button */
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    animation: tooltip-appear 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* Accent line */
.header-actions button[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    width: 3px;
    height: 10px;
    background: var(--primary-gradient);
    z-index: 1001;
    pointer-events: none;

    /* Position for connection line */
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    animation: tooltip-line-appear 0.3s ease forwards;
}

.header-actions button.primary-btn[data-tooltip]:hover::before {
    content: none !important;
}

/* Animations */
@keyframes tooltip-appear {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes tooltip-line-appear {
    0% {
        opacity: 0;
        height: 0;
    }

    100% {
        opacity: 1;
        height: 10px;
    }
}

.theme-toggle {
    margin-top: auto;
    background: var(--glass-bg);
    border-radius: var(--element-radius);
    padding: 0.5rem;
    display: flex;
    justify-content: space-around;
    border: var(--glass-border);
}

.toggle-option {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    color: var(--text-secondary);
}

.toggle-option.active {
    background-color: var(--accent-light);
    color: var(--text-primary);
    box-shadow: var(--glow);
}

.toggle-option i {
    font-size: 0.9rem;
}

.toggle-option span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Main Content Styles */
.content-area {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-dark);
    position: relative;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: var(--glass-border);
    position: relative;
    z-index: 5;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

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

.action-btn {
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.action-btn:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

/* Tab Content Styles */
.tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: flex;
}

/* Chat Styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    /* Add a subtle pattern to the chat background */
    background-image:
        radial-gradient(rgba(139, 92, 246, 0.05) 2px, transparent 2px),
        radial-gradient(rgba(79, 70, 229, 0.05) 2px, transparent 2px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fadeIn 0.3s ease, slideIn 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(10px);
    }

    to {
        transform: translateY(0);
    }
}

.message.assistant {
    align-items: flex-start;
}

.message.user {
    align-items: flex-end;
    margin-left: auto;
}

.message-content {
    display: flex;
    flex-direction: column;
}

.message-bubble {
    padding: 1rem 1.5rem;
    border-radius: 18px;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.message.assistant .message-bubble {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-top-left-radius: 4px;
    box-shadow: var(--glass-shadow);
}

.message.user .message-bubble {
    background: var(--primary-gradient);
    border-top-right-radius: 4px;
    box-shadow: var(--glow);
}

.message-time {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    align-self: flex-start;
}

.message.user .message-time {
    align-self: flex-end;
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.message-action-btn {
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.message-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    margin: 0 3px;
    background: var(--accent-color);
    border-radius: 50%;
    display: inline-block;
    opacity: 0.6;
}

.typing-dots span:nth-child(1) {
    animation: pulse-dot 1.2s infinite;
}

.typing-dots span:nth-child(2) {
    animation: pulse-dot 1.2s infinite 0.2s;
}

.typing-dots span:nth-child(3) {
    animation: pulse-dot 1.2s infinite 0.4s;
}

@keyframes pulse-dot {
    0% {
        transform: scale(0.8);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(0.8);
        opacity: 0.4;
    }
}

/* Chat Input Styles */
.chat-input-wrapper {
    padding: 1.5rem 2rem;
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: var(--glass-border);
    z-index: 2;
}

.input-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--element-radius);
    padding: 0.2rem 0.5rem;
    display: flex;
    align-items: center;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    border: var(--glass-border);
    position: relative;
    overflow: hidden;
}

.input-container::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: linear-gradient(315deg, var(--accent-color) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    transform: rotate(45deg);
    pointer-events: none;
}

.input-container:focus-within {
    box-shadow: var(--glow);
    border-color: var(--accent-color);
}

.input-container:focus-within::before {
    opacity: 0.1;
}

#chat-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    flex: 1;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    z-index: 1;
    resize: none;
    max-height: 150px;
    min-height: 20px;
}

#chat-input:focus {
    outline: none;
}

#chat-input::placeholder {
    color: var(--text-secondary);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1;
}

.input-action-btn {
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
    backdrop-filter: blur(5px);
}

.input-action-btn:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.input-action-btn.active {
    color: var(--accent-color);
    box-shadow: var(--glow);
}

.send-btn {
    background: var(--primary-gradient);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.send-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.send-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: var(--glow-strong);
}

.send-btn:hover::before {
    animation: shine 1.5s ease;
}

@keyframes shine {
    0% {
        left: -50%;
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        left: 150%;
        opacity: 0;
    }
}

.input-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

.suggestion-chip {
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    border: var(--glass-border);
}

.suggestion-chip:hover {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.2), rgba(139, 92, 246, 0.2));
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

/* Personality Tab Styles */
.personality-container {
    padding: 2rem;
    overflow-y: auto;
    height: 100%;
}

.section-intro {
    margin-bottom: 2rem;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.section-intro h3 {
    margin-bottom: 1rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.section-intro p {
    color: var(--text-secondary);
    line-height: 1.6;
}

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

.personality-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--element-radius);
    padding: 1.8rem;
    transition: var(--transition);
    cursor: pointer;
    border: var(--glass-border);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.personality-card::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: linear-gradient(315deg, var(--accent-color) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    transform: rotate(45deg);
}

.personality-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow);
    border-color: var(--accent-color);
}

.personality-card:hover::before,
.personality-card.active::before {
    opacity: 0.1;
}

.personality-card.active {
    border-color: var(--accent-color);
    box-shadow: var(--glow);
}

.personality-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    box-shadow: var(--glow);
    position: relative;
    z-index: 1;
}

.personality-icon i {
    font-size: 1.5rem;
    color: white;
}

.personality-card h4 {
    margin-bottom: 0.8rem;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    position: relative;
    z-index: 1;
}

.personality-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

.custom-personality {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--element-radius);
    padding: 1.5rem;
    border: var(--glass-border);
}

.custom-personality h4 {
    margin-bottom: 1rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
}

#custom-instructions {
    width: 100%;
    height: 120px;
    padding: 1rem;
    border-radius: var(--element-radius);
    background: rgba(51, 65, 85, 0.4);
    border: var(--glass-border);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    resize: none;
    transition: var(--transition);
}

#custom-instructions:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: var(--glow);
}

/* History Tab Styles */
.history-container {
    padding: 1.5rem;
    overflow-y: auto;
    height: 100%;
}

.history-item {
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: var(--element-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border: var(--glass-border);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow);
    border-color: var(--accent-color);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-title {
    font-weight: 600;
    font-size: 1rem;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-preview {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    color: var(--text-secondary);
}

.history-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

/* Settings Tab Styles */
.settings-container {
    padding: 2rem;
    overflow-y: auto;
    height: 100%;
}

.settings-section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--element-radius);
    padding: 1.5rem;
    border: var(--glass-border);
    margin-bottom: 2rem;
}

.settings-section h4 {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
}

.settings-section h4 i {
    color: var(--accent-color);
}

.toggle-setting,
.preference-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

.toggle-setting:last-child,
.preference-setting:last-child {
    border-bottom: none;
}

.toggle-switch {
    width: 44px;
    height: 22px;
    background-color: var(--bg-dark);
    border-radius: 30px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-switch::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.toggle-switch.active {
    background-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.toggle-switch.active::before {
    transform: translateX(22px);
    background-color: white;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.size-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: var(--glass-border);
    border-radius: var(--element-radius);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.size-btn:hover {
    background-color: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

#font-size-value {
    min-width: 70px;
    text-align: center;
    font-size: 0.9rem;
}

.select-option {
    color: black !important;
}

.pref-select:focus {
    border-color: var(--accent-color);
    box-shadow: var(--glow);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: none;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--panel-radius);
    width: 90%;
    max-width: 500px;
    z-index: 110;
    display: none;
    box-shadow: var(--glass-shadow);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: var(--glass-border);
}

.modal.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: var(--glass-border);
}

.modal-header h4 {
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem 1.5rem;
}

.modal-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--element-radius);
    background: rgba(51, 65, 85, 0.4);
    border: var(--glass-border);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: var(--glow);
}

/* Button Styles */
.primary-btn,
.secondary-btn {
    padding: 0.8rem 1.5rem;
    border-radius: var(--element-radius);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    position: relative;
    overflow: hidden;
}

.primary-btn {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow-strong);
}

.primary-btn:hover::before {
    animation: shine 1.5s ease;
}

.secondary-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: var(--text-primary);
    border: var(--glass-border);
}

.secondary-btn:hover {
    background-color: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.options-list {
    display: flex;
    flex-direction: column;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: var(--element-radius);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.5rem;
}

.option-item:hover {
    background-color: var(--bg-hover);
    transform: translateX(3px);
}

.option-item i {
    margin-right: 1rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.option-item.danger {
    color: var(--danger-color);
}

.option-item.danger i {
    color: var(--danger-color);
}

/* Notification Styles */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.notification {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left: 4px solid var(--accent-color);
    padding: 1rem 1.5rem;
    border-radius: var(--element-radius);
    box-shadow: var(--glass-shadow);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: auto;
    display: flex;
    align-items: center;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification-icon {
    margin-right: 1rem;
    color: var(--accent-color);
}

.notification-message {
    flex: 1;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: var(--element-radius);
    margin-bottom: 1rem;
    border: var(--glass-border);
}

.search-header button {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

/* Custom Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
}

.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--panel-radius);
    width: 90%;
    max-width: 400px;
    z-index: 1010;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.popup.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: var(--glass-border);
}

.popup-header h4 {
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    margin: 0;
}

.popup-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.popup-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.popup-body {
    padding: 1.5rem;
}

.popup-message {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.popup-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--element-radius);
    background: rgba(51, 65, 85, 0.4);
    border: var(--glass-border);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.popup-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: var(--glow);
}

.popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem 1.5rem;
}

/* Different popup types */
.popup-alert .popup-footer {
    justify-content: center;
}

.popup-confirm .primary-btn {
    min-width: 80px;
}

body.light-theme .popup-input {
    background: rgba(241, 245, 249, 0.7);
}

.edit-message-area {
    width: 100%;
    min-height: 80px;
    background: rgba(51, 65, 85, 0.4);
    border: var(--glass-border);
    border-radius: var(--element-radius);
    color: var(--text-primary);
    padding: 0.8rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    max-height: 300px;
    transition: var(--transition);
}

.edit-message-area:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: var(--glow);
}

.edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-end;
}

.save-edit,
.cancel-edit {
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.save-edit {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.save-edit:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.cancel-edit {
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: var(--text-primary);
    border: var(--glass-border);
}

.cancel-edit:hover {
    background-color: var(--bg-hover);
    transform: translateY(-2px);
}

.message-action-btn.speaking {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-glow 1.5s infinite alternate;
}

/* Add this to your CSS */
#voice-input.active {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-recording 1.5s infinite alternate;
}

.ai-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Circuit pattern */
.circuit-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(to right, var(--accent-light) 1px, transparent 1px),
        linear-gradient(to bottom, var(--accent-light) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.15;
}

/* Data particles animation */
.data-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(var(--accent-color) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.2;
    animation: particleMovement 30s infinite linear;
}

/* Flowing data effect */
.data-particles::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(45deg, var(--accent-color) 0px, var(--accent-color) 1px, transparent 1px, transparent 15px);
    opacity: 0.15;
    animation: dataFlow 20s infinite linear;
}

/* Ambient glow */
.glow-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, var(--glow-color) 0%, transparent 60%);
    opacity: 0.15;
    animation: pulseGlow 8s infinite ease-in-out;
}

/* Chat messages container styling */
.chat-messages {
    position: relative;
    z-index: 1;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    /* Add backdrop filter for better text readability */
    backdrop-filter: blur(5px);
}

/* Animations */
@keyframes particleMovement {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 100% 100%;
    }
}

@keyframes dataFlow {
    0% {
        transform: translateX(-50%) translateY(-50%);
    }

    100% {
        transform: translateX(0%) translateY(0%);
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        opacity: 0.15;
        transform: scale(1);
    }

    50% {
        opacity: 0.25;
        transform: scale(1.2);
    }
}

/* Make sure the animations respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {

    .data-particles,
    .data-particles::before,
    .glow-effect {
        animation: none;
    }
}

/* Adjustments for light/dark themes */
body.light-theme .ai-background {
    opacity: 0.7;
}

body.dark-theme .glow-effect {
    opacity: 0.25;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Add this to your CSS */
#voice-input.active {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-recording 1.5s infinite alternate;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Add this to your CSS */
#voice-input.active {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-recording 1.5s infinite alternate;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Add this to your CSS */
#voice-input.active {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-recording 1.5s infinite alternate;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Add this to your CSS */
#voice-input.active {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-recording 1.5s infinite alternate;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Add this to your CSS */
#voice-input.active {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-recording 1.5s infinite alternate;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Add this to your CSS */
#voice-input.active {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-recording 1.5s infinite alternate;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Add this to your CSS */
#voice-input.active {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-recording 1.5s infinite alternate;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Add this to your CSS */
#voice-input.active {
    background-color: var(--accent-color);
    color: white;
    animation: pulse-recording 1.5s infinite alternate;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 5px var(--accent-color-transparent);
    }

    100% {
        box-shadow: 0 0 15px var(--accent-color);
    }
}

/* Ensure proper styling in light theme */
body.light-theme .edit-message-area {
    background: rgba(241, 245, 249, 0.7);
}

/* Make the edit experience smooth for both user and assistant messages */
.message.assistant .edit-message-area,
.message.user .edit-message-area {
    background: rgba(51, 65, 85, 0.4);
}

body.light-theme .message.assistant .edit-message-area,
body.light-theme .message.user .edit-message-area {
    background: rgba(241, 245, 249, 0.8);
}

/* Light Theme Styles */
body.light-theme {
    --primary-gradient: linear-gradient(135deg, #0066FF, #00CCFF);
    --accent-color: #0088FF;
    --accent-light: rgba(0, 136, 255, 0.15);
    --accent-hover: #0066DD;
    --glow-color: rgba(0, 136, 255, 0.35);
    --text-primary: #0F172A;
    --text-secondary: rgba(15, 23, 42, 0.7);
    --text-tertiary: rgba(15, 23, 42, 0.4);
    --bg-dark: #E9EFFD;
    --bg-panel: rgba(245, 250, 255, 0.8);
    --bg-element: rgba(226, 236, 250, 0.65);
    --bg-hover: rgba(0, 136, 255, 0.08);
    --border-color: rgba(0, 136, 255, 0.12);
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    --glass-bg: linear-gradient(135deg, rgba(245, 250, 255, 0.75), rgba(225, 240, 255, 0.6));
    --glass-border: 1px solid rgba(0, 136, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 68, 255, 0.07);
}

body.light-theme .user .message-bubble {
    color: #fff;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .side-panel {
        width: 230px;
        padding: 1.5rem 0.8rem;
    }

    .menu-item {
        padding: 0.7rem 1rem;
    }

    .menu-icon {
        margin-right: 0.8rem;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .side-panel {
        position: fixed;
        width: 270px;
        left: -270px;
        transition: left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        z-index: 100;
    }

    .side-panel.active {
        left: 0;
    }

    .content-area {
        width: 100%;
    }

    .content-header {
        padding: 1.2rem;
    }

    .chat-messages {
        padding: 1.2rem 0.8rem;
    }

    .message {
        max-width: 90%;
    }

    .chat-input-wrapper {
        padding: 1.2rem;
    }

    .personality-grid,
    .history-container {
        grid-template-columns: 1fr;
    }

    .input-suggestions {
        display: none;
        /* Hide suggestion chips on mobile to save space */
    }

    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 99;
        transition: opacity 0.3s ease;
        opacity: 0;
    }

    .mobile-menu-overlay.active {
        display: block;
        opacity: 1;
    }

    body.menu-open {
        overflow: hidden;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .action-btn {
        width: 36px;
        height: 36px;
    }

    /* Special handling for tooltips */
    .header-actions button[data-tooltip]:hover::after {
        bottom: -30px;
        font-size: 0.7rem;
        padding: 6px 8px;
    }

    .input-action-btn {
        width: 40px;
        height: 40px;
    }

    .send-btn {
        width: 44px;
        height: 44px;
    }

    /* Increase vertical spacing for form elements */
    .toggle-setting {
        padding: 1rem 0;
    }

    /* Make modal buttons more touch-friendly */
    .modal-footer .primary-btn,
    .modal-footer .secondary-btn {
        padding: 0.9rem 1.2rem;
        min-width: 80px;
    }

    /* Better modal handling */
    .modal {
        width: 95%;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.8rem 1rem 1rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .message-bubble {
        padding: 0.8rem 1.2rem;
        line-height: 1.5;
        font-size: 0.95rem;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .personality-card h4 {
        font-size: 1rem;
    }

    .personality-card p {
        font-size: 0.85rem;
    }

    html,
    body {
        height: 100%;
        overflow: hidden;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .app-container {
        height: 100%;
        width: 100%;
    }

    .content-area {
        height: 100%;
        overflow: hidden;
    }

    .chat-container {
        height: calc(100% - 56px);
        /* Subtract header height */
    }

    .chat-messages {
        height: calc(100% - 90px);
        /* Adjust based on your input height */
        max-height: none;
    }

    /* Fix for iOS Safari specifically */
    @supports (-webkit-touch-callout: none) {

        .chat-container,
        .content-area {
            height: -webkit-fill-available;
        }
    }

    .notification-container {
        top: 80px;
        right: 10px;
        left: 10px;
        width: auto;
    }

    .notification {
        max-width: none;
        width: 100%;
        padding: 0.8rem 1rem;
        border-radius: 10px;
        font-size: 0.9rem;
    }

    .notification-icon i {
        font-size: 0.9rem;
    }

    .section-title {
        margin-left: 50px;
        font-size: 1.2rem;
    }

    .side-panel {
        position: fixed;
        width: 270px;
        left: -270px;
        transition: left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        z-index: 100;
        /* Fix height issues */
        height: 100%;
        top: 0;
        bottom: 0;
        overflow-y: auto;
        padding-bottom: 2rem;
    }

    /* For iOS Safari */
    @supports (-webkit-touch-callout: none) {
        .side-panel {
            height: -webkit-fill-available;
        }
    }
}

/* Add landscape mode specific styles */
@media (max-width: 768px) and (orientation: landscape) {
    .side-panel {
        padding-top: 1rem;
    }

    .ai-logo {
        width: 50px;
        height: 50px;
        margin-bottom: 0.5rem;
    }

    .brand h3 {
        font-size: 1.2rem;
    }

    .nav-menu {
        margin-top: 0.5rem;
    }

    .menu-item {
        margin-bottom: 0.5rem;
        padding: 0.6rem 1rem;
    }

    .chat-messages {
        max-height: 40vh;
    }
}

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

    .message-bubble {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }

    .chat-messages {
        padding: 1rem 0.5rem;
        /* Even less padding on very small screens */
    }

    .section-title {
        margin-left: 50px;
        font-size: 1rem;
            max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* Add a tooltip on hover to show full name */
    cursor: help;
    }

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

    .content-header {
        padding: 1rem;
    }

    .header-actions {
        gap: 0.3rem;
    }

    .header-actions .action-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    #chat-input::placeholder {
        font-size: 0.7rem;
    }

    .mobile-rename-export {
        display: none;
    }

    /* Hide header buttons that will be in modal on mobile */
    .header-actions #rename-btn,
    .header-actions #export-btn {
        display: none;
    }

    .notification-container {
        top: 80px;
    }

    .notification {
        padding: 0.7rem 0.9rem;
        font-size: 0.85rem;
    }
}

@media (min-width: 481px) {

    /* Hide these options in the modal on desktop */
    #rename-option,
    #export-option {
        display: none;
    }
}

/* Add this to the bottom of your CSS file */

/* Markdown Content Styling */
.markdown-content {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Headings */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.2em;
    margin-bottom: 0.5em;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-content h1 {
    font-size: 1.8em;
}

.markdown-content h2 {
    font-size: 1.5em;
}

.markdown-content h3 {
    font-size: 1.3em;
}

.markdown-content h4 {
    font-size: 1.15em;
}

.markdown-content h5 {
    font-size: 1.05em;
}

.markdown-content h6 {
    font-size: 1em;
}

/* Paragraphs and spacing */
.markdown-content p {
    margin-bottom: 1em;
}

/* Lists */
.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-content li {
    margin-bottom: 0.5em;
}

.markdown-content ul {
    list-style-type: disc;
}

.markdown-content ol {
    list-style-type: decimal;
}

/* Code blocks */
.markdown-content pre {
    margin: 1em 0;
    padding: 1em;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.8) !important;
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    border: 1px solid var(--border-color);
    max-width: 100%;
    white-space: pre-wrap;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    font-size: inherit;
    color: #e6e6e6;
    white-space: pre;
}

/* Inline code */
.markdown-content code {
    font-family: 'Fira Code', monospace;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 4px;
    padding: 0.2em 0.4em;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

/* Blockquotes */
.markdown-content blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid var(--accent-color);
    background: rgba(30, 41, 59, 0.4);
    border-radius: 4px;
    font-style: italic;
}

/* Tables */
.markdown-content table {
    width: 100%;
    margin: 1em 0;
    border-collapse: collapse;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 8px;
    overflow: hidden;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

.markdown-content th {
    background: rgba(0, 204, 255, 0.2);
    padding: 0.75em 1em;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.markdown-content td {
    padding: 0.75em 1em;
    border-bottom: 1px solid var(--border-color);
}

.markdown-content tbody tr:last-child td {
    border-bottom: none;
}

.markdown-content tbody tr:hover {
    background: rgba(0, 204, 255, 0.08);
}

/* Horizontal rule */
.markdown-content hr {
    margin: 1.5em 0;
    border: none;
    height: 1px;
    background: var(--border-color);
}

/* Links */
.markdown-content a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--transition);
    word-break: break-all;
    overflow-wrap: break-word;
}

.markdown-content a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

/* Images */
.markdown-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1em 0;
}

/* Code block header with language name */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.9);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 0.5em 1em;
    font-family: 'Inter', sans-serif;
    font-size: 0.85em;
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.code-header+pre {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.language-name {
    color: var(--accent-color);
    font-weight: 500;
}

.copy-button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 4px;
    padding: 0.25em 0.5em;
    font-size: 0.85em;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-button:hover {
    background: rgba(0, 204, 255, 0.1);
    color: var(--text-primary);
}

.copy-button i {
    font-size: 0.9em;
}

/* Light theme adjustments */
body.light-theme .markdown-content pre {
    background: rgba(226, 232, 240, 0.8) !important;
}

body.light-theme .markdown-content code {
    background: rgba(226, 232, 240, 0.6);
    color: #0F172A;
}

body.light-theme .markdown-content pre code {
    color: #334155;
}

body.light-theme .code-header {
    background: rgba(241, 245, 249, 0.9);
}

body.light-theme .markdown-content blockquote {
    background: rgba(226, 232, 240, 0.4);
}

body.light-theme .markdown-content table {
    background: rgba(226, 232, 240, 0.6);
}

body.light-theme .markdown-content th {
    background: rgba(0, 136, 255, 0.1);
}

.code-no-highlight {
    background-color: #282c34;
    color: #abb2bf;
    padding: 0.5em;
    border-radius: 3px;
    font-family: monospace;
    white-space: pre-wrap;
}

.suggestion-chip.loading {
    background: linear-gradient(90deg, #6a11cb 0%, #8e62d1 50%, #6a11cb 100%);
    background-size: 200% 100%;
    animation: loading-gradient 2s infinite linear;
    color: white;
}

@keyframes loading-gradient {
    0% {
        background-position: 0% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Footer Styles */
.app-footer {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: var(--glass-border);
    padding: 0.8rem 0;
    position: relative;
    z-index: 5;
    margin-top: auto;
}

.footer-bottom {
    text-align: center;
    padding: 0 2rem;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
}

/* Responsive Footer */
@media (max-width: 768px) {
    .app-footer {
        padding: 0.6rem 0;
    }

    .footer-bottom {
        padding: 0 1rem;
    }

    .footer-bottom p {
        font-size: 0.8rem;
    }

    .markdown-content pre {
        font-size: 0.8em;
        padding: 0.8em;
        overflow-x: auto;
        white-space: pre;
        word-wrap: normal;
    }

    .markdown-content pre code {
        font-size: 0.8em;
        white-space: pre;
    }

    /* Make code header responsive */
    .code-header {
        padding: 0.4em 0.8em;
        font-size: 0.8em;
        flex-wrap: wrap;
        gap: 0.5em;
    }

    .copy-button {
        font-size: 0.75em;
        padding: 0.2em 0.4em;
    }

    .markdown-content table {
        font-size: 0.85em;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        max-width: 100%;
    }

    .markdown-content th,
    .markdown-content td {
        padding: 0.5em 0.75em;
        min-width: 100px;
    }

    .markdown-content ul,
    .markdown-content ol {
        padding-left: 1.5em;
    }

    .markdown-content li {
        margin-bottom: 0.4em;
        word-wrap: break-word;
    }

    .markdown-content blockquote {
        margin: 0.8em 0;
        padding: 0.4em 0.8em;
        font-size: 0.9em;
    }

    .markdown-content h1 {
        font-size: 1.5em;
    }

    .markdown-content h2 {
        font-size: 1.3em;
    }

    .markdown-content h3 {
        font-size: 1.2em;
    }

    .markdown-content h4 {
        font-size: 1.1em;
    }

    .markdown-content h5 {
        font-size: 1.05em;
    }

    .markdown-content h6 {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .footer-bottom p {
        font-size: 0.75rem;
        line-height: 1.4;
    }
}

/* YouTube Integration Styles - Enhanced Mobile Support */
.youtube-result {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--element-radius);
    padding: 1rem;
    margin: 1rem 0;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.youtube-result h4 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    line-height: 1.3;
    word-break: break-word;
}

.youtube-result .video-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.youtube-result .video-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: fit-content;
}

.youtube-button {
    background: linear-gradient(135deg, #FF0000, #CC0000);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: var(--element-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    width: fit-content;
}

.youtube-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 0, 0.3);
}

.video-thumbnail {
    max-width: 100%;
    height: auto;
    border-radius: var(--element-radius);
    margin: 0.5rem 0;
    display: block;
}

/* YouTube search suggestions */
.youtube-suggestions {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--element-radius);
    padding: 1rem;
    margin: 1rem 0;
    backdrop-filter: blur(10px);
}

.youtube-suggestions h4 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.youtube-suggestions .suggestion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.youtube-suggestions .suggestion-item {
    background: var(--bg-element);
    padding: 0.75rem;
    border-radius: var(--element-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.youtube-suggestions .suggestion-item:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

/* Mobile responsiveness for YouTube features */
@media (max-width: 768px) {
    .youtube-result {
        padding: 0.8rem;
        margin: 0.8rem 0;
    }

    .youtube-result h4 {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }

    .youtube-result .video-stats {
        flex-direction: column;
        gap: 0.3rem;
        font-size: 0.85rem;
    }

    .youtube-result .video-stats span {
        justify-content: flex-start;
    }

    .youtube-button {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .video-thumbnail {
        margin: 0.4rem 0;
        border-radius: 8px;
    }

    .youtube-suggestions {
        padding: 0.8rem;
        margin: 0.8rem 0;
    }

    .youtube-suggestions h4 {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }

    .youtube-suggestions .suggestion-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .youtube-suggestions .suggestion-item {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    /* YouTube input buttons - make them more touch-friendly */
    #youtube-search,
    #youtube-analyze {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    #youtube-search i,
    #youtube-analyze i {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .youtube-result {
        padding: 0.7rem;
        margin: 0.7rem 0;
        border-radius: 10px;
    }

    .youtube-result h4 {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .youtube-result .video-stats {
        font-size: 0.8rem;
    }

    .youtube-button {
        padding: 0.6rem;
        font-size: 0.8rem;
        border-radius: 8px;
    }

    .youtube-suggestions {
        padding: 0.7rem;
        margin: 0.7rem 0;
        border-radius: 10px;
    }

    .youtube-suggestions h4 {
        font-size: 0.95rem;
    }

    .youtube-suggestions .suggestion-item {
        padding: 0.5rem;
        font-size: 0.85rem;
        border-radius: 8px;
    }

    /* Input buttons for very small screens */
    #youtube-search,
    #youtube-analyze {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    /* Handle landscape mode on mobile */
    @media (orientation: landscape) {
        .youtube-result {
            padding: 0.6rem;
        }

        .youtube-result h4 {
            font-size: 0.9rem;
        }

        .youtube-button {
            padding: 0.5rem 0.7rem;
            font-size: 0.75rem;
        }
    }
}

/* Add these styles to your existing CSS */

/* YouTube Video Player Styles */
.youtube-player-embed {
    margin: 1rem 0;
    border-radius: var(--element-radius);
    overflow: hidden;
    background: var(--glass-bg);
    border: var(--glass-border);
    padding: 0.5rem;
}

.youtube-player-container {
    position: relative;
    margin: 1rem 0;
}

.youtube-player-container iframe {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

.player-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.youtube-action-btn {
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--element-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(5px);
}

.youtube-action-btn:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.youtube-action-btn.secondary {
    background: transparent;
    border: 1px solid var(--border-color);
}

/* Play Button Styles */
.youtube-play-button-container {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0;
    flex-wrap: wrap;
}

.youtube-play-btn {
    background: linear-gradient(135deg, #FF0000, #CC0000);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--element-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 3px 10px rgba(255, 0, 0, 0.3);
}

.youtube-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 0, 0, 0.4);
}

.youtube-play-btn i {
    font-size: 1rem;
}

/* Playlist Player Styles */
.youtube-playlist-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1rem;
    margin: 1rem 0;
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--element-radius);
    padding: 1rem;
    backdrop-filter: blur(10px);
}

.current-player {
    width: 100%;
}

.playlist-sidebar {
    background: rgba(30, 41, 59, 0.4);
    border-radius: var(--element-radius);
    padding: 1rem;
    border: var(--glass-border);
}

.playlist-sidebar h4 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.playlist-items {
    max-height: 400px;
    overflow-y: auto;
}

.playlist-item {
    display: flex;
    gap: 0.8rem;
    padding: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}

.playlist-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-color);
}

.playlist-item.active {
    background: var(--accent-light);
    border-color: var(--accent-color);
}

.playlist-thumbnail {
    width: 60px;
    height: 45px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

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

.playlist-title {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 0.2rem;
    color: var(--text-primary);
    word-wrap: break-word;
}

.playlist-duration {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Mobile Responsive Video Player */
@media (max-width: 768px) {
    .youtube-playlist-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.8rem;
    }

    .playlist-sidebar {
        order: 2;
        max-height: 300px;
    }

    .current-player {
        order: 1;
    }

    .youtube-player-container iframe {
        height: 250px !important;
    }

    .player-controls {
        gap: 0.3rem;
    }

    .youtube-action-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .youtube-play-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
    }

    .youtube-play-button-container {
        flex-direction: column;
        gap: 0.3rem;
    }

    .playlist-item {
        padding: 0.6rem;
        gap: 0.6rem;
    }

    .playlist-thumbnail {
        width: 50px;
        height: 38px;
    }

    .playlist-title {
        font-size: 0.8rem;
    }

    .playlist-duration {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .youtube-player-embed {
        padding: 0.3rem;
        margin: 0.8rem 0;
    }

    .youtube-player-container iframe {
        height: 200px !important;
    }

    .youtube-action-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .youtube-play-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }

    .playlist-sidebar {
        padding: 0.8rem;
    }

    .playlist-items {
        max-height: 250px;
    }
}

/* Light theme adjustments */
body.light-theme .youtube-player-embed {
    background: rgba(226, 232, 240, 0.6);
}

body.light-theme .playlist-sidebar {
    background: rgba(226, 232, 240, 0.4);
}

body.light-theme .playlist-item.active {
    background: rgba(0, 136, 255, 0.1);
}

/* Video loading state */
.youtube-player-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 315px;
    background: var(--glass-bg);
    border-radius: 8px;
    border: var(--glass-border);
}

.youtube-player-loading i {
    font-size: 2rem;
    color: var(--accent-color);
    animation: spin 1s linear infinite;
}

/* Responsive iframe container */
.youtube-responsive-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    border-radius: 8px;
}

.youtube-responsive-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Special handling for YouTube content in message bubbles */
.message .youtube-result {
    margin: 0.5rem 0;
    max-width: 100%;
}

.message.assistant .youtube-result {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(0, 204, 255, 0.15);
}

/* YouTube video analysis styles */
.youtube-video-analysis {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--element-radius);
    padding: 1rem;
    margin: 1rem 0;
    backdrop-filter: blur(10px);
}

.youtube-video-analysis h3 {
    color: var(--accent-color);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.youtube-video-analysis .video-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.youtube-video-analysis .video-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.youtube-video-analysis .video-info-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.youtube-video-analysis .video-info-value {
    font-weight: 500;
    color: var(--text-primary);
}

/* Mobile styles for video analysis */
@media (max-width: 768px) {
    .youtube-video-analysis {
        padding: 0.8rem;
        margin: 0.8rem 0;
    }

    .youtube-video-analysis h3 {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }

    .youtube-video-analysis .video-info {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .youtube-video-analysis .video-info-item {
        gap: 0.1rem;
    }

    .youtube-video-analysis .video-info-label {
        font-size: 0.75rem;
    }

    .youtube-video-analysis .video-info-value {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .youtube-video-analysis {
        padding: 0.7rem;
        border-radius: 10px;
    }

    .youtube-video-analysis h3 {
        font-size: 0.95rem;
    }

    .youtube-video-analysis .video-info-value {
        font-size: 0.85rem;
    }
}

/* Loading states for YouTube features */
.youtube-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--glass-bg);
    border-radius: var(--element-radius);
    margin: 1rem 0;
}

.youtube-loading i {
    font-size: 2rem;
    color: var(--accent-color);
    animation: spin 1s linear infinite;
}

.youtube-loading span {
    margin-left: 1rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .youtube-loading {
        padding: 1.5rem;
        margin: 0.8rem 0;
    }

    .youtube-loading i {
        font-size: 1.5rem;
    }

    .youtube-loading span {
        font-size: 0.9rem;
        margin-left: 0.8rem;
    }
}

/* Error states for YouTube features */
.youtube-error {
    background: rgba(255, 58, 94, 0.1);
    border: 1px solid rgba(255, 58, 94, 0.2);
    border-radius: var(--element-radius);
    padding: 1rem;
    margin: 1rem 0;
    color: var(--danger-color);
}

.youtube-error i {
    margin-right: 0.5rem;
}

@media (max-width: 768px) {
    .youtube-error {
        padding: 0.8rem;
        margin: 0.8rem 0;
        font-size: 0.9rem;
        border-radius: 8px;
    }
}

/* YouTube URL input styling */
.youtube-url-input {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--element-radius);
    padding: 0.8rem 1rem;
    margin: 0.5rem 0;
    width: 100%;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: var(--transition);
}

.youtube-url-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: var(--glow);
}

.youtube-url-input::placeholder {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .youtube-url-input {
        padding: 0.7rem 0.8rem;
        font-size: 0.85rem;
        border-radius: 8px;
    }
}

/* YouTube feature indicators */
.youtube-feature-indicator {
    position: relative;
    display: inline-block;
}

.youtube-feature-indicator::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #FF0000;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
}

@media (max-width: 768px) {
    .youtube-feature-indicator::after {
        width: 6px;
        height: 6px;
        top: -1px;
        right: -1px;
    }
}

/* Add these styles to your existing CSS file */

/* Mobile Action Popup Styles */
.mobile-action-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-action-popup.active {
    display: flex;
    opacity: 1;
}

.mobile-action-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.mobile-action-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border: var(--glass-border);
    border-bottom: none;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    max-height: 60vh;
    overflow-y: auto;
}

.mobile-action-popup.active .mobile-action-content {
    transform: translateY(0);
}

.mobile-action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: var(--glass-border);
    position: sticky;
    top: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10;
}

.mobile-action-header h4 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.mobile-action-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-action-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    transform: rotate(90deg);
}

.mobile-action-buttons {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-action-btn {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--element-radius);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.mobile-action-btn:hover,
.mobile-action-btn:active {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.mobile-action-btn:active {
    transform: translateY(0);
}

.mobile-action-btn i {
    font-size: 1.2rem;
    color: var(--accent-color);
    width: 24px;
    text-align: center;
}

.mobile-action-btn span {
    flex: 1;
}

/* Special styling for YouTube buttons in mobile popup */
.mobile-action-btn.youtube-feature-indicator i {
    color: #FF0000;
}

.mobile-action-btn#mobile-voice-input i {
    color: #10B981;
}

.mobile-action-btn#mobile-attach-file i {
    color: #8B5CF6;
}

/* Mobile more button - only visible on small screens */
.mobile-more-btn {
    display: none;
}

/* Desktop action buttons - hidden on mobile */
.desktop-action-btn {
    display: flex;
}

/* Mobile responsive styles */
@media (max-width: 450px) {

    /* Hide desktop action buttons */
    .desktop-action-btn {
        display: none;
    }

    /* Show mobile more button */
    .mobile-more-btn {
        display: flex;
        background: var(--primary-gradient);
        color: white;
        box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
    }

    .mobile-more-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--glow-strong);
    }

    /* Adjust input container for mobile */
    .input-actions {
        gap: 0.3rem;
    }

    .input-action-btn {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }

    .send-btn {
        width: 42px;
        height: 42px;
        margin-left: 0.3rem;
    }

    /* Adjust mobile popup for very small screens */
    .mobile-action-content {
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }

    .mobile-action-header {
        padding: 0.8rem 1rem;
    }

    .mobile-action-header h4 {
        font-size: 1rem;
    }

    .mobile-action-buttons {
        padding: 0.8rem;
    }

    .mobile-action-btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        border-radius: 10px;
    }

    .mobile-action-btn i {
        font-size: 1.1rem;
        width: 22px;
    }
}

/* Very small screens (below 360px) */
@media (max-width: 360px) {
    .mobile-action-header {
        padding: 0.7rem 0.8rem;
    }

    .mobile-action-buttons {
        padding: 0.7rem;
    }

    .mobile-action-btn {
        padding: 0.7rem 0.8rem;
        font-size: 0.85rem;
        gap: 0.8rem;
    }

    .mobile-action-btn i {
        font-size: 1rem;
        width: 20px;
    }
}

/* Active states for mobile buttons */
.mobile-action-btn.active {
    background: var(--accent-light);
    color: var(--accent-color);
    box-shadow: var(--glow);
}

.mobile-action-btn.active i {
    color: var(--accent-color);
}

/* Animation for mobile popup appearance */
@keyframes slideUpMobile {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mobile-action-popup.active .mobile-action-content {
    animation: slideUpMobile 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Safe area handling for devices with notches */
@supports (padding: max(0px)) {
    .mobile-action-content {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Prevent scrolling when popup is open */
body.mobile-popup-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Light theme adjustments */
body.light-theme .mobile-action-overlay {
    background: rgba(255, 255, 255, 0.3);
}

body.light-theme .mobile-action-content {
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.1);
}

/* Add these styles to ensure YouTube buttons display properly */

.youtube-video-item {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--element-radius);
    padding: 1rem;
    margin: 1rem 0;
    backdrop-filter: blur(10px);
}

.youtube-video-item .video-thumbnail {
    display: block;
    max-width: 200px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
}

.youtube-play-button-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.youtube-play-btn {
    background: linear-gradient(135deg, #FF0000, #CC0000) !important;
    color: white !important;
    border: none !important;
    padding: 0.6rem 1rem !important;
    border-radius: var(--element-radius) !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    font-size: 0.9rem !important;
}

.youtube-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 0, 0.3);
}

.youtube-action-btn {
    background: var(--glass-bg) !important;
    color: var(--text-primary) !important;
    border: var(--glass-border) !important;
    padding: 0.6rem 1rem !important;
    border-radius: var(--element-radius) !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    font-size: 0.9rem !important;
}

.youtube-action-btn:hover {
    background: var(--bg-hover) !important;
    transform: translateY(-2px);
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .youtube-video-item {
        padding: 0.8rem;
        margin: 0.8rem 0;
    }
    
    .youtube-video-item .video-thumbnail {
        max-width: 100%;
        margin: 0.5rem 0;
    }
    
    .youtube-play-button-container {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .youtube-play-btn,
    .youtube-action-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.5rem !important;
        font-size: 0.85rem !important;
    }
}