/* ============================================================================
 * FolksPMS — modern theme
 * - Inter (Latin) + IBM Plex Sans Arabic (RTL)
 * - Indigo / cyan accent, soft surfaces, glassy nav
 * - Works for both [dir="ltr"] and [dir="rtl"]
 * ========================================================================== */

:root {
  --fpms-bg:        #f4f6fb;
  --fpms-surface:   #ffffff;
  --fpms-surface-2: #f8fafc;
  --fpms-border:    #e6e9f2;
  --fpms-text:      #1a1f36;
  --fpms-text-2:    #4a5375;
  --fpms-muted:     #8b94b1;

  --fpms-primary:        #4338ca;   /* indigo-700 */
  --fpms-primary-soft:   #eef0ff;
  --fpms-primary-hover:  #3730a3;
  --fpms-accent:         #06b6d4;   /* cyan-500 */
  --fpms-success:        #10b981;
  --fpms-warn:           #f59e0b;
  --fpms-danger:         #ef4444;

  --fpms-shadow-sm: 0 1px 2px rgba(20, 26, 60, .04), 0 1px 3px rgba(20, 26, 60, .06);
  --fpms-shadow:    0 4px 12px rgba(20, 26, 60, .08), 0 2px 4px rgba(20, 26, 60, .06);
  --fpms-shadow-lg: 0 10px 30px rgba(20, 26, 60, .12), 0 4px 12px rgba(20, 26, 60, .08);

  --fpms-radius-sm: 6px;
  --fpms-radius:    10px;
  --fpms-radius-lg: 14px;

  --fpms-sidebar-w: 260px;
  --fpms-sidebar-w-collapsed: 72px;
  --fpms-topbar-h: 64px;

  --fpms-font-en: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fpms-font-ar: 'IBM Plex Sans Arabic', 'Noto Naskh Arabic', system-ui, sans-serif;
}

html, body {
  margin: 0; padding: 0;
  background: var(--fpms-bg);
  color: var(--fpms-text);
  font-family: var(--fpms-font-en);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

html[lang^="ar"], html[dir="rtl"] body {
  font-family: var(--fpms-font-ar);
}

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

h1, h2, h3, h4, h5, h6 { color: var(--fpms-text); font-weight: 600; }

/* -- Surface, card -- */
.fpms-card {
  background: var(--fpms-surface);
  border: 1px solid var(--fpms-border);
  border-radius: var(--fpms-radius);
  box-shadow: var(--fpms-shadow-sm);
}
.fpms-card-lg { padding: 24px; }
.fpms-card-md { padding: 16px; }

/* -- Buttons -- */
.fpms-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  font-weight: 600; font-size: 14px;
  border-radius: var(--fpms-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  background: var(--fpms-surface);
  color: var(--fpms-text);
}
.fpms-btn:hover { border-color: var(--fpms-border); background: var(--fpms-surface-2); }
.fpms-btn-primary {
  background: var(--fpms-primary); color: #fff;
}
.fpms-btn-primary:hover { background: var(--fpms-primary-hover); border-color: var(--fpms-primary-hover); color: #fff; }
.fpms-btn-ghost { background: transparent; color: var(--fpms-text-2); }
.fpms-btn-ghost:hover { background: var(--fpms-surface-2); }

/* -- Inputs -- */
.fpms-input, .fpms-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--fpms-border);
  border-radius: var(--fpms-radius-sm);
  background: var(--fpms-surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--fpms-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fpms-input:focus, .fpms-select:focus {
  outline: none;
  border-color: var(--fpms-primary);
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.15);
}
.fpms-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fpms-text-2);
  margin-bottom: 6px;
  letter-spacing: .02em;
  text-transform: uppercase;
}

/* -- Layout shell -- */
.fpms-shell { display: flex; min-height: 100vh; }

.fpms-sidebar {
  width: var(--fpms-sidebar-w);
  background: linear-gradient(180deg, #1f2046 0%, #2a2c5e 100%);
  color: #c7cae6;
  flex-shrink: 0;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  box-shadow: var(--fpms-shadow);
  z-index: 10;
}

html[dir="rtl"] .fpms-sidebar { box-shadow: 0 4px 12px rgba(20, 26, 60, .08), -2px 0 4px rgba(20, 26, 60, .06); }

.fpms-brand {
  padding: 20px 24px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.fpms-brand-dot {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--fpms-primary) 0%, var(--fpms-accent) 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 14px;
}

.fpms-nav {
  flex: 1; overflow-y: auto;
  padding: 12px 8px;
}
.fpms-nav-section {
  font-size: 11px;
  font-weight: 700;
  color: #6b6f96;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 14px 16px 6px;
}
.fpms-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  margin: 2px 4px;
  color: #c7cae6;
  border-radius: var(--fpms-radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.fpms-nav a:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
  text-decoration: none;
}
.fpms-nav a.active {
  background: rgba(67, 56, 202, 0.35);
  color: #fff;
}
.fpms-nav i { width: 18px; text-align: center; opacity: .8; }
.fpms-nav a:hover i, .fpms-nav a.active i { opacity: 1; }

.fpms-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fpms-topbar {
  height: var(--fpms-topbar-h);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--fpms-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 5;
}
.fpms-topbar-left { display: flex; align-items: center; gap: 14px; }
.fpms-topbar-right { display: flex; align-items: center; gap: 14px; }
.fpms-topbar-title { font-size: 16px; font-weight: 600; color: var(--fpms-text); }

.fpms-icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--fpms-surface-2);
  color: var(--fpms-text-2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s ease;
}
.fpms-icon-btn:hover { background: var(--fpms-primary-soft); color: var(--fpms-primary); }

.fpms-user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--fpms-surface-2);
  cursor: pointer;
}
html[dir="rtl"] .fpms-user-chip { padding: 4px 4px 4px 10px; }
.fpms-user-chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.fpms-user-chip-name { font-size: 13px; font-weight: 600; color: var(--fpms-text); line-height: 1.2; }
.fpms-user-chip-role { font-size: 11px; color: var(--fpms-muted); line-height: 1.2; }

.fpms-content { flex: 1; padding: 24px; }

/* -- Page header -- */
.fpms-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.fpms-page-title { font-size: 22px; font-weight: 700; margin: 0; }
.fpms-page-subtitle { color: var(--fpms-muted); margin-top: 4px; }

/* -- Tiles grid for dashboard -- */
.fpms-tile-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.fpms-tile {
  background: var(--fpms-surface);
  border: 1px solid var(--fpms-border);
  border-radius: var(--fpms-radius);
  padding: 20px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.fpms-tile:hover { transform: translateY(-2px); box-shadow: var(--fpms-shadow); }
.fpms-tile-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fpms-primary-soft); color: var(--fpms-primary);
  font-size: 18px;
  margin-bottom: 14px;
}
.fpms-tile-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.fpms-tile-desc { color: var(--fpms-muted); font-size: 13px; }
.fpms-tile-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--fpms-surface-2); color: var(--fpms-text-2);
  margin-top: 10px;
}
.fpms-tile-badge.live { background: rgba(16,185,129,.12); color: var(--fpms-success); }

/* -- Login page -- */
.fpms-login-wrap {
  min-height: 100vh;
  display: flex; align-items: stretch;
  background: linear-gradient(135deg, #1f2046 0%, #2a2c5e 50%, #06b6d4 200%);
}
.fpms-login-brand {
  flex: 1.1; display: flex; flex-direction: column;
  justify-content: center; padding: 60px;
  color: #fff;
}
.fpms-login-brand h1 { color: #fff; font-size: 42px; line-height: 1.1; margin: 0 0 16px; font-weight: 800; letter-spacing: -.02em; }
.fpms-login-brand p { color: rgba(255,255,255,.78); font-size: 16px; max-width: 460px; }
.fpms-login-card {
  flex: 1; background: #fff; display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.fpms-login-form {
  width: 100%; max-width: 380px;
}
.fpms-login-form h2 { margin: 0 0 6px; font-size: 24px; }
.fpms-login-form .muted { color: var(--fpms-muted); margin-bottom: 28px; }
.fpms-login-form .fpms-input { padding: 12px 14px; font-size: 15px; }
.fpms-login-form .fpms-btn-primary { width: 100%; justify-content: center; padding: 12px 14px; font-size: 15px; margin-top: 8px; }

/* -- Language switcher -- */
.fpms-lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--fpms-border);
  background: var(--fpms-surface);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.fpms-lang-btn:hover { background: var(--fpms-primary-soft); color: var(--fpms-primary); }

/* -- Tables (modern listing) -- */
.fpms-table {
  width: 100%; border-collapse: collapse;
  background: var(--fpms-surface);
  border: 1px solid var(--fpms-border);
  border-radius: var(--fpms-radius);
  overflow: hidden;
}
.fpms-table th {
  background: var(--fpms-surface-2);
  text-align: start;
  padding: 12px 16px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--fpms-text-2);
  border-bottom: 1px solid var(--fpms-border);
}
.fpms-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--fpms-border);
  font-size: 13.5px;
}
.fpms-table tr:last-child td { border-bottom: 0; }
.fpms-table tr:hover td { background: var(--fpms-surface-2); }

/* -- Badge -- */
.fpms-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.fpms-badge.success { background: rgba(16,185,129,.12); color: var(--fpms-success); }
.fpms-badge.warn { background: rgba(245,158,11,.12); color: var(--fpms-warn); }
.fpms-badge.danger { background: rgba(239,68,68,.12); color: var(--fpms-danger); }
.fpms-badge.muted { background: var(--fpms-surface-2); color: var(--fpms-muted); }

/* -- Footer -- */
.fpms-footer {
  padding: 16px 24px;
  text-align: center;
  color: var(--fpms-muted);
  font-size: 12px;
  border-top: 1px solid var(--fpms-border);
  background: var(--fpms-surface);
}

/* -- RTL adjustments -- */
html[dir="rtl"] .fpms-nav a { text-align: right; }
html[dir="rtl"] .fpms-page-header { flex-direction: row-reverse; }

/* -- Mobile (basic responsiveness) -- */
@media (max-width: 768px) {
  .fpms-sidebar { position: fixed; transform: translateX(-100%); transition: transform .2s ease; }
  .fpms-sidebar.open { transform: translateX(0); }
  html[dir="rtl"] .fpms-sidebar { transform: translateX(100%); }
  html[dir="rtl"] .fpms-sidebar.open { transform: translateX(0); }
  .fpms-login-wrap { flex-direction: column; }
  .fpms-login-brand { padding: 40px; flex: 0 0 auto; }
}
