/* ============================================================
   Smart Task Manager - Style
   Hebrew RTL, dark+light theme
   ============================================================ */

* { box-sizing: border-box; }

:root {
  --bg: #f8fafc;
  --bg-elev: #ffffff;
  --bg-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-text: #ffffff;

  --success: #16a34a;
  --success-bg: #dcfce7;
  --success-text: #14532d;

  --warning: #d97706;
  --warning-bg: #fef3c7;
  --warning-text: #78350f;

  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-text: #7f1d1d;

  --info-bg: #dbeafe;
  --info-text: #1e3a8a;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  height: 100%;
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============== LAYOUT ============== */

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #1e293b, #0f172a);
  color: white;
  padding: 24px 0;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.sidebar-brand .subtitle {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: #cbd5e1;
  font-size: 14px;
  transition: background 0.15s;
}

.sidebar-nav li a:hover {
  background: rgba(255,255,255,0.05);
  color: white;
  text-decoration: none;
}

.sidebar-nav li a.active {
  background: rgba(37, 99, 235, 0.2);
  color: white;
  border-right: 3px solid #2563eb;
  padding-right: 21px;
}

.sidebar-nav li a .icon {
  margin-left: 10px;
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 24px;
  margin-top: 30px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 11px;
  color: #64748b;
}

.main {
  padding: 30px 40px;
  overflow-y: auto;
}

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

.page-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.page-subtitle {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 13px;
}

/* ============== CARDS ============== */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1100px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============== STATUS PILLS ============== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.pill.success { background: var(--success-bg); color: var(--success-text); }
.pill.warning { background: var(--warning-bg); color: var(--warning-text); }
.pill.danger { background: var(--danger-bg); color: var(--danger-text); }
.pill.info { background: var(--info-bg); color: var(--info-text); }
.pill.muted { background: #e2e8f0; color: var(--text-muted); }

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.pill.success .dot { background: #16a34a; animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============== BUTTONS ============== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
}
.btn.primary:hover { background: var(--primary-hover); }

.btn.success {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn.warning {
  background: var(--warning);
  border-color: var(--warning);
  color: white;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn.large {
  padding: 12px 24px;
  font-size: 14px;
}

/* ============== STATS ============== */

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.stat .label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.stat .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.stat .delta {
  font-size: 11px;
  color: var(--text-muted);
}
.stat.success { border-right: 4px solid var(--success); }
.stat.warning { border-right: 4px solid var(--warning); }
.stat.danger { border-right: 4px solid var(--danger); }
.stat.info { border-right: 4px solid var(--primary); }

/* ============== STATUS LIST ============== */

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.status-row:last-child { border-bottom: none; }

.status-row .left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-row .icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.status-row .name {
  font-weight: 600;
  font-size: 14px;
}

.status-row .detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============== TABLES ============== */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: right;
  padding: 10px 12px;
  background: var(--bg-hover);
  border-bottom: 2px solid var(--border-strong);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table tr:hover td { background: var(--bg-hover); }

/* ============== PROGRESS BAR ============== */

.progress {
  width: 100%;
  height: 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ============== ALERTS ============== */

.alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
  border-right: 4px solid;
  font-size: 13px;
}
.alert.success { background: var(--success-bg); color: var(--success-text); border-color: var(--success); }
.alert.warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning); }
.alert.danger { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger); }
.alert.info { background: var(--info-bg); color: var(--info-text); border-color: var(--primary); }

/* ============== TERMINAL OUTPUT ============== */

.terminal {
  background: #0f172a;
  color: #cbd5e1;
  padding: 16px;
  border-radius: 6px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  direction: ltr;
  text-align: left;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============== MODAL ============== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: white;
  border-radius: 8px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

/* ============== TOAST ============== */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
.toast.success { background: #16a34a; }
.toast.danger { background: #dc2626; }

/* ============== UTILITIES ============== */

.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.hidden { display: none !important; }
