@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap');

:root {
    /* تم پیش‌فرض (روشن) */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    /* این رنگ‌ها از طریق فایل HTML توسط کاربر قابل شخصی‌سازی هستند */
    --accent: #f43f5e;
    --accent-hover: #e11d48;
    --accent-glow: rgba(244, 63, 94, 0.15);
    
    /* رنگ‌های وضعیت */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
}

[data-theme="dark"] {
    /* تم تاریک */
    --bg-main: #0B0B0E;
    --bg-card: #151519;
    --border: #232329;
    --text-main: #ffffff;
    --text-muted: #8A8D98;
    /* رنگ accent در اینجا تغییر نمیکند تا تنظیمات کاربر حفظ شود */
}

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

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
    /* انیمیشن نرم برای تغییر بین تم روشن و تاریک */
    transition: background-color 0.3s ease, color 0.3s ease; 
}

/* ============================
   LAYOUT & SIDEBAR
============================ */
.app-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-main);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-text h2 {
    font-size: 1.1rem;
    font-weight: 600;
}
.brand-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.nav-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(128, 128, 128, 0.1);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background: var(--accent);
    border-radius: 4px 0 0 4px; /* Flipped for RTL */
}

/* ============================
   MAIN CONTENT & HEADER
============================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 32px 40px;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-greeting h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.header-greeting p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

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

/* ============================
   GRID & CARDS
============================ */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}
.col-span-12 { grid-column: span 12; }
.col-span-8 { grid-column: span 8; }
.col-span-7 { grid-column: span 7; }
.col-span-6 { grid-column: span 6; }
.col-span-5 { grid-column: span 5; }
.col-span-4 { grid-column: span 4; }
.col-span-3 { grid-column: span 3; }

.bento-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.card-title {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 12px;
}

/* ============================
   METRICS & BADGES
============================ */
.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.metric-badge {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.metric-badge.up { background: var(--success-bg); color: var(--success); }
.metric-badge.down { background: var(--danger-bg); color: var(--danger); }

/* ============================
   FORMS, BUTTONS & INPUTS
============================ */
.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-family: inherit;
}
.btn-primary:hover {
    opacity: 0.9;
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
    font-family: inherit;
}
.btn-outline:hover { border-color: var(--text-muted); }

/* پشتیبانی از ورودی‌های جدید مثل select و فایل */
input[type="text"], 
input[type="number"], 
input[type="password"], 
input[type="tel"], 
input[type="file"], 
textarea, 
select {
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s, background-color 0.3s, color 0.3s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* ============================
   PROJECT CARDS & IMAGES
============================ */
.project-card {
    display: flex;
    gap: 20px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}
.project-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.project-image {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--border);
    flex-shrink: 0;
}

/* نوار پیشرفت فروش سهام */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
}

/* ============================
   TABLES (ADMIN PANEL)
============================ */
table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}
th, td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

/* ============================
   CUSTOM TOAST NOTIFICATIONS
============================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    background: var(--bg-card);
    border-right: 4px solid var(--accent); /* راست‌چین برای زبان فارسی */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 16px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    transform: translateX(-120%);
    animation: slideIn 0.4s forwards, fadeOut 0.4s 4.6s forwards;
}

.toast.success { border-right-color: var(--success); }
.toast.error { border-right-color: var(--danger); }

.toast i { font-size: 1.2rem; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }

/* انیمیشن‌های ورود و خروج Toast */
@keyframes slideIn { 
    to { transform: translateX(0); } 
}
@keyframes fadeOut { 
    to { opacity: 0; visibility: hidden; } 
}