/* ══════════════════════════════════════════════════
   app.css — استایل اصلی سامانه مجتمع تجاری
   ══════════════════════════════════════════════════ */

/* ─── متغیرها ─────────────────────────────────────── */
:root {
  --primary:    #4361ee;
  --primary-d:  #3451d1;
  --success:    #2ecc71;
  --warning:    #f39c12;
  --danger:     #e74c3c;
  --sidebar-w:  240px;
  --bg:         #f0f2f5;
  --surface:    #ffffff;
  --border:     #e5e7eb;
  --text:       #1f2937;
  --text-light: #6b7280;
  --radius:     10px;
  --shadow:     0 2px 8px rgba(0,0,0,.08);
}

/* ─── ریست ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: Tahoma, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #1a1a2e;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  z-index: 100;
}
.sidebar-logo {
  padding: 1.5rem 1.2rem;
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-item {
  display: block;
  padding: .75rem 1.4rem;
  color: #b0b0c0;
  text-decoration: none;
  transition: background .15s, color .15s;
  font-size: .9rem;
}
.nav-item:hover, .nav-item.active {
  background: rgba(67,97,238,.25);
  color: #fff;
}
.sidebar-user {
  padding: 1rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,.2);
  color: #aaa;
  padding: .3rem .7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  font-family: inherit;
}
.btn-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ─── محتوا ────────────────────────────────────────── */
.main-content {
  margin-right: var(--sidebar-w);
  padding: 2rem;
  flex: 1;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ─── Alert ────────────────────────────────────────── */
.alert {
  padding: .85rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: .9rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ─── Page Header ──────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.8rem;
}
.page-header h1 { font-size: 1.5rem; }
.subtitle { color: var(--text-light); font-size: .9rem; }

/* ─── Buttons ──────────────────────────────────────── */
.btn {
  padding: .55rem 1.2rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: .9rem;
  font-family: inherit;
  cursor: pointer;
  border: none;
  display: inline-block;
  transition: background .15s;
}
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-light); }
.btn-sm   { padding: .3rem .7rem; font-size: .8rem; border-radius: 6px; }
.btn-success { background: var(--success); color: #fff; }

/* ─── Forms ────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 680px;
}
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-size: .85rem; color: var(--text-light); margin-bottom: .4rem; }
.form-group small  { display: block; font-size: .78rem; color: var(--text-light); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
input, select, textarea {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  background: var(--surface);
  transition: border .15s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.form-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }

/* ─── Filter Bar ────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .8rem;
  align-items: center;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.input-search { flex: 1; min-width: 200px; }
.select-filter { width: 160px; }

/* ─── Table ────────────────────────────────────────── */
.table-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.data-table th {
  background: #f8f9fb;
  padding: .85rem 1rem;
  text-align: right;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.empty-state { text-align: center; color: var(--text-light); padding: 2rem !important; }
.actions { display: flex; gap: .4rem; }

/* ─── Badge ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .25rem .65rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
}
.badge-active   { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.badge-paid     { background: #d1fae5; color: #065f46; }
.badge-unpaid   { background: #fef3c7; color: #92400e; }

/* ─── Pagination ────────────────────────────────────── */
.pagination { display: flex; gap: .4rem; margin-top: 1rem; }
.page-btn {
  padding: .4rem .8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: .85rem;
  background: var(--surface);
}
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Stats Grid ────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  gap: 1rem;
  align-items: center;
}
.stat-icon { font-size: 2rem; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; }
.stat-label { display: block; font-size: .8rem; color: var(--text-light); }
.stat-card--success { border-right: 4px solid var(--success); }
.stat-card--warning { border-right: 4px solid var(--warning); }

/* ─── Summary Bar ────────────────────────────────────── */
.summary-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.summary-item {
  background: var(--surface);
  border-radius: 8px;
  padding: .8rem 1.2rem;
  box-shadow: var(--shadow);
}
.s-label { display: block; font-size: .78rem; color: var(--text-light); }
.s-value { font-size: 1.1rem; font-weight: 700; }
.summary-item--success .s-value { color: #065f46; }
.summary-item--warning .s-value { color: #92400e; }

/* ─── Detail Grid ────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.detail-card h2 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-light); }
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: .6rem; }
.detail-list dt { color: var(--text-light); font-size: .88rem; }
.detail-list dd { font-size: .9rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.hint { color: var(--text-light); font-size: .88rem; }

/* ─── Quick Actions ──────────────────────────────────── */
.quick-actions h2 { font-size: 1rem; color: var(--text-light); margin-bottom: .8rem; }
.action-cards { display: flex; gap: 1rem; flex-wrap: wrap; }
.action-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: .9rem;
  transition: box-shadow .15s, transform .15s;
}
.action-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); }

/* ─── Modal ─────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  width: 420px;
  max-width: 95vw;
}
.modal-box h3 { margin-bottom: 1.2rem; }
.modal-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  body { flex-direction: column; }
  .sidebar { position: relative; width: 100%; height: auto; }
  .main-content { margin-right: 0; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row    { grid-template-columns: 1fr; }
}
