:root {
    --bg-dark: #070202;
    --bg-secondary: #0f0404;
    --bg-tertiary: #1a0808;

    --primary-color: #d11c1c;
    /* Red */
    --primary-glow: #ff2a2a;

    --accent-color: #ff7300;
    /* Orange */
    --accent-glow: #ff9d00;

    --text-primary: #ffffff;
    --text-secondary: #c2c2c2;

    --sidebar-width: 280px;
    --header-height: 60px;

    --font-heading: 'Oswald', 'Orbitron', 'Impact', sans-serif;
    --font-body: 'Inter', 'Tajawal', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
}

#app {
    display: flex;
    height: 100%;
}

/* Utilities */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Login Screen */
#login-container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(123, 44, 191, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 240, 255, 0.1) 0%, transparent 50%),
        linear-gradient(rgba(10, 10, 18, 1), rgba(10, 10, 18, 1));
    position: relative;
    overflow: hidden;
}

.bg-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--bg-dark);
    /* Placeholder for particle effect, handled via complex CSS or JS, kept simple here as gradient mesh */
    opacity: 0.5;
    z-index: 0;
    background:
        linear-gradient(90deg, transparent 95%, rgba(0, 240, 255, 0.05) 96%, transparent 97%),
        linear-gradient(0deg, transparent 95%, rgba(123, 44, 191, 0.05) 96%, transparent 97%);
    background-size: 50px 50px;
}

.login-card {
    background: rgba(19, 19, 31, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    z-index: 10;
    text-align: center;
    transform: translateY(0);
    transition: all 0.3s;
    animation: slideUp 0.6s ease-out;
}

.login-header {
    margin-bottom: 2rem;
}

.logo-icon-lg {
    font-size: 4rem;
    color: var(--accent-color);
    filter: drop-shadow(0 0 10px var(--accent-glow));
    margin-bottom: 1rem;
}

.login-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group ion-icon {
    position: absolute;
    right: 15px;
    /* RTL specific */
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: color 0.3s;
}

.input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 45px 12px 15px;
    /* RTL padding */
    color: #fff;
    font-family: var(--font-body);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(176, 0, 255, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(0, 240, 255, 0.08), transparent 25%);
}

/* Sidebar */
/* Sidebar Redesign */
#sidebar {
    width: 260px;
    background: #000000;
    /* Pitch black or very dark */
    background-color: var(--bg-dark);
    /* Use var base */
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    /* RTL border */
    display: flex;
    flex-direction: column;
    padding: 0;
    transition: transform 0.3s ease;
    z-index: 900;
}

/* Sidebar Top Navigation */
.sidebar-top {
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Tight vertical spacing */
}

/* Common Nav Item Style - ChatGPT Like */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #ececf1;
    /* Off-white text */
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    transition: background 0.2s;
    font-family: var(--font-body);
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    /* Subtle hover */
}

.sidebar-nav-item ion-icon {
    font-size: 1.1rem;
    min-width: 20px;
}

/* Search Item Special Styling */
.sidebar-nav-item.search-item {
    cursor: text;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    /* Prevent jump */
}

.sidebar-nav-item.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav-item.search-item ion-icon {
    color: #888;
}

.sidebar-nav-item.search-item input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
    font-size: 0.9rem;
    font-family: inherit;
}

.sidebar-nav-item.search-item input::placeholder {
    color: #888;
}

/* History List */
.chat-history-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.8rem;
    display: flex;
    flex-direction: column;
}

.history-section-label {
    font-size: 0.75rem;
    color: #666;
    margin: 1rem 0 0.5rem;
    padding: 0 5px;
    font-weight: 600;
}

.chat-history {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-item {
    padding: 10px;
    border-radius: 6px;
    color: #ececf1;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-item.active {
    background: rgba(255, 255, 255, 0.1);
}

/* Sidebar Footer & Profile */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: #000;
    /* Matches sidebar */
}

/* Upgrade Pill */


/* User Profile Row */
/* User Profile Row */
.user-profile-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 5px;
    transition: background 0.2s;
    background: transparent;
    border: none;
}

.user-profile-row:hover {
    background: #2a2a3f;
    /* Slightly lighter blue */
}

.avatar-small {
    width: 32px;
    height: 32px;
    background: #555;
    /* Default gray for generic */
    border-radius: 50%;
    /* Circle */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    overflow: hidden;
}

/* Fix user avatar image if present */
.avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

.settings-trigger {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.settings-trigger:hover {
    color: white;
}

.history-item.active {
    background: rgba(176, 0, 255, 0.1);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 10px rgba(176, 0, 255, 0.1);
}

/* Delete Button */
.delete-chat-btn {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 8px;
    /* Larger hit area */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.7;
    /* Always visible but subtle */
}

.delete-chat-btn:hover {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
    opacity: 1;
}

.user-profile {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: var(--glass-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Custom: Typing Dots */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 5px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

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

.avatar {
    width: 42px;
    height: 42px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Chat Area */
#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: transparent;
    height: 100vh;
}

.chat-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Transparent header like ChatGPT */
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    /* Clean look */
    padding: 0.5rem 0.5rem;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 1.1rem;
    color: #ececf1;
    font-weight: 600;
    font-family: var(--font-body);
}

.model-selector:hover {
    background: rgba(255, 255, 255, 0.1);
}

#messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 6rem 1rem 14rem;
    /* Top padding for header, bottom for input */
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    width: 100%;
}

.messages-container-inner {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    align-items: center;
    /* 🎯 KEY: Centers all messages */
}

/* User Message Wrapper - Modern Card */
.message.outgoing .message-content {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 15px 20px;
    border-radius: 20px 20px 0 20px;
    font-size: 1.1rem;
    font-family: var(--font-body);
    font-weight: 500;
    line-height: 1.6;
    box-shadow: 0 4px 15px rgba(209, 28, 28, 0.4);
    text-align: right;
    width: fit-content;
    max-width: 650px;
}

/* AI Message Wrapper - Modern Card */
.message.incoming .message-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: 20px 20px 20px 0;
    font-size: 1.1rem;
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.7;
    width: fit-content;
    max-width: 650px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.message {
    display: flex;
    gap: 15px;
    opacity: 0;
    animation: slideUp 0.3s ease forwards;
    width: 100%;
    margin-bottom: 2rem;
    justify-content: center;
}

/* User Message Alignment: Offset Right */
.message.outgoing {
    justify-content: center;
    padding-left: 10%;
    /* Reduced constraint */
    padding-right: 5%;
    /* Shift Left slightly per arrow */
    /* Keep offset */
    /* Ensure Avatar placement */
    flex-direction: row;
    align-items: flex-start;
}

/* AI Message Alignment */
.message.incoming {
    flex-direction: row-reverse;
    justify-content: center;
    padding-right: 10%;
    padding-left: 5%;
    /* Shift Right slightly per arrow */
}

.message-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 5px;
    /* Slight visual alignment with text top */
    flex-shrink: 0;
}

/* User Avatar (Now Visible) */
.outgoing .message-avatar {
    display: none !important;
}

/* AI Avatar Style */
.incoming .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}




/* User Message: Centered with Right Bias (Reverted) */
.message.outgoing {
    justify-content: center;
    padding-left: 25%;
    /* Push from Left -> Shifts Right */
    padding-right: 0;
}

/* AI Message: Centered with Left Bias */
.message.incoming {
    justify-content: center;
    padding-right: 15%;
    /* Push from Right -> Shows LEFT bias */
    flex-direction: row-reverse;
}

/* Small text avatar */
.avatar-logo-small {
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Welcome Screen */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding-top: 10vh;
}

.welcome-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: black;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 600px;
    /* Constrain width */
    margin-top: 2rem;
}

.welcome-card {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    text-align: right;
    transition: background 0.2s;
}

.welcome-card:hover {
    background: rgba(255, 255, 255, 0.05);
}


/* Input Area (Floating) */
/* Input Area */
.input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, var(--bg-primary) 80%, transparent);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    /* Ensure full width */
    max-width: 100%;
    /* Remove hard cap */
    margin: 0 auto;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Centered Mode */
.input-area.centered-chat {
    top: 45%;
    bottom: auto;
    transform: translateY(-50%);
    padding-bottom: 0;
}

/* Greeting Styles */
.welcome-text {
    text-align: right;
    /* RTL */
    width: 75% !important;
    max-width: 850px !important;
    /* Aligned with chat container */
    margin-left: 10% !important;
    /* Moved Left (was 18%) */
    margin-bottom: 2rem;
    pointer-events: auto;
    animation: fadeIn 0.8s ease;
}

.greeting-gradient {
    display: block;
    font-size: 3.5rem;
    font-weight: bold;
    font-family: var(--font-heading);
    background: linear-gradient(135deg, #4285F4, #9B72CB, #D96570);
    /* Gemini Gradient */
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.sub-greeting {
    display: block;
    font-size: 3rem;
    color: #444746;
    /* Inactive/Dark gray */
    color: #6d6e75;
    font-weight: 500;
}

.title-sparkle {
    color: #4285F4;
    font-size: 2rem;
    position: absolute;
    transform: translate(-10px, -40px);
}

/* Suggestions Chips */
#suggestions-row {
    display: flex;
    gap: 8px;
    width: 100%;
    /* Aligned with chat container */
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-bottom: 8px;
    /* Spacing from input */
    pointer-events: auto;
}

#suggestions-row button {
    background: #1e1f20;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e3e3e3;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#suggestions-row button:hover {
    background: #2a2b2d;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Hide elements utility */
.hidden {
    display: none !important;
}

.input-wrapper {
    background: #1e1f20;
    /* Gemini Dark Input Background */
    pointer-events: auto;
    /* Re-enable clicks on input */
    border: none;
    /* No border for cleaner look */
    border-radius: 32px;
    /* Full Pill Shape */
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 1000px;
    /* Match container width */
    min-height: 56px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: background 0.2s;
}

.input-wrapper:focus-within {
    background: #2a2b2d;
    /* Slightly lighter on focus */
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    direction: rtl;
    /* Arabic typing */
    max-height: 200px;
    overflow-y: auto;
}

#send-btn {
    background: transparent;
    /* No background unless active */
    border: none;
    color: rgba(255, 255, 255, 0.2);
    /* Disabled look */
    border-radius: 4px;
    cursor: not-allowed;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

#send-btn:not(:disabled) {
    color: white;
    /* Active white arrow */
    background: var(--primary-color);
    /* Or just white arrow on green bg like ChatGPT? User has Beso brand */
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    cursor: pointer;
}

.attach-btn {
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.attach-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.disclaimer {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    margin-bottom: 5px;
}



/* --- Auth & Landing Overrides --- */
#login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(circle at 50% 50%, rgba(20, 20, 40, 0.8), transparent 90%),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 240, 255, 0.02) 2px, rgba(0, 240, 255, 0.02) 4px);
    /* Scanline effect */
    z-index: 2000;
}

.login-card {
    background: var(--bg-secondary);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Tech Accent Line */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.input-group {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius-md);
    padding: 0 1rem;
    border: 1px solid #333;
    transition: all 0.3s;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(176, 0, 255, 0.2);
}

.input-group input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    padding: 1rem 0.5rem;
    outline: none;
    font-family: var(--font-body);
}

.login-btn {
    background: linear-gradient(135deg, #7b2cbf, var(--primary-color));
    color: white;
    padding: 1rem;
    border: none;
    border-radius: var(--border-radius-md);
    width: 100%;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

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

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

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

.hidden {
    display: none !important;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

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

/* Custom: Typing Dots - Additional styles handled in main .typing-dots section */

/* Avatar Pulse (Active AI Feel) */
.message.incoming .message-avatar {
    position: relative;
    overflow: hidden;
}

.message.incoming .message-avatar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 4px;
    box-shadow: 0 0 15px var(--primary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(123, 44, 191, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(123, 44, 191, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(123, 44, 191, 0);
    }
}

/* Enhanced Hover Effects */
.history-item:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(5px);
}

.model-selector:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transform: translateY(-1px);
}

/* Smooth Input Focus */
.input-wrapper {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Image Preview Clear Button Hover */
#clear-image:hover {
    background: rgba(255, 68, 68, 0.2) !important;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
}

/* --- Modal Styles --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.active .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 3rem;
    color: #ff4444;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 15px rgba(255, 68, 68, 0.3));
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: white;
}

.modal-message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-modal {
    padding: 10px 25px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
    border: none;
    font-size: 1rem;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 68, 68, 0.4);
}

/* --- Hero Section with Background Image --- */
.hero-section {
    min-height: 90vh;
    /* Increased height for better impact */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 2rem;
    position: relative;
    /* Gradient Overlay + Image */
    background: linear-gradient(to bottom, rgba(10, 10, 18, 0.6), rgba(10, 10, 18, 0.9)),
        url('../images/hero-bg.jpg');
    /* Note the ../images path relative to css folder */
    background-size: cover;
    background-position: center 25%;
    /* Adjusted for better framing */
    background-attachment: fixed;
    /* Parallax effect */
    box-shadow: inset 0 -100px 100px rgba(10, 10, 18, 1);
    /* Seamless blend at bottom */
}

/* --- Responsive Design (Mobile) --- */

/* Utility Classes for Responsive Display */
.hidden-desktop {
    display: none !important;
}

@media (max-width: 768px) {
    .hidden-desktop {
        display: block !important;
    }

    .desktop-only {
        display: none !important;
    }

    .desktop-only-text {
        display: none;
    }

    /* Layout Adjustments */
    #sidebar {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        width: 280px;
        transform: translateX(100%);
        /* Start Hidden (Right side for RTL) */
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }

    #sidebar.active {
        transform: translateX(0);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
    }

    /* Chat Container Full Width */
    #chat-container {
        width: 100%;
        margin-right: 0;
    }

    /* Input Area */
    .input-area {
        padding: 1rem;
    }

    /* Message List */
    #messages-list {
        padding: 1rem 5%;
    }

    .message-content {
        max-width: 90%;
        font-size: 0.95rem;
    }

    /* Header Adjustments */
    .chat-header {
        padding: 1rem;
        gap: 10px;
    }

    .logo-container {
        justify-content: center;
    }

    /* Overlay */
    #sidebar-overlay {
        backdrop-filter: blur(2px);
    }

    /* Login Page Mobile */
    .login-card {
        padding: 2rem;
        margin: 1rem;
        width: 90%;
    }

    .logo-icon-lg {
        font-size: 3rem;
    }

    .login-header h1 {
        font-size: 2rem;
    }
}

/* --- Mobile Menu Styles (Restored) --- */
.mobile-menu-trigger {
    display: none;
    font-size: 1.8rem;
    color: #fff;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 20, 0.98);
    backdrop-filter: blur(15px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
}

.mobile-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.close-menu {
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.close-menu:hover {
    color: var(--accent-color);
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-link {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 12px;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.mobile-link ion-icon {
    font-size: 1.4rem;
}

.mobile-link:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 240, 255, 0.2);
    transform: translateX(10px);
}

.mobile-link.highlight-link {
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.1));
    border-right: 2px solid var(--accent-color);
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .mobile-menu-trigger {
        display: block;
    }

    .logo-container {
        margin-right: auto;
    }

    /* Standard Markdown Styles for Chat */
    .message-content h1,
    .message-content h2,
    .message-content h3 {
        margin-top: 1rem;
        margin-bottom: 0.5rem;
        font-weight: 700;
        color: white;
    }

    .message-content h1 {
        font-size: 1.5rem;
    }

    .message-content h2 {
        font-size: 1.3rem;
    }

    .message-content h3 {
        font-size: 1.1rem;
        border-bottom: 2px solid var(--accent-color);
        padding-bottom: 5px;
        margin-top: 1.5rem;
        display: inline-block;
    }

    .message-content p {
        margin-bottom: 0.8rem;
        line-height: 1.8;
    }

    .message-content ul,
    .message-content ol {
        margin-bottom: 1rem;
        padding-right: 1.5rem;
        /* Arabic RTL padding */
        list-style-position: inside;
    }

    .message-content li {
        margin-bottom: 0.5rem;
        position: relative;
    }

    .message-content strong {
        color: var(--accent-color);
        /* Highlight strong text */
    }

    .message-content code {
        background: rgba(255, 255, 255, 0.1);
        padding: 2px 5px;
        border-radius: 4px;
        font-family: 'Consolas', monospace;
        font-size: 0.9em;
        color: #ffd700;
    }

    .message-content pre code {
        background: transparent;
        padding: 0;
        color: inherit;
        font-size: inherit;
    }

    /* Ensure code blocks look premium */
    .code-block-container {
        background: #0d0d0d;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        margin: 1rem 0;
        overflow: hidden;
        direction: ltr;
        /* Code is always LTR */
        text-align: left;
    }

    .code-header {
        background: #1a1a1a;
        padding: 8px 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .code-lang {
        font-size: 0.8rem;
        color: #888;
        text-transform: uppercase;
    }

    .copy-btn {
        background: transparent;
        border: none;
        color: #888;
        cursor: pointer;
        font-size: 0.8rem;
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .copy-btn:hover {
        color: white;
    }

    pre {
        padding: 15px;
        overflow-x: auto;
        margin: 0;
        font-family: 'Consolas', monospace;
        font-size: 0.9rem;
        line-height: 1.5;
        color: #e0e0e0;
    }

    /* Scrollbar for code */
    pre::-webkit-scrollbar {
        height: 8px;
    }

    pre::-webkit-scrollbar-thumb {
        background: #333;
        border-radius: 4px;
    }

    .history-text {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .delete-chat-btn {
        background: transparent;
        border: none;
        color: #666;
        cursor: pointer;
        opacity: 0;
        /* Hidden by default */
        transition: opacity 0.2s, color 0.2s;
        font-size: 1rem;
        padding: 2px;
    }

    .history-item:hover .delete-chat-btn {
        opacity: 1;
        /* Show on hover */
    }

    .delete-chat-btn:hover {
        color: #ff4444;
    }
}

/* --- Advanced Message Formatting (Gemini Style) --- */

/* Markdown Typography within messages */
.message-content {
    line-height: 1.8;
    /* Gemini Spacing */
    font-size: 1.05rem;
    /* Larger Font */
    font-weight: 400;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    margin-top: 1.2rem;
    margin-bottom: 0.8rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.message-content h1 {
    font-size: 1.4rem;
}

.message-content h2 {
    font-size: 1.25rem;
}

.message-content h3 {
    font-size: 1.1rem;
}

.message-content p {
    margin-bottom: 1rem;
    color: #e1e1e6;
}

.message-content strong {
    color: #fff;
    font-weight: 600;
}

.message-content ul,
.message-content ol {
    margin-bottom: 1rem;
    padding-right: 1.5rem;
    /* RTL standard */
}

.message-content li {
    margin-bottom: 0.4rem;
}

/* Inline Code */
.message-content :not(pre)>code {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

/* --- Code Blocks (Gemini Style) --- */
.code-block-container {
    margin: 1rem 0;
    border-radius: 10px;
    overflow: hidden;
    background: #0d0d0d;
    /* Deep black/gray */
    border: 1px solid rgba(255, 255, 255, 0.1);
    direction: ltr;
    /* Code is always LTR */
    text-align: left;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a23;
    /* Header bg */
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.code-lang {
    color: #a0a0b0;
    font-size: 0.8rem;
    font-family: var(--font-body);
    text-transform: uppercase;
    font-weight: 600;
}

.copy-btn {
    background: transparent;
    border: none;
    color: #a0a0b0;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.copy-btn:hover {
    color: #fff;
}

.code-block-container pre {
    margin: 0;
    padding: 1rem 12px;
    /* Scrollbar consideration */
    overflow-x: auto;
    background: transparent;
}

.code-block-container code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    color: #e0e0e0;
    line-height: 1.5;
}

/* Syntax Highlighting Colors (Basic manual fallback if highlight.js fails) */
.token.comment {
    color: #6a9955;
}

.token.string {
    color: #ce9178;
}

/* =========================================
   Gemini-Style Model Selector (Header)
   ========================================= */
.model-selector-container {
    position: relative;
    z-index: 1000;
}

.model-trigger {
    background: transparent;
    border: none;
    color: var(--text-color);
    /* Light Text */
    font-family: 'Tajawal', sans-serif;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.model-trigger:hover {
    background: rgba(255, 255, 255, 0.05);
    /* Subtle hover */
}

.model-trigger .chevron {
    font-size: 1rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.model-selector-container.active .chevron {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.model-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    /* Align to right for RTL */
    width: 320px;
    background: #1e1e1e;
    /* Dark Grey Surface */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.model-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.model-dropdown.hidden {
    display: none;
}

/* Dropdown Items */
.model-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    direction: rtl;
    /* Ensure RTL flow */
}

.model-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.model-option.selected {
    background: rgba(124, 58, 237, 0.1);
    /* Primary Tint */
}

.model-option.selected .name {
    color: var(--primary-color);
}

.model-icon {
    font-size: 1.4rem;
}

.model-details {
    display: flex;
    flex-direction: column;
}

.model-details .name {
    font-size: 0.95rem;
    font-weight: bold;
    color: #fff;
    text-align: right;
}

.model-details .desc {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
    text-align: right;
}

/* Locked Items */
.model-option.locked {
    opacity: 0.6;
    cursor: default;
    /* Or pointer if we want upgrade modal */
}

.model-option.locked:hover {
    background: rgba(255, 255, 255, 0.02);
}

.lock-indicator {
    font-size: 1.2rem;
    color: #666;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 8px;
}

.token.number {
    color: #b5cea8;
}

/* =========================================
   Gemini-Style Input Bar (Multi-row Expanded)
   ========================================= */
.input-wrapper.gemini-style.expanded {
    background: #1E1E1E;
    border-radius: 32px;
    /* Match single row */
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    position: relative;
    max-width: 850px !important;
    width: 75% !important;
    /* Reduced per red marker */
    /* Shift Left for Desktop */
    margin: 0;
    margin-left: 22% !important;
    /* Moved Right (was 18%) */
    min-height: auto;
}

.input-wrapper.gemini-style.expanded:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    background: #252525;
}

/* Top Row: Input Area */
.input-top-row {
    width: 100%;
    display: flex;
    flex-direction: column;
}

#chat-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #e0e0e0;
    /* Slightly off-white */
    font-family: 'Tajawal', sans-serif;
    font-size: 1.05rem;
    line-height: 1.5;
    padding: 0;
    resize: none;
    min-height: 24px;
    /* Growable */
    max-height: 200px;
    outline: none;
}

#chat-input::placeholder {
    color: #888;
}


/* Bottom Row: Toolbar */
.input-bottom-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Spread Start/End groups */
    width: 100%;
    direction: ltr;
    /* Force LTR structure for Flex logic (Group Start = Right Side visually if in RTL context?) */
    /* wait, page is generally RTL. Let's stick to flex logic: */
    /* If Body is RTL: Start is Right, End is Left. */
    /* User request: "Options under write message" */
    /* Screenshot: Right: [+], Left: [Mic][Model] */
}

/* RTL Override for Toolbar alignment just to be safe */
.input-bottom-toolbar {
    direction: rtl;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}



.toolbar-group.end {
    /* Left Side in RTL */
    margin-right: auto;
    /* Push to far left */
}


/* Transparent Model Trigger (Text Only style) */
.model-trigger-transparent {
    background: transparent;
    border: none;
    color: #cecece;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s;
}

.model-trigger-transparent:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.model-trigger-transparent ion-icon {
    font-size: 1.1rem;
}

.model-trigger-transparent .chevron {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Adjusted Dropdown Position */
.input-wrapper.gemini-style .model-selector-inline {
    margin: 0;
    z-index: 10;
}

.model-dropdown-up.left-aligned {
    right: auto;
    left: 0;
    /* Open from Left side */
}

/* Action Buttons Tweaks */
.action-btn {
    width: 38px;
    height: 38px;
    color: #E3E3E3;
    border-radius: 50%;
    display: flex;
    /* Ensure these are flex */
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.circle-btn {
    background: rgba(255, 255, 255, 0.05);
}

/* Send Button Special */
.send-circle {
    margin-right: 8px;
}

.send-circle:not(:disabled) {
    background: white;
    /* White circle like Gemini */
    color: black;
}

.send-circle:not(:disabled):hover {
    background: #f0f0f0;
}

.send-circle ion-icon {
    font-size: 1.4rem;
}

/* Mic Icon */
.mic-btn {
    margin-left: 0;
}

/* Remove old conflicting styles if any overlap */
.input-actions-right {
    display: none;
}

/* =========================================
   Gemini-Style Input Bar
   ========================================= */


.input-wrapper.gemini-style {
    background: #1E1E1E;
    /* Dark Grey Surface */
    border-radius: 32px;
    /* User requested 32px */
    padding: 16px 24px;
    /* User requested increase */
    display: flex;
    align-items: center;
    gap: 12px;
    /* User requested 12px */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    position: relative;

    /* Base (Laptop/Desktop) */
    width: 75% !important;
    max-width: 850px !important;
    min-width: 320px;

    /* Shift Left for Desktop */
    margin: 0;
    margin-left: 5% !important;
    margin-right: auto !important;

    min-height: 68px;
    /* User requested 64-68px */
}

/* Responsive Rules - Gemini Spec */

/* Mobile */
@media (max-width: 768px) {

    .input-wrapper.gemini-style,
    .input-wrapper.gemini-style.expanded {
        width: 96%;
        padding: 12px 16px;
        min-height: 56px;
        /* Re-center on mobile */
        margin: 0 auto !important;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {

    .input-wrapper.gemini-style,
    .input-wrapper.gemini-style.expanded {
        width: 94%;
        max-width: 950px;
    }
}

/* Laptop */
@media (min-width: 1025px) and (max-width: 1440px) {

    .input-wrapper.gemini-style,
    .input-wrapper.gemini-style.expanded {
        width: 92%;
        max-width: 1150px;
    }
}

/* Desktop */
@media (min-width: 1441px) {

    .input-wrapper.gemini-style,
    .input-wrapper.gemini-style.expanded {
        width: 85%;
        max-width: 1300px;
    }
}

.input-wrapper.gemini-style:focus-within {
    background: #252525;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* Action Buttons */
.action-btn {
    background: transparent;
    border: none;
    color: #E3E3E3;
    width: 44px;
    /* Larger buttons */
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn ion-icon {
    font-size: 22px;
    /* Larger icons */
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.circle-btn {
    background: rgba(255, 255, 255, 0.05);
}

/* Send Button */


.send-circle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-circle:not(:disabled) {
    color: var(--primary-color);
    background: rgba(124, 58, 237, 0.1);
}

.send-circle:not(:disabled):hover {
    background: rgba(124, 58, 237, 0.2);
}

/* Main Input */
#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-family: 'Tajawal', sans-serif;
    font-size: 16px;
    /* Larger text */
    padding: 12px 0;
    outline: none;
    line-height: 1.5;
}

#chat-input::placeholder {
    color: #888;
}

/* Upload Menu */
.upload-menu {
    position: absolute;
    bottom: 140%;
    /* Above button */
    left: 0;
    min-width: 200px;
    background: #1e1e1e;
    /* Dark Surface */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2000;
    animation: slideUp 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.upload-menu.hidden {
    display: none;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.menu-item ion-icon {
    font-size: 1.2rem;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Inline Preview */
.inline-preview {
    margin-left: 10px;
    /* Space between preview and text */
}

.preview-thumb {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: visible;
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.inline-preview.hidden {
    display: none;
}

#clear-image {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff4444;
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.input-actions-right {
    display: flex;
    align-items: center;
    gap: 5px;
}


/* =========================================
   Inline Model Selector (Merged)
   ========================================= */
.model-selector-inline {
    margin-right: 2px;
    /* Space from Upload Btn */
    z-index: 5;
    /* Ensure stacking */
}

.model-trigger-inline {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.8rem;
    /* Smaller Font */
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    /* Tighter Pill */
    border-radius: 16px;
    /* Small Pill */
    transition: all 0.2s ease;
    white-space: nowrap;
}

.model-trigger-inline:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.model-trigger-inline ion-icon {
    font-size: 1rem;
}

.model-trigger-inline .chevron {
    font-size: 0.75rem;
    opacity: 0.7;
}

.current-model-text {
    display: flex;
    align-items: center;
    gap: 4px;
}

.current-model-text ion-icon {
    font-size: 1rem;
}

/* Upward Dropdown */
.model-dropdown-up {
    position: absolute;
    bottom: 130%;
    /* Opens UP */
    right: 0;
    /* Align Right (RTL) */
    width: 260px;
    /* Compact width */
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 2000;
}

.model-dropdown-up.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.model-dropdown-up.hidden {
    display: none;
}

/* Compact Options */
.model-dropdown-up .model-option {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.model-dropdown-up .model-option .model-details .name {
    font-size: 0.9rem;
}

.model-dropdown-up .model-option ion-icon {
    font-size: 1.1rem;
}

/* Logic Handling (handled by existing JS, but IDs match) */

/* Title Text (Right Aligned inside box) */
/* Title Text (Left Aligned for Red Marker) */
.title-text {
    display: block !important;
    text-align: left !important;
    width: 100%;
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #e3e3e3;
    font-family: 'Tajawal', sans-serif;
    padding-left: 4px;
}


/* Ensure input area background is clean */
.input-area {
    background: transparent !important;
    padding: 20px;
    /* Reduced padding to allow width expansion */
}

/* Fix for flex item shrinking */
.input-container-outer {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Fix: The outer upload-container must be full width */
.input-container-outer>.upload-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Disclaimer (Hidden per request) */
.disclaimer {
    display: none !important;
}

/* =========================================
   Sidebar Collapse / Minimize Styles
   ========================================= */

/* Sidebar Toggle Button Hover */
#sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Collapsed Sidebar State */
#sidebar.collapsed {
    width: 78px;
}

/* Hide text labels in collapsed state */
#sidebar.collapsed .sidebar-nav-item span,
#sidebar.collapsed .history-section-label,
#sidebar.collapsed .chat-history,
#sidebar.collapsed #chat-search-input,
#sidebar.collapsed .end-icon {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* Center icons in collapsed state */
#sidebar.collapsed .sidebar-nav-item {
    justify-content: center;
    padding: 10px 0;
}

#sidebar.collapsed .sidebar-nav-item ion-icon {
    margin: 0;
    font-size: 1.4rem;
    /* Slightly larger icons when collapsed */
}

/* Special handling for New Chat button when collapsed */
#sidebar.collapsed .primary-item {
    background: transparent !important;
    color: var(--text-primary) !important;
}

#sidebar.collapsed .primary-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Search item when collapsed */
#sidebar.collapsed .search-item {
    background: transparent !important;
    border: none !important;
    justify-content: center;
}

/* Center the header toggle when collapsed */
#sidebar.collapsed .sidebar-header {
    justify-content: center !important;
    padding: 16px 0 !important;
}

/* =========================================
   New Header Redesign (ExitLag Style)
   ========================================= */


header {
    background: transparent;
    backdrop-filter: blur(0px);
    height: 80px;
    border-bottom: 1px solid transparent;
    box-shadow: none;
    transition: all 0.4s ease;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

header.scrolled {
    background: rgba(10, 10, 18, 0.95);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    padding-top: 5px;
    padding-bottom: 5px;
}

.logo-text {
    font-family: var(--font-heading);
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    position: relative;
    padding: 5px 0;
}

.nav-links a:hover {
    color: #fff;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--accent-color);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-login {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff !important;
    letter-spacing: 1px;
    transition: color 0.3s;
}

.nav-login:hover {
    color: var(--accent-color) !important;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.nav-cta {
    background: var(--primary-color) !important;
    background: linear-gradient(135deg, var(--primary-color), #5a189a) !important;
    color: #fff !important;
    font-family: var(--font-heading) !important;
    font-size: 0.9rem !important;
    padding: 10px 25px !important;
    border-radius: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(123, 44, 191, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

.nav-cta:hover {
    background: var(--primary-glow) !important;
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(123, 44, 191, 0.6);
}

@media (max-width: 992px) {

    .nav-links,
    .auth-buttons {
        display: none !important;
    }

    .mobile-menu-trigger {
        display: block !important;
        font-size: 2rem;
        cursor: pointer;
        color: #fff;
    }
}