:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --bg-input: #334155;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
}

* { box-sizing: border-box; outline: none; }
body { font-family: 'Vazirmatn', sans-serif; background-color: var(--bg-dark); color: var(--text-main); margin: 0; min-height: 100vh; display: flex; overflow-x: hidden; }

/* Sidebar */
.sidebar { width: 280px; background: var(--bg-panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; padding: 25px; z-index: 100; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.logo { font-size: 1.5rem; font-weight: 900; margin-bottom: 30px; display: flex; align-items: center; gap: 12px; }
.logo i { color: var(--primary); }
.close-sidebar-btn { display: none; position: absolute; top: 20px; left: 20px; background: transparent; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.user-profile-card { background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%); border: 1px solid rgba(99, 102, 241, 0.3); border-radius: 16px; padding: 15px; margin-bottom: 30px; }
.profile-header { display: flex; align-items: center; gap: 12px; }
.user-avatar img { width: 45px; height: 45px; border-radius: 50%; border: 2px solid var(--primary); }
.user-info { display: flex; flex-direction: column; }
.user-info .name { font-weight: bold; font-size: 0.95rem; color: white; }
.user-info .status { font-size: 0.75rem; color: #fbbf24; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.profile-stats { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.8rem; color: var(--text-muted); text-align: center; }
.nav-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 10px; font-weight: bold; opacity: 0.7; }
.nav-item { padding: 12px 16px; color: #cbd5e1; cursor: pointer; border-radius: 12px; transition: 0.2s; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; font-weight: 500; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: white; transform: translateX(-3px); }
.nav-item.active { background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, transparent 100%); color: var(--primary); border-right: 3px solid var(--primary); }
.external-icon { margin-right: auto; font-size: 0.8rem; opacity: 0.5; }
.nav-item.telegram:hover { color: #229ED9; background: rgba(34, 158, 217, 0.1); }
.nav-item.instagram:hover { color: #E1306C; background: rgba(225, 48, 108, 0.1); }
.nav-divider { height: 1px; background: var(--border); margin: 20px 0; opacity: 0.5; }
.sidebar-footer { margin-top: auto; font-size: 0.75rem; color: var(--text-muted); text-align: center; opacity: 0.5; }

/* History Panel & Data Actions */
.history-panel { position: fixed; top: 0; left: -320px; bottom: 0; width: 320px; background: var(--bg-panel); border-right: 1px solid var(--border); z-index: 2000; box-shadow: 5px 0 20px rgba(0,0,0,0.3); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; }
.history-panel.active { transform: translateX(320px); }
.history-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.history-header h3 { margin: 0; font-size: 1rem; color: white; display: flex; align-items: center; gap: 8px; }
.close-history-btn { background: transparent; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }
.history-content { flex: 1; overflow-y: auto; padding: 15px; }
.history-item { background: var(--bg-dark); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; transition: 0.2s; }
.history-item:hover { border-color: var(--primary); }
.history-date { font-size: 0.65rem; color: var(--text-muted); display: block; margin-bottom: 5px; }
.history-text { font-size: 0.8rem; color: #e2e8f0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; }
.history-actions { display: flex; gap: 5px; justify-content: flex-end; }
.history-action-btn { background: rgba(255,255,255,0.05); border: none; color: var(--text-muted); font-size: 0.7rem; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.history-action-btn:hover { background: var(--primary); color: white; }
.empty-history { text-align: center; color: var(--text-muted); font-size: 0.8rem; margin-top: 50px; }
.history-footer { padding: 15px; border-top: 1px solid var(--border); text-align: center; }

/* Data Actions Buttons */
.data-actions { display: flex; gap: 10px; margin-bottom: 15px; }
.data-btn { flex: 1; padding: 8px; border-radius: 8px; font-family: 'Vazirmatn'; font-size: 0.8rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; border: none; transition: 0.2s; color: white; }
.data-btn.export { background: rgba(16, 185, 129, 0.1); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.data-btn.export:hover { background: #10b981; color: white; }
.data-btn.import { background: rgba(59, 130, 246, 0.1); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.data-btn.import:hover { background: #3b82f6; color: white; }

.clear-history-btn { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); padding: 8px 16px; border-radius: 8px; cursor: pointer; font-family: 'Vazirmatn'; font-size: 0.8rem; width: 100%; transition: 0.2s; }

/* Main Content */
.main-content { flex: 1; padding: 40px; overflow-y: auto; display: flex; flex-direction: column; max-width: 1400px; margin: 0 auto; width: 100%; height: 100vh; }
.top-header { display: flex; align-items: flex-start; gap: 15px; }
.top-header h1 { margin: 0; font-size: 2rem; font-weight: 800; }
.top-header p { color: var(--text-muted); margin-top: 8px; }
.header-actions-left { display: flex; align-items: center; }
.mobile-menu-btn { display: none; background: var(--bg-input); border: 1px solid var(--border); color: white; font-size: 1.2rem; padding: 10px; border-radius: 10px; cursor: pointer; }
.history-btn { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 1.1rem; margin-left: 15px; transition: 0.2s; }
.history-btn:hover { background: var(--bg-panel); color: white; }
.sidebar-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 90; display: none; opacity: 0; transition: opacity 0.3s; backdrop-filter: blur(3px); }

/* Inputs & Buttons */
.input-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 20px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); margin-top: 30px; }
.input-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.badge { background: rgba(99, 102, 241, 0.1); color: var(--primary); padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; }
.surprise-btn, .save-idea-btn, .view-ideas-btn { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted); width: 35px; height: 35px; border-radius: 8px; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.surprise-btn:hover { color: #f59e0b; border-color: #f59e0b; }
.save-idea-btn:hover { color: #f472b6; border-color: #f472b6; }
.view-ideas-btn:hover { color: #60a5fa; border-color: #60a5fa; }
textarea { width: 100%; background: var(--bg-dark); border: 2px solid var(--border); border-radius: 12px; color: white; padding: 15px; font-size: 1rem; font-family: 'Vazirmatn'; min-height: 100px; resize: vertical; }
textarea:focus { border-color: var(--primary); }

/* Voice Button */
.voice-btn { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #f87171; width: 35px; height: 35px; border-radius: 50%; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.voice-btn:hover { background: #ef4444; color: white; }
.voice-btn.recording { background: #ef4444; color: white; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); animation: pulse-red 1.5s infinite; }
.voice-btn.recording i { animation: none; }
.vertical-separator { width: 1px; background: var(--border); margin: 0 5px; height: 25px; align-self: center; }
@keyframes pulse-red { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

/* My Ideas Panel */
.ideas-panel { background: var(--bg-dark); border: 1px solid var(--border); border-radius: 12px; padding: 15px; margin-top: 10px; margin-bottom: 20px; animation: fadeIn 0.3s ease; }
.ideas-panel h4 { margin: 0 0 10px 0; font-size: 0.9rem; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.ideas-list { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.saved-idea-item { background: rgba(255,255,255,0.05); padding: 10px; border-radius: 8px; font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: 0.2s; }
.saved-idea-item:hover { background: rgba(255,255,255,0.1); }
.saved-idea-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: 10px; }
.delete-idea-btn { background: none; border: none; color: #ef4444; cursor: pointer; padding: 5px; font-size: 0.9rem; opacity: 0.6; }
.delete-idea-btn:hover { opacity: 1; }

.advanced-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.05); }
.setting-col { display: flex; flex-direction: column; gap: 10px; }
.negative-prompt-container { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: rgba(0,0,0,0.2); }
.negative-header { padding: 12px 15px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.03); color: var(--text-muted); font-size: 0.9rem; font-weight: 500; transition: 0.2s; }
.negative-header:hover { color: white; background: rgba(255,255,255,0.05); }
.negative-content { display: none; padding: 15px; border-top: 1px solid var(--border); }
.negative-content textarea { min-height: 60px; font-size: 0.85rem; padding: 10px; margin-bottom: 10px; }
.negative-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.negative-tags span { background: rgba(255,255,255,0.1); color: var(--text-muted); padding: 4px 8px; border-radius: 6px; font-size: 0.75rem; cursor: pointer; transition: 0.2s; }
.negative-tags span:hover { background: #ef4444; color: white; }

/* Toggle & Checks */
.toggle-container { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }
.toggle-container input { display: none; }
.checkmark { width: 40px; height: 22px; background: var(--bg-input); border-radius: 20px; position: relative; transition: 0.3s; }
.checkmark::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #94a3b8; border-radius: 50%; transition: 0.3s; }
input:checked + .checkmark { background: var(--primary); }
input:checked + .checkmark::after { transform: translateX(18px); background: white; }
.face-options-panel { background: rgba(0,0,0,0.2); border-radius: 12px; padding: 15px; margin-top: 10px; border: 1px solid var(--border); animation: fadeIn 0.3s ease; }
.radio-group { display: flex; gap: 10px; margin-top: 10px; }
.radio-card { flex: 1; cursor: pointer; position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.radio-content { background: var(--bg-input); border-radius: 8px; padding: 8px; text-align: center; font-size: 0.8rem; color: var(--text-muted); border: 1px solid transparent; display: flex; flex-direction: column; gap: 5px; }
.radio-card input:checked + .radio-content { background: rgba(99, 102, 241, 0.15); border-color: var(--primary); color: var(--primary); }
.custom-fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.custom-fields-grid input { width: 100%; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 8px; color: white; padding: 8px; font-size: 0.85rem; font-family: 'Vazirmatn'; }
.camera-controls { background: var(--bg-dark); border: 1px solid var(--border); border-radius: 12px; padding: 15px; height: 100%; }
.divider { border: 0; height: 1px; background: var(--border); margin: 15px 0; }
.custom-select { width: 100%; padding: 10px; background: var(--bg-input); border: 1px solid var(--border); color: white; border-radius: 8px; font-family: 'Vazirmatn'; cursor: pointer; }
.text-fixer-box { background: rgba(255, 255, 255, 0.05); padding: 10px; border-radius: 8px; border: 1px dashed rgba(255, 255, 255, 0.2); }
.text-input-field { width: 100%; background: var(--bg-input); border: 1px solid var(--primary); padding: 8px; border-radius: 6px; color: white; font-family: 'Vazirmatn'; font-size: 0.9rem; }
.controls-footer { display: flex; justify-content: flex-end; margin-top: 20px; }
.btn-generate { background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); border: none; color: white; padding: 14px 35px; border-radius: 12px; font-weight: bold; cursor: pointer; font-family: 'Vazirmatn'; display: flex; align-items: center; gap: 10px; transition: 0.2s; }
.btn-generate:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4); }

/* Style Grid & Output */
.style-selector { margin-top: 40px; }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; margin-top: 20px; }
.style-card { position: relative; height: 100px; border-radius: 16px; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: transform 0.2s, border-color 0.2s; background-color: var(--bg-panel); }
.style-card img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; opacity: 0.6; }
.style-card::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 60%; background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); z-index: 1; }
.style-card .name { position: absolute; bottom: 10px; right: 10px; left: 10px; font-size: 0.85rem; font-weight: 700; color: white; z-index: 2; text-align: right; text-shadow: 0 2px 4px rgba(0,0,0,0.8); }
.style-card.selected { border-color: var(--primary); transform: scale(1.05); box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4); }
.style-card.selected img { opacity: 1; }
.style-card:hover img { transform: scale(1.1); }
.output-section { margin-top: 40px; padding-bottom: 50px; animation: slideUp 0.5s ease; }
.output-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.console-window { border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.fa-window { background: #1e293b; border: 1px solid #334155; }
.en-window { background: #020617; border: 1px solid #1e293b; }
.console-header { padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; font-weight: bold; color: #94a3b8; }
.console-header .window-actions .dot { width: 10px; height: 10px; border-radius: 50%; }
.yellow { background: #f59e0b; } .green { background: #10b981; }
.console-body { padding: 20px; flex: 1; }
.fa-text { direction: rtl; text-align: right; color: #e2e8f0; line-height: 1.8; }
.en-text { direction: ltr; text-align: left; color: #4ade80; font-family: monospace; line-height: 1.6; }
.console-footer { padding: 10px 20px; background: rgba(0,0,0,0.1); display: flex; justify-content: flex-end; }
.btn-copy { background: rgba(255,255,255,0.1); border: none; color: white; padding: 6px 15px; border-radius: 6px; cursor: pointer; font-family: 'Vazirmatn'; display: flex; align-items: center; gap: 5px; font-size: 0.85rem; }

/* Quick Actions Panel */
.quick-actions-panel { margin-top: 30px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px; animation: fadeIn 0.5s ease; }
.qa-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-weight: bold; color: white; flex-wrap: wrap; }
.qa-header i { color: #fbbf24; }
.qa-subtitle { font-size: 0.75rem; color: var(--text-muted); font-weight: normal; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.action-btn { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-radius: 10px; text-decoration: none; font-size: 0.85rem; font-weight: 500; transition: transform 0.2s, box-shadow 0.2s; color: white; background: var(--bg-dark); border: 1px solid rgba(255,255,255,0.1); }
.action-btn:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.action-btn i { font-size: 1.1rem; }
.action-btn.chatgpt:hover { background: #10a37f; border-color: #10a37f; }
.action-btn.gemini:hover { background: linear-gradient(90deg, #4b90ff, #ff5546); border-color: transparent; }
.action-btn.bing:hover { background: #008ad8; border-color: #008ad8; }
.action-btn.midjourney:hover { background: #5865F2; border-color: #5865F2; }
.action-btn.grok:hover { background: #000000; border-color: #ffffff; }
.action-btn.firefly:hover { background: linear-gradient(90deg, #ff0000, #ff9900); border-color: transparent; }
.action-btn.leonardo:hover { background: linear-gradient(90deg, #8b5cf6, #ec4899); border-color: transparent; }

@media (max-width: 768px) {
    .sidebar { position: fixed; right: 0; top: 0; bottom: 0; width: 280px; transform: translateX(100%); z-index: 1000; box-shadow: none; }
    .sidebar.active { transform: translateX(0); box-shadow: -5px 0 20px rgba(0,0,0,0.5); }
    .mobile-menu-btn, .close-sidebar-btn { display: block; }
    .sidebar-overlay.active { display: block; opacity: 1; }
    .advanced-settings-grid, .output-grid, .custom-fields-grid { grid-template-columns: 1fr; }
    .top-header { align-items: center; }
    .top-header h1 { font-size: 1.4rem; }
    .top-header p { font-size: 0.9rem; }
    .history-btn { margin-left: 10px; }
    .input-header { gap: 5px; }
    .actions-grid { grid-template-columns: 1fr 1fr; }
}
