/* Linkma Stylesheet - پشتیبانی از RTL/LTR و Dark/Light Mode */
:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 0.5rem;
  --gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

/* ===== Layout ===== */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; background: var(--bg-card); border-inline-start: 1px solid var(--border);
  padding: 1.5rem; transition: width 0.3s;
}
.main-content { flex: 1; padding: 2rem; max-width: 1200px; margin: 0 auto; width: 100%; }

/* ===== Header ===== */
.top-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.logo {
  font-size: 1.5rem; font-weight: 800;
  background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem;
}
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.stat-value { font-size: 2rem; font-weight: 700; margin: 0.5rem 0; }
.stat-label { color: var(--text-secondary); font-size: 0.875rem; }
.stat-icon { font-size: 1.5rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem; background: var(--primary); color: white;
  border: none; border-radius: var(--radius); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: background 0.2s; font-family: inherit;
}
.btn:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg-secondary); }
.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }

/* ===== Inputs ===== */
.input, .select {
  width: 100%; padding: 0.625rem 0.875rem; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: inherit; font-size: 0.875rem; transition: border-color 0.2s;
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); }
label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 500; }
.form-group { margin-bottom: 1rem; }

/* ===== Table ===== */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: start; border-bottom: 1px solid var(--border); }
th { color: var(--text-secondary); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
tr:hover { background: var(--bg-secondary); }

/* ===== Login ===== */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card { width: 100%; max-width: 400px; }

/* ===== Charts ===== */
.chart-container { position: relative; height: 300px; margin-top: 1rem; }
.bar { transition: opacity 0.2s; }
.bar:hover { opacity: 0.8; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 2rem; inset-inline-end: 2rem; padding: 1rem 1.5rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 1000; animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { transform: translateY(1rem); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== Nav ===== */
.nav-link {
  display: block; padding: 0.75rem 1rem; color: var(--text-secondary);
  text-decoration: none; border-radius: var(--radius); margin-bottom: 0.25rem; font-size: 0.875rem;
  transition: background 0.2s, color 0.2s;
}
.nav-link:hover, .nav-link.active { background: var(--bg-secondary); color: var(--text); }

/* ===== Modal ===== */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 1rem;
}
.modal-content { background: var(--bg-card); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: fixed; bottom: 0; inset-inline: 0; top: auto; padding: 0.5rem; z-index: 50; }
  .main-content { padding: 1rem; padding-bottom: 4rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .top-header { flex-direction: column; align-items: stretch; }
}
