/* ============================================
   Ryvex - Advanced UI Styles
   ============================================ */
/* Fonts */
@font-face {
    font-family: 'IRANSansX';
    src: url('../static/fonts/IRANSansX-Bold.ttf') format('truetype');
    font-weight: 700;
}
@font-face {
    font-family: 'IRANSansX';
    src: url('../static/fonts/IRANSansX-Regular.ttf') format('truetype');
    font-weight: 400;
}
@font-face {
    font-family: 'IRANSansX';
    src: url('../static/fonts/IRANSansX-Medium.ttf') format('truetype');
    font-weight: 500;
}
@font-face {
    font-family: 'aonic';
    src: url('../static/fonts/Aonic-SemiBold.woff') format('woff');
    font-weight: 600;
}


 *{
    font-family: 'IRANSansX' , sans-serif;
    font-weight: 500;

}



:root {
    /* Colors - White & Green Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8faf9;
    --bg-tertiary: #f0f4f1;
    --bg-hover: #e8efe9;
    --bg-active: #dce8de;
    --border-primary: #d4e0d6;
    --border-secondary: #c4d4c2;
    --border-glow: rgba(0, 154, 32, 0.3);
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-tertiary: #555555;
    --text-muted: #888888;
    --accent-primary: #009a20;
    --accent-secondary: #007a19;
    --accent-tertiary: #006614;
    --accent-gradient: linear-gradient(135deg, #009a20 0%, #007a19 50%, #006614 100%);
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 40px rgba(0, 154, 32, 0.15);
    --shadow-glow-strong: 0 0 60px rgba(0, 154, 32, 0.25);
    /* Spacing */
    --sidebar-width: 280px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    /* Z-Index */
    --z-sidebar: 100;
    --z-topbar: 90;
    --z-overlay: 200;
    --z-dropdown: 300;
    --z-toast: 400;
    --z-modal: 500;
}
/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    font-size: 16px;
    scroll-behavior: smooth;
}
body {
    font-family: 'IRANSansX', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
/* Selection */
::selection {
    background: rgba(0, 154, 32, 0.2);
    color: var(--text-primary);
}
/* ============================================
   Background Effects
   ============================================ */
.bg-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}
.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}
.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 154, 32, 0.3) 0%, transparent 70%);
    top: -200px;
    left: -100px;
    animation-delay: 0s;
}
.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 122, 25, 0.25) 0%, transparent 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -7s;
}
.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 102, 20, 0.2) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}
.noise-overlay {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.02;
    mix-blend-mode: overlay;
}
@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(-30px, -30px) scale(1.05);
    }
    50% {
        transform: translate(20px, 20px) scale(0.95);
    }
    75% {
        transform: translate(-20px, 30px) scale(1.02);
    }
}
/* ============================================
   App Layout
   ============================================ */
.app {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
}
/* ============================================
   Sidebar (RTL: Left Side)
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: var(--z-sidebar);
    transition: width var(--transition-base);
    flex-shrink: 0;
}
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}
.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-primary);
    min-height: var(--topbar-height);
}
.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    transition: transform var(--transition-base);
    flex-shrink: 0;
}
.logo-icon:hover {
    transform: scale(1.05);
}
.logo-text {
    font-family: 'aonic', sans-serif;
    font-size: 18px;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}
.sidebar-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-secondary);
}
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
}
/* Menu */
.menu {
    margin-bottom: 20px;
}
.menu-section {
    margin-bottom: 24px;
}
.menu-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 12px;
    margin-bottom: 8px;
    white-space: nowrap;
}
.sidebar.collapsed .menu-label {
    opacity: 0;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 14px;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}
.menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.menu-item.active {
    background: var(--bg-active);
    color: var(--text-primary);
}
.menu-item .icon {
    font-size: 20px;
    flex-shrink: 0;
}
.menu-text {
    flex: 1;
    white-space: nowrap;
}
.sidebar.collapsed .menu-text {
    display: none;
}
kbd {
    font-family: inherit;
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-muted);
    white-space: nowrap;
}
.sidebar.collapsed kbd {
    display: none;
}
/* Tooltip */
.menu-item[data-tooltip] {
    position: relative;
}
.menu-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}
.menu-item[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}
.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 12px;
}
/* History */
.history {
    flex: 1;
}
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    margin-bottom: 12px;
}
.history-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar.collapsed .history-title {
    display: none;
}
.icon-action {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0;
}
.history-header:hover .icon-action {
    opacity: 1;
}
.icon-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.history-section {
    margin-bottom: 20px;
}
.history-date {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}
.sidebar.collapsed .history-date {
    display: none;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 13px;
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
}
.history-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.history-item .icon {
    font-size: 18px;
    flex-shrink: 0;
    opacity: 0.6;
}
.sidebar.collapsed .history-item .icon {
    opacity: 1;
}
.history-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar.collapsed .history-text {
    display: none;
}
.history-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.history-item:hover .history-actions {
    opacity: 1;
}
.mini-action {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.mini-action:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}
/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-primary);
}
.storage-info {
    margin-bottom: 12px;
}
.sidebar.collapsed .storage-info {
    display: none;
}
.storage-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 6px;
}
.storage-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}
.storage-text {
    font-size: 11px;
    color: var(--text-muted);
}
.upgrade-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, rgba(0, 154, 32, 0.08) 0%, rgba(0, 122, 25, 0.08) 100%);
    border: 1px solid rgba(0, 154, 32, 0.15);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.upgrade-card:hover {
    background: linear-gradient(135deg, rgba(0, 154, 32, 0.12) 0%, rgba(0, 122, 25, 0.12) 100%);
    border-color: rgba(0, 154, 32, 0.25);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}
.upgrade-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}
.upgrade-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.sidebar.collapsed .upgrade-info {
    display: none;
}
.upgrade-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}
.upgrade-desc {
    font-size: 11px;
    color: var(--text-muted);
}
.upgrade-card .arrow {
    font-size: 20px;
    color: var(--accent-primary);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}
.upgrade-card:hover .arrow {
    transform: translateX(-4px);
}
/* ============================================
   Main Content
   ============================================ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    height: 100vh;
}
/* ============================================
   Topbar
   ============================================ */
.topbar {
    height: var(--topbar-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    position: relative;
    z-index: var(--z-topbar);
    flex-shrink: 0;
}
.topbar-right,
.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.mobile-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
/* Model Selector */
.model-selector {
    position: relative;
}
.model-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.model-current:hover {
    background: var(--bg-hover);
    border-color: var(--border-secondary);
}
.model-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}
.model-current span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.model-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    min-width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-dropdown);
}
.model-selector:hover .model-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.model-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.model-option:hover {
    background: var(--bg-hover);
}
.model-option.selected {
    background: rgba(0, 154, 32, 0.08);
}
.model-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.model-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.model-desc {
    font-size: 12px;
    color: var(--text-muted);
}
.model-option .check {
    font-size: 18px;
    color: var(--accent-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.model-option.selected .check {
    opacity: 1;
}
/* Chat Title */
.chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 14px;
    color: var(--text-secondary);
}
/* Topbar Buttons */
.topbar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}
.topbar-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-primary);
}
/* User Profile */
.user-profile {
    position: relative;
    cursor: pointer;
}
.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}
.user-profile:hover img {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(0, 154, 32, 0.2);
}
.profile-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    left: auto;
    min-width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-dropdown);
}
.user-profile:hover .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 8px;
}
.profile-header img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
}
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.profile-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.profile-email {
    font-size: 12px;
    color: var(--text-muted);
}
.profile-menu {
    padding: 4px;
}
.profile-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition-fast);
}
.profile-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.profile-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 8px 0;
}
/* ============================================
   Chat Area
   ============================================ */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}
.welcome-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 154, 32, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    animation: welcomePulse 4s ease-in-out infinite;
}
@keyframes welcomePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}
.welcome-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 600px;
    width: 100%;
}
.welcome-icon {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-ring {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(0, 154, 32, 0.25);
    border-radius: 50%;
    animation: ringPulse 3s ease-in-out infinite;
}
.icon-ring.delay-1 {
    animation-delay: -1s;
}
.icon-ring.delay-2 {
    animation-delay: -2s;
}
@keyframes ringPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}
.welcome-icon svg {
    position: relative;
    z-index: 1;
    animation: iconFloat 3s ease-in-out infinite;
}
@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}
.welcome-content h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.welcome-content p {
    font-size: 16px;
    color: var(--text-tertiary);
    margin-bottom: 40px;
    line-height: 1.8;
}
/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}
.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.quick-action:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}
/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.message {
    display: flex;
    gap: 16px;
    max-width: 800px;
    animation: messageSlide 0.3s ease-out;
}
@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.message.user {
    flex-direction: row-reverse;
    margin-left: auto;
    margin-right: 0;
}
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.message.assistant .message-avatar {
    background: var(--accent-gradient);
    color: white;
}
.message.user .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
}
.message-content {
    flex: 1;
    min-width: 0;
}
.message-bubble {
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.8;
}
.message.assistant .message-bubble {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
}
.message.user .message-bubble {
    background: var(--accent-gradient);
    color: white;
    border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg);
}
.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}
/* ============================================
   Input Area - FIXED ALIGNMENT
   ============================================ */
.input-area {
    padding: 16px 20px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    flex-shrink: 0;
}
.input-container {
    max-width: 800px;
    margin: 0 auto;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}
.input-tools {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    padding-bottom: 6px;
}
.tool-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.tool-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-secondary);
}
.input-box {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 8px 12px;
    transition: all var(--transition-fast);
}
.input-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 154, 32, 0.1), var(--shadow-glow);
}
.input-box textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    min-height: 24px;
    max-height: 150px;
    padding: 4px 0;
}
.input-box textarea::placeholder {
    color: var(--text-muted);
}
.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.action-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
    border-color: var(--border-secondary);
}
.action-btn.send-btn {
    background: var(--accent-gradient);
    border: none;
    color: white;
}
.action-btn.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}
.action-btn.send-btn:active {
    transform: scale(0.95);
}
.input-hints {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    justify-content: center;
}
.hint {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.hint kbd {
    font-family: inherit;
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
}
/* ============================================
   Tooltips
   ============================================ */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}
/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: var(--z-toast);
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    animation: toastSlide 0.3s ease-out;
    pointer-events: auto;
}
@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.toast.success {
    border-color: var(--success);
}
.toast.error {
    border-color: var(--error);
}
.toast.warning {
    border-color: var(--warning);
}
.toast.info {
    border-color: var(--info);
}
.toast-message {
    font-size: 14px;
    color: var(--text-primary);
}
/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}
.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}
.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
}
.spinner-ring {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spinnerRotate 1.2s linear infinite;
}
.spinner-ring:nth-child(2) {
    inset: 8px;
    border-top-color: var(--accent-secondary);
    animation-delay: -0.4s;
    animation-duration: 1s;
}
.spinner-ring:nth-child(3) {
    inset: 16px;
    border-top-color: var(--accent-tertiary);
    animation-delay: -0.8s;
    animation-duration: 0.8s;
}
@keyframes spinnerRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
.loading-overlay span {
    font-size: 14px;
    color: var(--text-secondary);
}
/* ============================================
   Sidebar Overlay (Mobile) - RTL FIXED
   ============================================ */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: calc(var(--z-sidebar) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}
/* ============================================
   SVG Icons
   ============================================ */
.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.icon-sm {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.icon-lg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
/* ============================================
   Responsive Styles - COMPLETE FIX
   ============================================ */
/* Tablet */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 260px;
    }
    .welcome-content h1 {
        font-size: 28px;
    }
    .quick-actions {
        grid-template-columns: 1fr;
    }
    .input-tools {
        display: none;
    }
}
/* Mobile - Sidebar from LEFT (RTL) */
@media (max-width: 1023px) {
    :root {
        --topbar-height: 56px;
    }
    /* Sidebar becomes fixed and slides from LEFT */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;  /* Changed from right for RTL */
        right: auto !important;
        height: 100vh;
        width: 280px;
        max-width: 85vw;
        transform: translateX(-100%) !important;  /* Slide from left */
        transition: transform var(--transition-base) !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        z-index: 1000 !important;
    }
    .sidebar.open {
        transform: translateX(0) !important;
    }
    /* Override collapsed state for mobile */
    .sidebar.collapsed {
        width: 280px;
        transform: translateX(-100%) !important;
    }
    .sidebar.collapsed .menu-text,
    .sidebar.collapsed .history-text,
    .sidebar.collapsed .history-date,
    .sidebar.collapsed .menu-label,
    .sidebar.collapsed .storage-info,
    .sidebar.collapsed .upgrade-info {
        display: block !important;
    }
    .sidebar.collapsed .menu-item[data-tooltip]::after {
        display: none;
    }
    /* Show hamburger menu button */
    .mobile-menu-btn {
        display: flex !important;
    }
    .topbar-center {
        display: none;
    }
    .topbar {
        padding: 0 12px;
    }
    .topbar-right {
        gap: 8px;
    }
    .model-current span {
        display: none;
    }
    .welcome-screen {
        padding: 24px;
    }
    .welcome-content h1 {
        font-size: 24px;
    }
    .welcome-content p {
        font-size: 14px;
    }
    .welcome-icon {
        width: 80px;
        height: 80px;
    }
    .welcome-icon svg {
        width: 48px;
        height: 48px;
    }
    .input-area {
        padding: 12px 16px 20px;
    }
    .input-hints {
        display: none;
    }
    .message {
        gap: 12px;
    }
    .message-avatar {
        width: 32px;
        height: 32px;
    }
    .message-bubble {
        padding: 12px 16px;
        font-size: 13px;
    }
}
/* Small Mobile */
@media (max-width: 480px) {
    .welcome-content h1 {
        font-size: 20px;
    }
    .quick-action {
        padding: 12px 16px;
        font-size: 13px;
    }
    .topbar-btn {
        width: 36px;
        height: 36px;
    }
    .user-profile img {
        width: 36px;
        height: 36px;
    }
    .action-btn {
        width: 36px;
        height: 36px;
    }
    .input-box {
        padding: 10px 12px;
    }
    .input-box textarea {
        font-size: 14px;
    }
}
/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* Print Styles */
@media print {
    /* مخفی کردن عناصر غیرضروری */
    .sidebar,
    .topbar,
    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }

    /* تنظیمات صفحه */
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    /* حذف پس‌زمینه‌ها */
    * {
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* تنظیمات لینک‌ها */
    a {
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666;
    }

    /* نمایش URL بعد از لینک‌ها */
    .print-url::after {
        content: " (" attr(href) ")";
    }

    /* جلوگیری از شکستن جدول */
    table, tr, td, th {
        page-break-inside: avoid;
    }

    /* تنظیم سرفصل‌ها */
    h1, h2, h3 {
        page-break-after: avoid;
    }

    /* نمایش محتوای اصلی */
    .main-content,
    .content,
    article {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* افزودن URL صفحه */
    @page {
        margin: 1.5cm;
        size: A4;
    }
}