/* --- General Styles & Variables --- */
:root {
    --bg-dark: #212121;
    --bg-medium: #2d2d2d;
    --bg-light: #3a3a3a;
    --primary-green: #10b981;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #4a4a4a;
    --text-black: #30303A;
    --user-chat-message: #0c4b33;
    --register-btn-text: #111;
}

body.light-mode {
    --bg-dark: #f4f4f5;
    /* Light grey page background */
    --bg-medium: #ffffff;
    /* White element background (like the sidebar) */
    --bg-light: #f9fafb;
    /* Slightly off-white for lighter elements */
    --primary-green: #10b981;
    --text-primary: #18181b;
    /* Dark text for high contrast */
    --text-secondary: #71717a;
    /* Grey text for less important info */
    --border-color: #e4e4e7;
    /* Light grey borders */
    --user-chat-message: #e2f5ec;
    --register-btn-text: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html{
    scrollbar-width: thin;
    scrollbar-color: #888 #333; 
}
/* For Webkit browsers (Chrome, Safari, Edge, Opera) */
::-webkit-scrollbar {
    width: 8px;  /* width of the vertical scrollbar */
    height: 8px; /* height of the horizontal scrollbar (if present) */
}

::-webkit-scrollbar-thumb {
    background-color: #888; /* Color of the scrollbar thumb */
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-track {
    background-color: #333; /* Color of the scrollbar track */
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

::-webkit-scrollbar-corner {
    background-color: #222;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* --- Overlay for Mobile Menu --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Sidebar Styles --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-medium);
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s ease-in-out;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-links {
    list-style: none;
    margin-top: 30px;
    flex-grow: 1;
}

.nav-links li {
    margin-bottom: 10px;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;
}

.nav-links a i {
    margin-right: 15px;
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.nav-links a:hover {
    background-color: var(--bg-light);
    color: var(--text-primary);
}

.nav-links li.active a {
    background-color: var(--primary-green);
    color: var(--text-primary);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
}

.sidebar-footer a i {
    margin-right: 15px;
    font-size: 1.2rem;
}


/* --- Main Content Styles --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 40px 0;
    flex-shrink: 0;
}

.get-started-btn {
    background-color: var(--bg-light);
    color: var(--text-primary);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

.get-started-btn:hover {
    background-color: var(--border-color);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* .chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    overflow-y: auto;
} */
/* --- Add this rule to style.css --- */

.initial-view-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* This centers the content vertically */
    align-items: center;
    text-align: center;
    height: 100%;
    /* Take up the full height of the parent scroll area */
}

.chat-area {
    flex-grow: 1;
    /* Allows this area to take up all available vertical space */
    padding: 20px;
    overflow-y: auto;
    /* THIS IS THE KEY: Adds a scrollbar ONLY when content overflows */
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.logo {
    width: 130px;
    height: 130px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    margin-bottom: 30px;
    margin-top: 10px;
}

.chat-area h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.chat-area p {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.top-questions h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.questions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 800px;
    width: 100%;
}

.question-box {
    background-color: var(--bg-light);
    padding: 15px;
    border-radius: 10px;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.question-box:hover {
    background-color: var(--border-color);
}

/* --- Chat Input Bar (Refactored) --- */
.chat-input-wrapper {
    padding: 24px 40px;
    flex-shrink: 0;
}

.chat-input-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-light);
    /* Set the background color */
    border: 1px solid var(--border-color);
    /* Add a border */
    padding: 8px 15px;
    /* Adjusted padding */
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    transition: border-color 0.3s;
    /* Smooth transition for focus */
}

/* This rule highlights the entire bar when the textarea inside is focused */
.chat-input-bar:focus-within {
    border-color: var(--primary-green);
}

.chat-input-bar input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 8px;
}

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

.icon-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px 4px;
    margin-left: 0;
    transition: color 0.3s;
}

.icon-button:hover {
    color: var(--text-primary);
}

/* --- Add this block for SVG Icon Styling --- */

/* 1. Basic styling for the new icon image */
.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    transition: filter 0.3s ease;
    /* Smooth transition for color changes */
}

/* 2. Set the default icon color to match the text */
/* This filter converts a black SVG to the --text-secondary color (#a0a0a0) */
.nav-links a .nav-icon,
.sidebar-footer a .nav-icon {
    filter: invert(75%) sepia(0%) saturate(1%) hue-rotate(16deg) brightness(81%) contrast(93%);
}

/* 3. Change icon color to white on hover */
/* This filter converts a black SVG to white */
.nav-links a:hover .nav-icon,
.sidebar-footer a:hover .nav-icon {
    filter: brightness(0) invert(1);
}

/* 4. Change icon color to white for the active link */
.nav-links li.active a .nav-icon {
    filter: brightness(0) invert(1);
}


textarea {
    /* Basic Styling */
    flex-grow: 1;
    width: 100%;
    padding: 10px 0;
    border: none;
    outline: none;
    border-radius: 8px;
    background-color: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;

    /* Auto-resize Essentials */
    resize: none;
    overflow: hidden;
}


.icon-button img {
    width: 30px;
    /* Adjust size as needed */
    height: 30px;
    /* Adjust size as needed */
    display: block;
    /* Helps with alignment */
}

/* --- Styles for New Chat View (Corrected) --- */

/* 1. Model Selector Buttons */
.model-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;

    /* --- The Fix for Sticky Header --- */
    position: sticky;
    top: -20px;
    /* Use negative padding to align correctly within the scroll area */
    padding-top: 20px;
    padding-bottom: 15px;
    background-color: var(--bg-dark);
    /* Match the page background */
    z-index: 10;
    /* Ensures it stays on top of other content */
}

.model-btn {
    flex: 1;
    /* <-- THE KEY FIX: Allows the buttons to grow and fill the space */
    background-color: var(--bg-light);
    color: var(--text-white);
    border: none;
    padding: 15px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    text-align: center;
    /* Ensure text is centered */
    transition: all 0.3s;
}

.model-btn.active {
    background-color: var(--primary-green);
    color: var(--text-primary);
}

/* 2. Chat Message Bubbles */
.message-group {
    max-width: 800px;
    width: 100%;
    margin: 0 auto 25px;
    /* Spacing between message groups */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Aligns items to the left */
}

.chat-message {
    padding: 20px;
    border-radius: 12px;
    width: 100%;
    /* Bubble takes full width of the group */
    text-align: left;
    margin: 0;
    display: flex; /* <-- THIS IS THE FIX */
    flex-direction: column; /* <-- THIS IS THE FIX */
    gap: 15px; /* <-- Optional: Adds nice spacing between code and text */

    /* Remove previous margin */
}
.chat-message {
    padding: 20px;
    border-radius: 12px;
    width: 100%;
    /* Bubble takes full width of the group */
    text-align: left;
    margin: 0;
    display: flex; /* <-- THIS IS THE FIX */
    flex-direction: column; /* <-- THIS IS THE FIX */
    gap: 15px; /* <-- Optional: Adds nice spacing between code and text */

    /* Remove previous margin */
}
.chat-message ol {
  padding-left: 20px; /* Adds space for the numbers */
  margin-left: 15px;  /* Indents the entire list */
}

.user-message {

    background-color: var(--user-chat-message);
}

.ai-message {
    background-color: var(--bg-light);
}

.chat-message p {
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--text-primary);
}

.message-actions {
    margin-top: 10px;
    /* Space between bubble and icons */
    display: flex;
    gap: 15px;
}

.message-actions .icon-button {
    padding: 0;
    background: transparent;
}

.message-actions .icon-button img {
    width: 40px;
    height: 40px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.message-actions .icon-button:hover img {
    opacity: 1;
}

.final-message {
    text-align: center;
    color: var(--text-secondary);
    background: transparent;
}

/* 3. Chat Input Bar (The Main Fix) */

/* The wrapper div */
.chat-input-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-light);
    /* The bar itself is the container */
    padding: 8px 15px;
    border-radius: 12px;
    border: none;
    /* Ensure no border */
}

/* Make the textarea transparent inside the bar */
.chat-input-bar textarea {
    flex-grow: 1;
    background-color: transparent;
    /* Makes textarea invisible */
    border: none;
    /* No border on the textarea itself */
    outline: none;
    /* No focus outline */
    padding: 10px 0;
    color: var(--text-secondary);
    /* Placeholder text color */
}

.chat-input-bar textarea:focus {
    color: var(--text-primary);
    /* Text color when typing */
}


/* The circular send button */
.send-button {
    background-color: var(--primary-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    /* Adjusted size */
    height: 32px;
    min-width: 32px;
    /* Prevent shrinking */
    padding: 0;
    margin-left: 8px;
}

.send-button img {
    width: 16px;
    height: 16px;
}

/* --- Styles for Poem Generator View --- */

/* This wrapper helps vertically center content and push the input bar to the bottom */
.page-content-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* THIS IS THE FIX: Changed from height: 100% */
    overflow: hidden; /* Add this to contain the scrolling area */
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.poem-generator-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.page-icon {
    width: 160px;
    height: 160px;
    margin-bottom: 20px;
}

.page-icon img {
    width: 100%;
    height: 100%;
}

.poem-generator-area h1 {
    font-size: 2rem;
    margin-bottom: 40px;
}

/* Slider Styles */
.slider-container {
    width: 100%;
    margin-bottom: 30px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

.copy-icon-edit {
    width: 30px;
    height: 30px;
    opacity: 0.7;
}

/* Custom Range Slider Styling */
.styled-slider {
    /* We'll use a background gradient to create the active color effect */
    background: linear-gradient(to right, var(--primary-green) 25%, var(--bg-light) 25%);
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 5px;
    outline: none;
}

/* --- Styles for AI Image Generator --- */

/* Re-using .page-content-area from poem page, but let's define it for clarity */
.page-content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

/* Container for options like Image Size */
.option-container {
    width: 100%;
    max-width: 800px;
    /* Consistent width */
    margin: 0 auto 20px;
}

.option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0 5px;
    /* Small padding to align with buttons */
}

/* Button group for image sizes */
.option-buttons {
    display: flex;
    gap: 10px;
    background-color: var(--bg-dark);
    /* Darker background for the button container */
    padding: 5px;
    border-radius: 10px;
}

.option-btn {
    flex: 1;
    background-color: transparent;
    /* Default state is transparent */
    color: var(--text-secondary);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s;
}

.option-btn.active {
    background-color: var(--primary-green);
    color: var(--text-primary);
}

.quota-text {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 15px;
}

/* --- Chrome/Safari Thumb --- */
.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-green);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
}

/* --- Firefox Thumb --- */
.styled-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-green);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
}

/* --- Styles for AI Edit View --- */
/* --- Styles for AI Edit View (Corrected) --- */

/* This is the main container for the output box */
.output-text-box-wrapper {
    width: 100%;
    max-width: 800px;
    /* Consistent width */
    margin: 0 auto;
    margin-top: 40px;
}

.output-text-box {
    width: 100%;
    height: 400px;
    border-radius: 10px;
    padding: 20px;
    color: var(--text-secondary);
    overflow-y: auto;  
    padding-bottom: 20px;
    background-color: var(--bg-light); /* Use theme background instead of image */
}

/* Light mode fix for AI Edit output textarea */
body.light-mode .output-text-box textarea {
    background-color: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

/* Light mode fix for AI Edit output container */
body.light-mode .output-text-box {
    background-color: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* Style for the header INSIDE the box */
.output-text-box .option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

/* THIS IS THE FIX: Makes the header text white */
.output-text-box .option-header label {
    color: var(--text-primary);
    /* White text */
    font-weight: 500;
}

/* Styling for the placeholder text below the header */

.output-text-box .placeholder-text {
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: left;
    /* <-- ADD THIS LINE */
}

/* --- Styles for Settings View --- */

.settings-area {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    height: 100%;
    overflow-y: auto;
    /* Allow scrolling if content is long */
}

.settings-section {
    margin-bottom: 30px;
}

.settings-section h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: var(--bg-light);
    border-radius: 10px;
    overflow: hidden;
    /* Ensures border-radius is respected by children */
}

.settings-list li:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.settings-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.3s;
}

.settings-list a:hover {
    background-color: var(--border-color);
}

.settings-list a img {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

/* --- Popup / Modal Styles (Corrected) --- */

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

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

.popup-content {
    background-color: var(--bg-medium);
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
    max-height: 80vh;  /* limit height */
    overflow-y: auto;  /* enable vertical scroll */

    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.popup-header {
    display: flex;
    justify-content: center;
    /* Center the content horizontally */
    align-items: center;
    margin-bottom: 10px;
    position: relative;
    /* Needed for absolute positioning of the close button */
}

.popup-header h2 {
    margin: 0;
    font-size: 1.8rem;
    text-align: center;
    /* Ensure text is centered */
}

.close-popup {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    position: absolute;
    /* Position relative to the header */
    top: -5px;
    right: 0;
}

.popup-subheading {
    color: var(--text-secondary);
    margin-bottom: 30px;
    text-align: center;
    /* Center the subheading */
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    /* CHANGED: Set label color to white */
}

.form-group input {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    width: 20px;
    cursor: pointer;
    opacity: 0.6;
}

.register-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-green);
    color: var(--register-btn-text);
    /* CHANGED: Set button text to a dark color */
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

/* --- Popup CTA Link Styles --- */

.popup-cta {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cta-link {
    background: none;
    border: none;
    color: var(--primary-green);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
}

/* --- Forgot Password Link Styles --- */
.form-actions {
    display: flex;
    justify-content: flex-end;
    /* Aligns link to the right */
    margin-bottom: 20px;
}

.forgot-password-link {
    font-size: 0.85rem !important;
    /* Override other styles if needed */
}

/* --- Updated Settings & Language Popup Styles --- */

/* Makes the whole list item clickable */
.settings-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.settings-list-item:hover {
    background-color: var(--border-color);
}

.current-value {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-secondary);
}

.current-value img {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

/* Ensure the popup body can scroll if languages overflow */
.popup-body {
    max-height: 60vh;
    overflow-y: auto;
    margin: 0 -15px;
    /* Adjust for padding */
    padding: 0 15px;
}

/* First, this rule hides ALL checkmarks by default */
.language-list .selection-tick {
    opacity: 0;
}

/* Then, this rule makes the checkmark visible ONLY if its parent <li> has the .selected class */
.language-list .selected .selection-tick {
    opacity: 1;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

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

.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 34px;
    transition: .4s;
}

.toggle-label:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 3px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: .4s;
}

input:checked+.toggle-label {
    background-color: var(--primary-green);
}

input:checked+.toggle-label:before {
    transform: translateX(20px);
    background-color: white;
}

/* --- Light Mode Hover Effects --- */

/* Sidebar link hover effect */
body.light-mode .nav-links a:hover {
    background-color: #f3f4f6;
    /* A very light grey for hover */
}

/* Get Started button hover effect */
body.light-mode .get-started-btn:hover {
    background-color: #e5e7eb;
    /* A slightly darker grey */
}

/* Top Question box hover effect */
body.light-mode .question-box:hover {
    background-color: #f3f4f6;
}

/* Settings page list items hover effect */
body.light-mode .settings-list a:hover,
body.light-mode .settings-list-item:hover {
    background-color: #f3f4f6;
}

/* --- Light Mode Icon Hover Fix --- */

/* This rule ensures that when you hover on a sidebar link in light mode,
   the icon turns a dark color to match the text, instead of white. */
body.light-mode .nav-links a:hover .nav-icon,
body.light-mode .sidebar-footer a:hover .nav-icon {
    /* This filter converts the icon to a dark grey color */
    filter: invert(15%) sepia(0%) saturate(0%) hue-rotate(180deg) brightness(20%) contrast(95%);
}

/* This keeps the active icon white against the green background */
body.light-mode .nav-links li.active a .nav-icon {
    filter: brightness(0) invert(1);
}

/* --- Light & Dark Mode Styles --- */

/* 2. Styles for the new Segmented Control */
.segmented-control {
    display: flex;
    background-color: var(--bg-dark);
    /* Dark background behind the buttons */
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.segmented-btn {
    background: transparent;
    /* Buttons are transparent by default */
    border: none;
    padding: 6px 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.3s, color 0.3s;
}

/* Style for the currently active button */
.segmented-btn.active {
    background-color: var(--bg-light);
    /* Light background for the active button */
    color: var(--text-primary);
    /* Darker text for the active button */
}

/* Add this to style.css */
.typing p {
    animation: blink 1s infinite;
}

@keyframes blink {
    50% {
        opacity: 0.5;
    }
}

.icon-button.listening img {
    animation: pulse 1.5s infinite;
}




.icon-button.speak-btn.speaking img {
    /* Makes the icon throb */
    animation: throb 1.2s infinite ease-in-out;
}

@keyframes throb {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.chat-message pre {
    background-color: #1e1e1e; /* A slightly different dark background */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto; /* Adds a scrollbar if the code is too wide */
    white-space: pre-wrap; /* Wraps long lines of code */
    word-wrap: break-word;
    max-width: 100%; /* <-- THIS IS THE FIX */

}

.chat-message code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: #dcdcdc; /* A light grey color for the code text */
}

/* Loader CSS */
 /* The main loader overlay. It covers the entire screen. */
        #activity-indicator-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
            display: none; /* Hidden by default */
            justify-content: center;
            align-items: center;
            z-index: 9999;
        }

        /* The container for the animation and text, mimicking the Swift code's layout */
        #activity-indicator-container {
            position: relative;
            width: 250px;
            height: 250px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* The green circle background, created with CSS */
        #activity-indicator-background {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: radial-gradient(circle, #4CAF50, #2E7D32);
            border-radius: 50%;
            box-shadow: 0 10px 25px rgba(0,0,0,0.2);
        }

        /* The Lottie animation container */
        #lottie-animation {
            width: 200px;
            height: 200px;
            z-index: 1;
        }

        /* The loading text label */
        #loading-label {
            white-space: pre-line; /* Add this line */
            position: absolute;
            bottom: 25px; /* Positioned towards the bottom of the circle */
            color: white;
            font-size: 20px;
            font-weight: 600;
            text-align: center;
            z-index: 1;
            padding: 0 10px;
            width: 100%;
        }

/* --- Light Mode Hover Effects (Keep this section as is) --- */
/* ... your existing light mode hover styles ... */
/* --- Responsive Design --- */

.image-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* Centers items horizontally */
    margin: 20px auto; /* Adds top/bottom margin and centers the container itself */
    text-align: center; /* For older browsers, might help center inline content */
}

#generatedImage {
    width: 400px;
    height: 400px;
    object-fit: cover; /* Ensures the image fills the dimensions without distortion (crops if necessary) */
    margin-bottom: 20px; /* Space between image and button */
    display: block; /* Prevents extra spacing around inline elements */
}

.downloadButton {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none; /* Remove default link underline */
}

.downloadButton:hover {
    background-color: #0056b3;
}
 .apple-login-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background-color: black;
            color: white;
            border-radius: 5px;
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            text-decoration: none;
            margin-top: 15px;
            gap: 10px;
        }
        .apple-login-btn img {
            height: 20px;
            width: auto;
        }
/* --- Css For Paywall --- */

.paywall-popup-content {
  flex-grow: 1; /* This makes the content area take up available vertical space */
  overflow-y: auto; /* This enables vertical scrolling when content is too long */
}

#paywall-popup.popup-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 450px;
    height: 70vh;
    /* background: #fff; */
    border-radius: 18px;
    /* box-shadow: 0 8px 32px rgba(0,0,0,0.18); */
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#paywall-popup .popup-content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 24px;
    box-sizing: border-box;
    border-radius: 18px;
}

 /* Close Button */
        #close-paywall-btn {
            position: absolute;
            top: 16px;
            right: 16px;
            background: none;
            border: none;
            color: white;
            cursor: pointer;
            transition: color 0.2s ease;
        }
        #close-paywall-btn:hover {
            color: #ccc;
        }

        /* Header Section */
        .header {
            text-align: center;
            margin-bottom: 32px;
        }
        .header h3 {
            font-size: 20px;
            font-weight: 600;
            margin: 8px 0;
        }
        .header p {
            font-size: 14px;
            color: #ccc;
            font-weight: 400;
        }
        .header .subtitle {
            font-size: 14px;
            font-weight: 300;
            margin-top: 16px;
        }
        .header .offer-text {
            font-size: 24px;
            font-weight: 700;
            color: #ef4444; /* red-500 */
        }
        .header .limited-offer {
            font-size: 18px;
            font-weight: 600;
            color: #ccc;
            margin-bottom: 8px;
        }
        .header .no-payment-text {
            font-size: 14px;
            color: #999;
            font-weight: 300;
            margin-top: 8px;
        }

        /* Pricing Options */
        .pricing-card .tick-icon {
    display: none;
}
       .other-option .tick-icon {
    display: none;
}
/* Show tick for the active (selected) plan */
.offer-card .tick-icon {
    display: block;
}
        .pricing-card {
    background-color: #1c1c1c;
    border: 2px solid #555; /* default unselected border */
    box-shadow: 0 0 15px rgba(85, 85, 85, 0.5);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    position: relative;
    cursor: pointer;
}

/* Default tick icon (hidden in unselected) */
.pricing-card .tick-icon {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background-color: #555;
    border-radius: 50%;
    opacity: 0.3; /* dim when not active */
}
.pricing-card .tick-icon svg {
    color: white;
}

/* Selected state (your current offer-card style) */
.offer-card {
    border-color: #36a495;
    box-shadow: 0 0 15px rgba(54, 164, 149, 0.5);
}
.offer-card .tick-icon {
    background-color: #36a495;
    opacity: 1;
}

/* Shared text styles */
.pricing-card .offer-title {
    font-size: 18px;
    font-weight: 500;
    color: #36a495;
}
.pricing-card .old-price {
    text-decoration: line-through;
    color: #999;
}
.pricing-card .new-price {
    font-size: 32px;
    font-weight: 700;
}
.pricing-card .duration {
    font-size: 14px;
    color: #ccc;
}

        .pricing-options {
            margin-bottom: 32px;
        }
        .offer-card {
            background-color: #1c1c1c;
            border: 2px solid #36a495;
            box-shadow: 0 0 15px rgba(54, 164, 149, 0.5);
            border-radius: 16px;
            padding: 16px;
            text-align: center;
            position: relative;
        }
        .offer-card .tick-icon {
            position: absolute;
            top: -12px;
            left: 50%;
            transform: translateX(-50%);
            width: 24px;
            height: 24px;
            background-color: #36a495;
            border-radius: 50%;
        }
        .offer-card .tick-icon svg {
            color: white;
        }
        .offer-card .offer-title {
            font-size: 18px;
            font-weight: 500;
            color: #36a495;
        }
        .offer-card .old-price {
            text-decoration: line-through;
            color: #999;
        }
        .offer-card .new-price {
            font-size: 32px;
            font-weight: 700;
        }
        .offer-card .duration {
            font-size: 14px;
            color: #ccc;
        }
        .other-options {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
            margin-top: 16px;
        }
        .other-option {
            background-color: #2a2a2a;
            border-radius: 16px;
            padding: 16px;
            text-align: center;
            transition: background-color 0.2s ease;
            cursor: pointer;
        }
        .other-option:hover {
            background-color: #333;
        }
        .other-option .old-price {
            text-decoration: line-through;
            color: #999;
            font-size: 14px;
        }
        .other-option .new-price {
            font-size: 20px;
            font-weight: 700;
        }
        .other-option .duration {
            font-size: 12px;
            color: #ccc;
        }

        /* How it works section */
        .how-it-works {
            margin-bottom: 32px;
        }
        .how-it-works h4 {
            text-align: center;
            font-size: 20px;
            font-weight: 600;
            color: #ccc;
            margin-bottom: 16px;
        }
        .how-it-works ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        .how-it-works li {
            display: flex;
            align-items: flex-start;
            margin-bottom: 16px;
        }
        .how-it-works li:last-child {
            margin-bottom: 0;
        }
        .how-it-works .bullet-point {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #36a495;
            margin-right: 16px;
            margin-top: 8px;
            flex-shrink: 0;
        }
        .how-it-works .step-title {
            font-size: 18px;
            font-weight: 600;
            color: white;
            margin: 0;
        }
        .how-it-works .step-description {
            font-size: 14px;
            color: #ccc;
            margin: 4px 0 0 0;
        }

        /* Feature Comparison Table */
        .feature-table {
            margin-bottom: 32px;
        }
        .feature-table h4 {
            text-align: center;
            font-size: 20px;
            font-weight: 600;
            color: #ccc;
            margin-bottom: 16px;
        }
        .feature-table-container {
            overflow-x: auto;
        }
        .feature-table table {
            width: 100%;
            font-size: 14px;
            border-collapse: collapse;
        }
        .feature-table th, .feature-table td {
            padding: 8px;
            text-align: center;
        }
        .feature-table th {
            color: #ccc;
            font-weight: 500;
        }
        .feature-table th:first-child, .feature-table td:first-child {
            text-align: left;
        }
        .feature-table td {
            border-top: 1px solid #333;
        }
        .feature-table .basic-col {
            color: #999;
        }
        .feature-table .unlimited-col {
            color: #36a495;
        }

        /* Call to Action Button */
        .cta-button {
            text-align: center;
            margin-bottom: 32px;
        }
        .cta-button button {
            width: 100%;
            background-color: #36a495;
            color: white;
            font-weight: 600;
            padding: 12px 24px;
            border-radius: 12px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
            border: none;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        .cta-button button:hover {
            background-color: #2e8a7c;
            transform: scale(1.02);
        }
        .cta-button .cta-subtitle {
            font-size: 12px;
            font-weight: 300;
        }

        /* Reviews Section */
        .reviews {
            margin-bottom: 32px;
        }
        .reviews h4 {
            text-align: center;
            font-size: 20px;
            font-weight: 600;
            color: #ccc;
            margin-bottom: 16px;
        }
        .reviews-container {
            display: flex;
            overflow-x: auto;
            gap: 16px;
            padding-bottom: 8px;
        }
        .reviews-container::-webkit-scrollbar {
            height: 6px;
        }
        .reviews-container::-webkit-scrollbar-track {
            background: #2a2a2a;
            border-radius: 3px;
        }
        .reviews-container::-webkit-scrollbar-thumb {
            background: #555;
            border-radius: 3px;
        }
        .review-card {
            background-color: #2a2a2a;
            padding: 16px;
            border-radius: 12px;
            flex-shrink: 0;
            width: 240px;
        }
        .review-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }
        .review-card-header .stars {
            display: flex;
        }
        .review-card-header .stars svg {
            color: #ff9529; /* orange */
            height: 16px;
            width: 16px;
        }
        .review-card-header .date {
            font-size: 12px;
            color: #999;
        }
        .review-card .review-title {
            font-weight: 600;
            margin-bottom: 4px;
        }
        .review-card .review-text {
            font-size: 12px;
            color: #ccc;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
        }

        /* FAQ Section */
        .faq-section {
            margin-bottom: 32px;
        }
        .faq-section h4 {
            text-align: center;
            font-size: 20px;
            font-weight: 600;
            color: #ccc;
            margin-bottom: 16px;
        }
        .faq-item {
            border-top: 1px solid #333;
            padding-top: 16px;
        }
        .faq-item-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .faq-item-header p {
            font-size: 14px;
            font-weight: 500;
        }
        .faq-item-header button {
            background: none;
            border: none;
            color: #ccc;
            cursor: pointer;
        }

        /* Footer Links & Text */
        .footer-links {
            text-align: center;
            font-size: 14px;
            color: #999;
            margin-bottom: 8px;
        }
        .footer-links a {
            color: #999;
            text-decoration: underline;
            margin: 0 8px;
        }
        .footer-legal {
            text-align: center;
            font-size: 12px;
            color: #999;
            font-weight: 300;
            line-height: 1.4;
        }

.circle-btn {
  width: 16px;              /* size of the circle */
  height: 16px;
  border-radius: 50%;       /* makes it round */
  border: none;             /* no border */
  background: #FFF;  /* no background */
  /* display: flex;            center the icon */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;          /* icon size */
  color: #333;              /* icon color */
  margin-left: 10px;
  margin-top: 3px;
}

.circle-btn:hover {
  background: rgba(255,255,255,0.1); /* subtle hover effect */
}
      
.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;                 /* spacing between elements */
  background: #f5f5f5;      /* light background */
  border: 1px solid #ddd;   /* subtle border */
  border-radius: 8px;
  padding: 6px 10px;
  max-width: 300px;         /* prevent super long stretching */
  font-family: sans-serif;
}

.file-icon {
  color: #4a90e2;           /* blue-ish icon */
  font-size: 18px;
}

.file-name {
  flex: 1;                  /* take available space */
  overflow: hidden;
  text-overflow: ellipsis;  /* truncate long names */
  white-space: nowrap;
  cursor: pointer;          /* since it's still a label */
  color: #333;              /* text color */
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #bbb; /* soft grey for dark theme */
}

.empty-state .empty-icon {
  width: 80px;
  height: 80px;
  opacity: 0.7;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 20px;
}

.empty-state .cta-button {
  display: inline-block;
  padding: 10px 20px;
  background: #444;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: background 0.3s ease;
}

.empty-state .cta-button:hover {
  background: #666;
}
.loader {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 50px auto;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- Light Mode Overrides for Paywall Popup --- */

/* 1. Fix the header text colors (Subtitle & Descriptions) */
body.light-mode .header p, 
body.light-mode .header .limited-offer,
body.light-mode .header .no-payment-text {
    color: var(--text-secondary); /* Changes #ccc to a readable grey */
}

body.light-mode .header h3 {
    color: var(--text-primary); /* Ensures title is dark */
}

/* 2. Fix the Main Pricing Card (Recommended Plan) */
body.light-mode .pricing-card {
    background-color: #ffffff; /* White background instead of #1c1c1c */
    border-color: var(--border-color);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Softer shadow for light mode */
}

/* Ensure the "Selected" state still looks active (Green border) */
body.light-mode .pricing-card.offer-card {
    border-color: var(--primary-green);
    background-color: #f0fdf4; /* Very faint green tint for selected card */
}

/* 3. Fix the Other Options (Weekly, Forever, Token plans) */
body.light-mode .other-option {
    background-color: #f4f4f5; /* Light grey instead of #2a2a2a */
    color: var(--text-primary);
    border: 1px solid var(--border-color); /* Add subtle border for definition */
}

body.light-mode .other-option:hover {
    background-color: #e4e4e7; /* Slightly darker hover state */
}

/* 4. Fix Text Colors inside the cards */
body.light-mode .pricing-card .duration,
body.light-mode .other-option .duration,
body.light-mode .pricing-card .old-price,
body.light-mode .other-option .old-price {
    color: var(--text-secondary); /* Readable grey */
}

body.light-mode .pricing-card .new-price,
body.light-mode .other-option .new-price {
    color: var(--text-black); /* Ensure price is dark and readable */
}

/* 5. Fix Feature Table Text */
body.light-mode .feature-table th {
    color: var(--text-primary);
}
body.light-mode .feature-table .basic-col {
    color: var(--text-secondary);
}

/* 6. Fix Review Cards Background */
body.light-mode .review-card {
    background-color: #f4f4f5; /* Light grey card */
    border: 1px solid var(--border-color);
}
body.light-mode .review-card .review-text {
    color: var(--text-secondary);
}

body.light-mode #close-paywall-btn {
    color: var(--text-primary); /* This changes it to dark grey/black */
}

body.light-mode #close-paywall-btn:hover {
    color: #000000; /* Pure black on hover */
}

/* Update .custom-tooltip */
.custom-tooltip {
    display: none;
    position: absolute;
    bottom: 135%; /* Lift it up slightly more */
    
    /* CHANGE 1: Anchor to the right instead of center */
    left: auto; 
    right: -10px; /* Small offset to align nicely with the icon edge */
    transform: none; /* Remove the centering transform */
    
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    z-index: 1000; /* Ensure it sits on top */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.custom-tooltip.show {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

/* Update arrow position */
.custom-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    
    /* CHANGE 2: Move arrow to the right side to point at the icon */
    left: auto;
    right: 15px; /* Adjust this value to center the arrow over the icon */
    
    margin-left: 0;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* Update Animation */
@keyframes fadeIn {
    /* CHANGE 3: Update animation to slide from the correct spot */
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-header {
        display: flex;
        justify-content: space-between;
        /* This will push the menu toggle and actions apart */
        align-items: center;
        padding: 20px 40px 0;
        flex-shrink: 0;
    }

    .header-actions {
        display: flex;
        align-items: center;
    }

   

    .menu-toggle {
        display: block;
    }

    .chat-input-wrapper {
        padding: 24px 20px;
    }

    .questions-grid {
        grid-template-columns: 1fr;
    }

    .chat-area h1 {
        font-size: 1.8rem;
    }
}