@font-face{
    font-family: 'FontMan';
    src: url('https://www.nginxweb.ir/web/fonts/Vazir.ttf') format('truetype'),
         url('https://www.nginxweb.ir/web/fonts/Vazir.woff') format('woff'),
         url('https://www.nginxweb.ir/web/fonts/Vazir.woff2') format('woff2');
}
* { box-sizing: border-box; margin:0; padding:0; font-family:'FontMan', Tahoma, sans-serif; }
body { background:#f8f9fa; color:#202123; }
.container { max-width:800px; margin:30px auto; padding:20px;background-color: #ffffff;box-shadow: 0px 8px 11px 2px #ccc;border-radius: 20px; }

/* استایل جدید برای هدر */
.header-container {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.header-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-20px, -20px) rotate(360deg); }
}

.header-content {
    position: relative;
    z-index: 2;
}

.header-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header-icon {
    font-size: 2.2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.header-subtitle {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
    font-weight: 300;
}

.tabs { display:flex; gap:8px; margin-bottom:15px; flex-wrap:wrap; }
.tab { padding:10px 14px; border-radius:10px; background:#e0e0e0; cursor:pointer; color:#555; font-weight:500; display:flex; align-items:center; gap:6px; transition: all 0.3s ease; }
.tab:hover { background:#d0d0d0; }
.tab.active { background:#10a37f; color:#fff; }
.chat-box { background:#ffffff; border-radius:8px; padding:16px; max-height:60vh; overflow-y:auto; display:flex; flex-direction:column; gap:10px; border:1px solid #ddd; }
.message { padding:12px; border-radius:6px; line-height:1.4; word-wrap: break-word; position: relative; }
.user { background:#10a37f; color:#fff; align-self:flex-end; max-width:80%; }
.bot { background:#f1f1f1; color:#202123; align-self:flex-start; max-width:80%; }
.input-area { display:flex; margin-top:12px; gap:8px; align-items: flex-end; }
.textarea-container { 
    flex:1; 
    position: relative;
    display: flex;
    align-items: center;
}
textarea { 
    width: 100%;
    padding: 12px 40px 12px 12px;
    border-radius:6px;
    border:1px solid #ccc;
    resize: vertical;
    background:#fff;
    color:#202123;
    min-height: 200px;
    max-height: 200px;
    line-height: 1.5;
    font-size: 14px;
}
.resize-handle {
    position: absolute;
    left: 8px;
    bottom: 8px;
    color: #666;
    font-size: 12px;
    cursor: ns-resize;
    user-select: none;
}
/* استایل جدید برای شمارنده کاراکتر */
.char-counter {
    position: absolute;
    left: 8px;
    top: 8px;
    font-size: 12px;
    color: #666;
    background: rgba(255,255,255,0.9);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}
.char-counter.warning {
    color: #ff9800;
    font-weight: bold;
}
.char-counter.limit {
    color: #f44336;
    font-weight: bold;
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
button { padding:10px 16px; border:none; border-radius:6px; cursor:pointer; font-weight:600; }
#sendBtn { background:#10a37f; color:#fff; }
#clearBtn { background:#f44336; color:#fff; }
#copyBtn { background:#2196F3; color:#fff; }
#clearContextBtn { background:#ff9800; color:#fff; }
button:disabled { background:#aaa; cursor:not-allowed; }
.action-buttons { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.copy-btn { 
    position: absolute; 
    left: 8px; 
    top: 8px; 
    background: rgba(0,0,0,0.1); 
    border: none; 
    border-radius: 4px; 
    padding: 4px 8px; 
    font-size: 12px; 
    cursor: pointer; 
    opacity: 0; 
    transition: opacity 0.2s; 
}
.message:hover .copy-btn { opacity: 1; }
.bot .copy-btn { color: #333; background: rgba(255,255,255,0.7); }
.user .copy-btn { color: #fff; background: rgba(255,255,255,0.2); }
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #4CAF50;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.error-message {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    margin: 10px 0;
}
/* استایل برای کدها */
.code-block {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 12px;
    border-radius: 6px;
    margin: 8px 0;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}
.code-block pre {
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
}
.inline-code {
    background: #f1f1f1;
    color: #d63384;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    direction: ltr;
    display: inline-block;
}
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #444;
}
.code-language {
    color: #ccc;
    font-size: 12px;
    font-weight: bold;
}
.code-copy-btn {
    background: #444;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}
.code-copy-btn:hover {
    background: #555;
}
/* استایل برای متن Bold */
.bold-text {
    font-weight: bold;
    color: #2c3e50;
}
.context-info {
    background: #e3f2fd;
    color: #1565c0;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 5px 0;
    font-size: 12px;
    text-align: center;
    border: 1px solid #bbdefb;
}
/* استایل برای وضعیت CPU */
.cpu-status {
    margin-top: 20px;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    flex-direction: column;
}
.cpu-normal {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}
.cpu-warning {
    background: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffcc80;
}
.cpu-high {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}
.cpu-progress-container {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-top: 5px;
    overflow: hidden;
}
.cpu-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease, background-color 0.3s ease;
}
.cpu-normal .cpu-progress-bar { background: #4caf50; }
.cpu-warning .cpu-progress-bar { background: #ff9800; }
.cpu-high .cpu-progress-bar { background: #f44336; }
.cpu-text {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

/* استایل جدید برای فوتر و شمارنده */
.footer {
    margin-top: 30px;
    padding: 15px;
    text-align: center;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 8px;
    direction: rtl;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-text {
    color: #888;
    font-size: 11px;
}

.api-counter {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.api-counter .count {
    background: white;
    color: #667eea;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: 4px;
    font-weight: bold;
}

/* رسپانسیو برای موبایل */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .api-counter {
        margin-top: 5px;
    }
}