/* Import variables */
@import url('variables.css');

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

body {
    background-color: var(--bg-light);
    height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    overflow: hidden;
}

/* Main Container */
.chat-container {
    display: flex;
    width: 100%;
    height: 100vh;
    background-color: var(--grey-800);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

/* Left Panel Styles */
.left-panel {
    position: relative;
    width: var(--sidebar-width);
    background-color: var(--grey-800);
    display: flex;
    flex-direction: column;
    border-right: none;
}

/* Create a container for the logo and new chat button */
.logo-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-sm);
    border-bottom: none;
}

/* Update logo styles */
.logo {
    text-align: left;
    border-bottom: none;
    padding: 0; /* Remove padding since it's now on the container */
}

.logo h1 {
    color: var(--teal-400);
    font-size: var(--font-xl);
}

.logo-image {
    height: 23px;
    width: 115px;
    object-fit: contain;
}

/* Logo clickable styling */
.logo {
    transition: opacity var(--transition-fast);
    cursor: pointer;
}

.logo:hover {
    opacity: 0.8;
}

.mobile-logo {
    transition: opacity var(--transition-fast);
    cursor: pointer;
}

.mobile-logo:hover {
    opacity: 0.8;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
}

.chat-history h2 {
    font: var(--heading-400);
    color: var(--grey-0);
    margin-bottom: var(--space-md);
    padding-left: var(--space-sm);
    letter-spacing: var(--letter-spacing-heading);
}

.conversation-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.conversation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-sm) var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    margin-bottom: var(--space-xs);
}

.conversation:hover {
    background-color: var(--grey-700);
}

.conversation.active {
    background-color: var(--grey-900);
}

.conversation-avatar {
    width: var(--avatar-size-sm);
    height: var(--avatar-size-sm);
    border-radius: var(--radius-circle);
    margin-right: var(--space-sm);
    flex-shrink: 0;
}

.conversation-info {
    flex: 1;
}

.conversation-info h3 {
    font: var(--body-sm);
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}


.conversation-info p {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Update User Navigation styles */
.user-nav {
    position: relative;
    z-index: 1001;
    padding: var(--space-sm) var(--space-sm);
    display: flex;
    justify-content: space-between;
    border-top: none;
    width: 100%;
    background-color: var(--grey-800);
}

.left-buttons, .right-buttons {
    display: flex;
    width: 100%; /* Make the container full width */
}

.nav-button {
    background: none;
    border: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    cursor: pointer;
    color: var(--grey-0);
    padding: var(--space-sm) var(--space-sm);
    border-radius: var(--radius-md);
    transition: opacity var(--transition-fast);
    width: 100%; /* Make the button full width */
}

.nav-button.active {
    background-color: var(--grey-900);
    width: 100%; /* Ensure active state also fills width */
}

/* Remove margin-right from the last button in each group */
.left-buttons .nav-button:last-child,
.right-buttons .nav-button:last-child {
    margin-right: 0;
}

.nav-button:hover {
    opacity: 0.8;
}

.nav-button i, 
.nav-button .nav-icon {
    font-size: var(--font-lg);
    margin-right: var(--space-sm); /* Change from margin-bottom to margin-right */
    width: 20px; /* Set consistent width for icons */
    height: 20px;
}

.nav-icon {
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(100%);
}

/* Update typography styling for nav button text to use body-xs */
.nav-button span {
    font: var(--body-xs);
    letter-spacing: var(--letter-spacing-heading);
}

/* Chat Area Styles */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: var(--space-md);
    margin-left: 0;
    background-color: var(--grey-900);
    border-radius: var(--radius-md);
    overflow: hidden;
    align-items: center;
}

.chat-messages {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-image: url('https://web.whatsapp.com/img/bg-chat-tile-dark_f1e8249ce2bef1b32d6df52488c624f3.png');
    background-repeat: repeat;
    width: 100%;
    max-width: 600px;
}

.message {
    max-width: var(--message-max-width);
    margin-bottom: var(--space-md);
    display: flex;
    flex-direction: column;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.message-sender-info {
    display: flex;
    margin-left: var(--space-sm);
}

.message-avatar {
    width: var(--avatar-size-sm);
    height: var(--avatar-size-sm);
    border-radius: var(--radius-circle);
    flex-shrink: 0;
}

.message-content {
    background-color: var(--bg-message-received);
    padding: var(--space-md) var(--space-md);
    border-radius: var(--radius-md);
    position: relative;
}

.shane-message {
    align-self: flex-start;
}

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

.user-message .message-header {
    flex-direction: row-reverse;
    margin-bottom: var(--space-sm);
}

.user-message .message-sender-info {
    margin-left: 0;
    margin-right: var(--space-sm);
    align-items: flex-end;
}

.user-message .message-content {
    background-color: var(--bg-message-sent);
}

.message-sender {
    font: var(--heading-500);
    color: var(--grey-0);
}

.message-time {
    display: none;
}

.message-content p {
    font-size: var(--font-sm);
    line-height: 1.4;
}

/* Message Bubble Styles */
.user-message-bubble {
    font: var(--body-sm);
    color: var(--grey-0);
    line-height: 1.5;
}

/* Removed - .ai-message-content div no longer used */

.ai-avatar {
    flex-shrink: 0;
}

.ai-avatar-img {
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Desktop avatar - hide on mobile */
.ai-avatar-desktop {
    display: block;
}

@media (max-width: 768px) {
    .ai-avatar-desktop {
        display: none;
    }
}

/* Mobile avatar - hide on desktop, show on mobile */
.ai-avatar-mobile {
    display: none;
}

@media (max-width: 768px) {
    .ai-avatar-mobile {
        display: block;
        max-width: 40px;
        max-height: 40px;
    }
}

.ai-message-bubble {
    font: var(--body-sm);
    color: var(--grey-0);
    line-height: 1.6;
}

/* AI Message Layout - Avatar outside shaded area */
.ai-message,
.assistant-message {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start;
}

.ai-message .ai-avatar,
.assistant-message .ai-avatar {
    margin-bottom: var(--space-md);
}

.ai-message .message-content,
.assistant-message .message-content {
    background-color: transparent !important;
    padding: 0 !important;
}

.ai-message .ai-message-bubble,
.assistant-message .ai-message-bubble {
    background-color: var(--bg-message-received);
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

/* Markdown Element Styles - Only for AI Messages */
.ai-message-bubble p {
    margin: 0 0 var(--space-sm) 0;
}

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

.ai-message-bubble h1,
.ai-message-bubble h2,
.ai-message-bubble h3,
.ai-message-bubble h4,
.ai-message-bubble h5,
.ai-message-bubble h6 {
    color: var(--grey-0);
    margin: var(--space-md) 0 var(--space-sm) 0;
    line-height: 1.3;
}

.ai-message-bubble h1 {
    font: var(--heading-700);
}

.ai-message-bubble h2 {
    font: var(--heading-600);
}

.ai-message-bubble h3 {
    font: var(--heading-500);
}

.ai-message-bubble h4 {
    font: var(--heading-400);
}

.ai-message-bubble h5,
.ai-message-bubble h6 {
    font: var(--heading-300);
}

.ai-message-bubble h1:first-child,
.ai-message-bubble h2:first-child,
.ai-message-bubble h3:first-child,
.ai-message-bubble h4:first-child,
.ai-message-bubble h5:first-child,
.ai-message-bubble h6:first-child {
    margin-top: 0;
}

.ai-message-bubble strong {
    font-weight: 700;
    color: var(--grey-0);
}

.ai-message-bubble em {
    font-style: italic;
}

.ai-message-bubble code {
    background-color: var(--grey-700);
    color: var(--teal-200);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.ai-message-bubble pre {
    background-color: var(--grey-700);
    border: 1px solid var(--grey-600);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin: var(--space-sm) 0;
    overflow-x: auto;
}

.ai-message-bubble pre code {
    background-color: transparent;
    color: var(--grey-0);
    padding: 0;
    border-radius: 0;
    font-size: 0.85em;
    line-height: 1.5;
}

.ai-message-bubble ul,
.ai-message-bubble ol {
    margin: var(--space-sm) 0;
    padding-left: var(--space-lg);
}

.ai-message-bubble li {
    margin: var(--space-xs) 0;
    line-height: 1.5;
}

.ai-message-bubble ul {
    list-style-type: disc;
}

.ai-message-bubble ol {
    list-style-type: decimal;
}

.ai-message-bubble blockquote {
    border-left: 3px solid var(--teal-500);
    padding-left: var(--space-md);
    margin: var(--space-sm) 0;
    color: var(--grey-300);
    font-style: italic;
}

.ai-message-bubble a {
    color: var(--teal-400);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}

.ai-message-bubble a:hover {
    border-bottom-color: var(--teal-400);
}

.ai-message-bubble table {
    border-collapse: collapse;
    margin: var(--space-sm) 0;
    width: 100%;
}

.ai-message-bubble th,
.ai-message-bubble td {
    border: 1px solid var(--grey-600);
    padding: var(--space-xs) var(--space-sm);
    text-align: left;
}

.ai-message-bubble th {
    background-color: var(--grey-700);
    font-weight: 700;
    color: var(--grey-0);
}

.ai-message-bubble td {
    background-color: var(--grey-800);
}

.ai-message-bubble hr {
    border: none;
    border-top: 1px solid var(--grey-600);
    margin: var(--space-md) 0;
}

.chat-input {
    padding: var(--space-md);
    background-color: var(--grey-900);
    border-top: none;
    width: 100%;
    max-width: 600px;
}

.input-container {
    display: flex;
    align-items: flex-end;
    background-color: var(--grey-800);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--grey-600);
    min-height: 44px;
    transition: height 0.1s ease;
}

.input-container button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-lg);
    cursor: pointer;
    padding: var(--space-xs);
    align-self: center;
    margin: 0;
    border-radius: var(--radius-md);
}

.input-container button:hover {
    color: var(--primary-color);
}

.input-container input {
    flex: 1;
    border: none;
    outline: none;
    padding: var(--space-sm);
    font-size: var(--font-sm);
    background-color: transparent;
    color: var(--text-primary);
    max-height: 120px;
    overflow-y: auto;
}

.input-container textarea {
    flex: 1;
    border: none;
    outline: none;
    padding: var(--space-xs);
    font-size: var(--font-sm);
    background-color: transparent;
    color: var(--text-primary);
    resize: none;
    min-height: 24px;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.4;
    display: block;
    width: 100%;
    margin: 0; /* Remove any default margins */
}

/* Style for textarea placeholder */
.input-container textarea::placeholder {
    color: var(--grey-300);
    opacity: 1; /* Firefox applies opacity to placeholders, this ensures consistency */
}

/* For older browsers */
.input-container textarea::-webkit-input-placeholder {
    color: var(--grey-300);
}

.input-container textarea::-moz-placeholder {
    color: var(--grey-300);
}

.input-container textarea:-ms-input-placeholder {
    color: var(--grey-300);
}

.input-container textarea:-moz-placeholder {
    color: var(--grey-300);
}

/* Update the send button to remove margin */
.input-container .send-button {
    color: var(--text-secondary);
    margin: 0;
    padding: var(--space-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-image: url('../assets/send.svg');
    background-size: 24px 24px;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity var(--transition-fast);
}

/* Send button active state - show active icon when pressed */
.input-container .send-button:active:not(:disabled) {
    background-image: url('../assets/send-active.svg');
}

/* Send button disabled state - pulse animation while AI is working */
.input-container .send-button:disabled {
    cursor: wait;
    animation: pulse 1.2s ease-in-out infinite;
}

/* Pulse animation for disabled send button */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Disclaimer styling */
.disclaimer {
    margin-top: var(--space-xs);
    text-align: center;
    font-size: var(--font-xs);
    color: var(--grey-400);
    font-style: italic;
}

.disclaimer-text {
    font-size: 10px;
    color: var(--grey-400);
    font-style: normal;
}

.rate-limit-warning {
    font-size: 10px;
    color: #ff4444;
    font-style: normal;
    text-align: center;
    font-weight: 600;
}

/* Mobile Header Styles */
.mobile-header {
    display: none;
    height: 56px;
    background-color: var(--grey-800);
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);
    z-index: 1001;
}

.mobile-menu-btn,
.mobile-new-chat-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
    text-decoration: none; /* Ensure links look identical to buttons */
}

.mobile-menu-btn:hover,
.mobile-new-chat-btn:hover {
    background-color: var(--grey-900);
}

.mobile-menu-btn:active,
.mobile-new-chat-btn:active {
    background-color: var(--grey-700);
}

.mobile-menu-btn:focus,
.mobile-new-chat-btn:focus {
    outline: none;
    background-color: transparent;
}

.mobile-menu-icon,
.mobile-new-chat-icon {
    width: 24px;
    height: 24px;
    filter: brightness(0) saturate(100%) invert(100%);
}

.mobile-logo {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-logo-image {
    height: 23px;
    width: auto;
}

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    cursor: pointer;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .chat-container {
        flex-direction: column;
        height: 100vh;
        border-radius: 0;
    }
    
    .left-panel {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .left-panel.mobile-open {
        left: 0;
    }
    
    /* Mobile sidebar toggle - show sidebar when checkbox checked */
    #mobile-sidebar-toggle:checked ~ .chat-container .left-panel {
        left: 0;
    }
    
    /* Mobile sidebar overlay - show when sidebar is open */
    #mobile-sidebar-toggle:checked ~ .mobile-sidebar-overlay {
        display: block;
    }
    
    .chat-area {
        margin: 0 16px 16px 16px;
        border-radius: 8px;
    }
    
    .settings-view {
        margin: 0 16px 16px 16px;
        border-radius: 8px;
    }
    
    /* Mobile conversation menu positioning */
    .conversation-menu-popup {
        max-width: calc(100vw - 32px);
    }
}

/* Hide mobile overlay in desktop view */
@media (min-width: 769px) {
    .mobile-sidebar-overlay {
        display: none;
    }
}

/* Style the new chat button */
.new-chat-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.new-chat-icon {
    height: 20px;
    width: 20px;
    color: var(--blue-300);
}

.new-chat-button:hover {
    opacity: 0.8;
}

/* New Chat Section */
.new-chat-section {
    padding: var(--space-sm);
}

.new-chat-main {
    padding: var(--space-sm);
    color: var(--blue-300);
    font: var(--heading-400);
    letter-spacing: var(--letter-spacing-heading);
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

.new-chat-main-icon {
    height: 20px;
    width: 20px;
    margin-left: 8px;
}

/* Gradient Styles */
.gradient-primary {
    background: var(--gradient-primary);
    color: white;
}

.gradient-secondary {
    background: var(--gradient-secondary);
    color: white;
}

/* Gradient Text Styles */
.gradient-text-primary {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

.gradient-text-secondary {
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

/* Gradient Border Styles */
.gradient-border-primary {
    position: relative;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.gradient-border-primary::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: -2px;
    border-radius: inherit;
    background: var(--gradient-primary);
    z-index: -1;
}

.gradient-border-secondary {
    position: relative;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.gradient-border-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: -2px;
    border-radius: inherit;
    background: var(--gradient-secondary);
    z-index: -1;
}

/* Update Shane message styling to remove border */
.shane-message .message-content {
    background-color: transparent;
    padding-left: 0;
    padding-right: 0;
    border-left: none;
    margin-left: 0;
}

/* Welcome Screen Styles */
.welcome-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    gap: var(--space-md);
}

/* Style for the input container when focused */
.input-container:focus-within {
    border-color: var(--active-color);
}

/* Update the conversation menu button to always be visible */
.conversation-menu {
    background: none;
    border: none;
    padding: var(--space-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.conversation-menu:hover {
    background-color: var(--grey-700);
    border-radius: var(--radius-sm);
}

.menu-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.conversation-menu:hover .menu-icon {
    opacity: 1;
}

/* Settings Panel Styles */
.user-panel {
    position: absolute;
    bottom: 60px;
    left: var(--space-sm);
    width: calc(var(--sidebar-width) - var(--space-md));
    height: auto;
    max-height: calc(100% - 120px);
    background-color: var(--grey-700);
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    transform: translateY(100%);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--grey-700);
    border-radius: var(--radius-md);
    visibility: hidden;
}

/* Checkbox hack for settings panel display */
#settings-panel-toggle:checked ~ .user-panel {
    transform: translateY(0);
    visibility: visible;
}



.user-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.settings-section {
    margin-bottom: var(--space-xl);
}

.settings-section h3 {
    color: var(--grey-0);
    margin-bottom: var(--space-md);
    margin-top: 0;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm ) 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: var(--space-xs);
}

.user-item {
    padding: 4px 0;
}

/* Override font weights for user details in settings panel */
.user-panel .heading-200 {
    font: var(--body-sm);
    font-weight: 400;
    letter-spacing: 0.01em;
}

.user-panel .heading-100 {
    font: var(--body-xs);
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* Remove the border from the last item in each section */
.settings-section .settings-item:last-child {
    border-bottom: none;
}

.settings-divider {
    height: 1px;
    background-color: var(--grey-600);
    margin: var(--space-md) 0;
}

.user-panel-divider {
    height: 1px;
    background-color: var(--grey-600);
    margin: var(--space-sm) 0;
}

.settings-label {
    color: var(--grey-0);
    font: var(--body-sm);
    font-weight: 400;
    letter-spacing: 0.01em;
}

.settings-link {
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: none;
}

.settings-link:hover {
    color: var(--active-color);
}

a.settings-link {
    color: inherit;
}



.settings-value {
    color: var(--grey-300);
    font: var(--body-sm);
}

.settings-select {
    background-color: var(--grey-700);
    color: var(--grey-0);
    border: none;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font: var(--body-md);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    width: auto;
    height: auto;
}

.toggle-container {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--grey-700);
    transition: .4s;
    border-radius: 18px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    top: 3px;
    background-color: var(--grey-0);
    transition: .4s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-container .toggle-slider {
    background-color: var(--blue-500);
}

.toggle input:checked + .toggle-container .toggle-slider:before {
    transform: translateX(14px);
}

/* Toggle text labels */
.toggle-text {
    font: 500 10px/1.4 'Open Sans', sans-serif;
    letter-spacing: 0.02em;
    color: var(--grey-400);
    text-transform: lowercase;
}

.toggle-text::after {
    content: "off";
}

.toggle input:checked ~ .toggle-text::after {
    content: "on";
}

/* Settings value with icon */
.settings-value-with-icon {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.edit-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast);
}

.edit-icon-btn:hover {
    background-color: var(--grey-700);
}

.edit-icon {
    width: 18px;
    height: 18px;
}

/* Settings Overlay */
.settings-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 999;
    cursor: pointer;
}

/* Show overlay when settings panel is open */
#settings-panel-toggle:checked ~ .settings-overlay {
    display: block;
}

/* Conversation Menu Popup */
.conversation-menu-popup {
    position: absolute;
    background-color: var(--grey-700);
    border: 1px solid var(--grey-600);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 120px;
    display: none;
    right: 0;
    top: 100%;
    margin-top: var(--space-xs);
}

/* Checkbox hack for menu toggle */
.menu-toggle:checked ~ .conversation-menu-popup {
    display: block;
}

/* Position conversation items relatively for popup positioning */
.conversation {
    position: relative;
}

.menu-option {
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    font: var(--body-sm);
    color: var(--grey-0);
    text-decoration: none;
}

.menu-option:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.menu-option:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.menu-option:hover {
    background-color: var(--grey-600);
}

.menu-option-danger {
    color: var(--red-400);
}

.menu-option-danger:hover {
    background-color: var(--red-900);
    color: var(--red-300);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1002;
    display: none;
    align-items: center;
    justify-content: center;
}

/* Checkbox hack for modal display - specific selectors - v2.0 */
#rename-modal-toggle:checked ~ #rename-conversation-modal {
    display: flex;
}

#delete-modal-toggle:checked ~ #delete-conversation-modal {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(28, 35, 49, 0.8);
}

/* Settings page full-screen backdrop */
.settings-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(28, 35, 49, 0.8);
    z-index: 1000;
    pointer-events: none; /* Allow settings content to be interactive */
}

/* Settings view should be above the backdrop */
.settings-view {
    position: relative;
    z-index: 1001;
    pointer-events: auto; /* Ensure settings remain interactive */
}

.modal-content {
    position: relative;
    background-color: var(--grey-800);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    width: 360px;
    max-width: 90vw;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    color: var(--grey-0);
    margin-bottom: var(--space-md);
    text-align: left;
}

.modal-warning {
    color: var(--grey-200);
    font: var(--body-sm);
    line-height: 1.5;
    margin-bottom: var(--space-lg);
    text-align: left;
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    margin-top: var(--space-md);
}

/* Remove extra margin when modal-actions is inside a form (form gap handles spacing) */
.form .modal-actions {
    margin-top: 0;
}

/* Settings View Styles */
.settings-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: var(--space-md);
    margin-left: 0;
    background-color: var(--grey-900);
    border-radius: var(--radius-md);
    overflow-y: auto;
    padding: 0;
    width: auto;
    align-self: stretch;
}

.settings-view-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    padding-top: calc(var(--space-lg) * 2);
    padding-bottom: 0;
}

.back-arrow {
    background: none;
    border: none;
    color: var(--grey-300);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.back-arrow:hover {
    color: var(--teal-300);
    background-color: var(--grey-700);
}

/* Settings back button */
.settings-back-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--grey-300);
    text-decoration: none;
    font: var(--body-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    margin-bottom: var(--space-md);
}

.settings-back-button:hover {
    color: var(--teal-300);
    background-color: var(--grey-700);
}

.settings-back-button::before {
    content: "←";
    font-size: 18px;
    font-weight: bold;
}

.settings-view-content {
    max-width: 680px;
    overflow-y: visible;
    flex: 1;
    margin: 0;
    padding: var(--space-lg);
    width: 100%;
}

.settings-view .settings-section {
    margin-bottom: var(--space-xl);
    border: 1px solid var(--grey-600);
    border-radius: 8px;
    padding: var(--space-lg);
}

/* Base settings item */
.settings-view .settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Toggle settings items (for chat preferences) */
.settings-view .toggle-settings-item {
    padding: var(--space-md) 0;
}

/* Basic settings items (for account settings) */
.settings-view .basic-settings-item {
    padding: var(--space-sm) 0;
}

/* Only add dividers to chat preferences section */
.settings-section:first-child .settings-item {
    border-bottom: 1px solid var(--grey-600);
}

.settings-section:first-child .settings-item:nth-last-child(2),
.settings-section:first-child .settings-item:last-child,
.settings-section:first-child #settings-actions {
    border-bottom: none;
}

#settings-actions {
    justify-content: flex-end;
    gap: var(--space-sm);
    padding-top: var(--space-md);
    margin-top: var(--space-md);
    border-top: 1px solid var(--grey-700);
    border-bottom: none;
}

/* Settings view mobile responsiveness */
@media (max-width: 768px) {
    .settings-view {
        margin: 0 16px 16px 16px;
        border-radius: 8px;
        padding: 0;
        padding-top: 0;
    }
    
    .settings-view-header {
        margin-bottom: var(--space-md);
        padding: var(--space-md);
        padding-bottom: var(--space-sm);
    }
    
    .settings-view-content {
        max-width: 100%;
        padding: var(--space-md);
        margin: 0;
    }
    
    .settings-view .settings-section {
        padding: var(--space-md);
        margin-bottom: var(--space-lg);
    }
    
    .settings-view .toggle-settings-item {
        padding: var(--space-md) 0;
    }
    
    .settings-view .basic-settings-item {
        padding: var(--space-sm) 0;
    }
    
    .settings-view .settings-label {
        font-size: 14px;
    }
    
    #settings-actions {
        flex-direction: column;
        gap: var(--space-xs);
    }
    
    #settings-actions .btn {
        width: 100%;
    }
}

/* Add this to your existing nav-button styles */
.nav-button.active {
    background-color: var(--grey-900);
}

/* Logout button consolidated into .btn system */

/* Onboarding Styles */
.onboarding-container {
    display: flex;
    height: 100vh;
    width: 100%;
    background-color: var(--grey-800);
}

.onboarding-left-panel {
    max-width: 440px;
    width: 100%;
    background-color: var(--grey-800);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.onboarding-content {
    max-width: 600px;
    min-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-lg);
    position: relative;
    overflow: hidden;
    height: 100%;
}

.onboarding-logo {
    height: 32px;
    width: auto;
    align-self: flex-start;
}

.onboarding-text {
    padding: var(--space-xl) var(--space-xl) var(--space-xl) var(--space-xl);
    padding-top: calc(var(--space-xl) * 2); /* Double the top padding */
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    position: relative;
    z-index: 1;
    width: 100%;
}

.onboarding-illustration {
    width: 600px;
    height: auto;
    margin-left: -200px;
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 0;
}

.onboarding-right-panel {
    flex: 1;
    background-color: var(--grey-900);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: var(--space-md);
    border-radius: var(--radius-md);
}

.onboarding-actions {
    text-align: center;
    padding: var(--space-2xl);
    width: 100%;
}

.onboarding-actions .heading-900 {
    margin-bottom: 16px;
}

.onboarding-actions .heading-300 {
    margin-bottom: 48px;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

/* General form styles */
.form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

/* Modal forms use tighter spacing */
.modal .form {
    gap: var(--space-md);
    max-width: 352px;
}

.button-group {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-2xl);
    justify-content: center;
}

/* Add media query for mobile screens */
@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }

    .onboarding-actions {
        padding: 24px;
    }
}

/* Duplicate button styles removed - use .btn system instead */

/* Login Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    width: 100%;
}

.forgot-password {
    color: var(--grey-300);
    text-decoration: none;
    font: var(--body-sm);
    text-align: center;
    transition: color var(--transition-fast);
}

.forgot-password:hover {
    color: var(--grey-0);
}

.divider {
    height: 1px;
    background-color: var(--grey-600);
    margin: var(--space-md) 0;
}

.form-caption {
    color: var(--grey-300);
    font: var(--body-sm);
    text-align: center;
}

.body-link {
    color: var(--blue-400);
    text-decoration: none;
    font-weight: 600;
    transition: opacity var(--transition-fast);
}

.body-link:hover {
    opacity: 0.8;
}

/* Tablet and Mobile: Stack the two panels vertically */
@media (max-width: 1024px) {
  .onboarding-container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }
  .onboarding-left-panel {
    max-width: 100%;
    width: 100%;
  }
  .onboarding-right-panel {
    max-width: 100%;
    width: auto;      /* Allow margin to show */
    box-sizing: border-box; /* Ensure padding/margin are included in width */
  }
  .onboarding-illustration {
    display: none;
  }
  .onboarding-content {
    align-items: center;
    justify-content: center;
    min-width: 0;
    width: 100%;
    text-align: center;
  }
  .onboarding-text {
    align-items: center;
    text-align: center;
  }
  .onboarding-logo {
    align-self: center;
  }
}

/* Unused button styles removed - use .btn system instead */

.button-group a {
    text-decoration: none;
}

.headline-section {
    margin-bottom: 48px;
    text-align: center;
}

.headline-section .heading-900 {
    margin-bottom: 16px;
}

.headline-section .heading-300 {
    margin-bottom: 16px;
}

.headline-section .body-link {
    display: inline-block;
}

/* Settings Page Enhancements */

/* Success and Error Messages */
.success-message {
    background-color: var(--green-100);
    border: 1px solid var(--green-300);
    color: var(--green-700);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font: var(--body-sm);
}

.error-message {
    background-color: var(--red-100);
    border: 1px solid var(--red-300);
    color: var(--red-700);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font: var(--body-sm);
}

.verification-message {
    margin-top: var(--space-md);
    margin-bottom: 0;
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
    clear: both;
    display: block;
    text-align: center;
}

/* CSS :target for success message display */
.success-message:target {
    display: block;
}

/* Pre-generated Modal Targeting */
/* Show modals when targeted via fragment URL */
[id^="rename-modal-"]:target,
[id^="delete-modal-"]:target,
#delete-account-modal:target,
#delete-chat-history-modal:target {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure all modals are hidden by default */
[id^="rename-modal-"],
[id^="delete-modal-"],
#delete-account-modal,
#delete-chat-history-modal {
    display: none;
}

/* Range Input Styling - TODO: Remove after dropdown implementation */
.range-settings-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--grey-700);
}

/* Dropdown Settings Styling */
.settings-dropdown {
    background-color: var(--grey-700);
    border: 1px solid var(--grey-600);
    border-radius: var(--radius-sm);
    color: var(--grey-0);
    padding: var(--space-xs) var(--space-sm);
    font: var(--body-sm);
    min-width: 80px;
    cursor: pointer;
}

.settings-dropdown:hover {
    border-color: var(--grey-500);
}

.settings-dropdown:focus {
    outline: none;
    border-color: var(--teal-400);
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.1);
}

.range-settings-item:last-child {
    border-bottom: none;
}

.range-input-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
}

.range-input {
    flex: 1;
    height: 6px;
    border-radius: var(--radius-sm);
    background: var(--grey-700);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* Range slider track */
.range-input::-webkit-slider-track {
    height: 6px;
    border-radius: var(--radius-sm);
    background: var(--grey-700);
}

.range-input::-moz-range-track {
    height: 6px;
    border-radius: var(--radius-sm);
    background: var(--grey-700);
    border: none;
}

/* Range slider thumb */
.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--blue-400);
    cursor: pointer;
    border: 2px solid var(--grey-800);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--blue-400);
    cursor: pointer;
    border: 2px solid var(--grey-800);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Range slider hover effects */
.range-input:hover::-webkit-slider-thumb {
    background: var(--blue-300);
    transform: scale(1.1);
}

.range-input:hover::-moz-range-thumb {
    background: var(--blue-300);
    transform: scale(1.1);
}

/* Range value display */
.range-value {
    min-width: 40px;
    text-align: center;
    font: var(--body-sm);
    color: var(--grey-200);
    background: var(--grey-700);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--grey-600);
}

/* Settings form styling */
.settings-form {
    width: 100%;
}

.settings-form .settings-section {
    margin-bottom: 0;
}

/* Range settings item label */
.range-settings-item .settings-label {
    font: var(--body-sm);
    color: var(--grey-200);
    margin-bottom: var(--space-xs);
    text-align: left;
    display: block;
}

/* Form controls group - for grouping multiple controls together on one row */
.form-controls-group {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* Ensure existing toggle styles work with new settings */
.toggle-settings-item .settings-label {
    font: var(--body-sm);
    color: var(--grey-200);
    text-align: left;
}

/* Left justify all settings items */
.settings-item {
    text-align: left;
}

.range-settings-item {
    text-align: left;
}

.toggle-settings-item {
    text-align: left;
}

/* Save button styling - right justified */
.save-button-container {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--grey-700);
    text-align: right;
}

/* Override general settings-item styles for save button container */
.settings-form .save-button-container {
    display: flex !important;
    justify-content: flex-end !important;
}

.settings-item button[type="submit"] {
    margin-top: 0;
}

/* Mobile responsive adjustments for range inputs */
@media (max-width: 768px) {
    .range-input-container {
        gap: var(--space-sm);
    }
    
    .range-value {
        min-width: 35px;
        font-size: 14px;
    }
    
    .range-input::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .range-input::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
} 