/**
 * Smart HR - Comprehensive Bento Grid Dark Theme & Design System
 * Version: 1.0.0
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --shr-bg: #0A0A0C;
  --shr-card-bg: #141418;
  --shr-card-bg-elevated: #1B1B22;
  --shr-card-bg-subtle: #111115;
  --shr-border: rgba(255, 255, 255, 0.08);
  --shr-border-hover: rgba(99, 102, 241, 0.35);
  
  --shr-primary: #6366F1;
  --shr-primary-hover: #4F46E5;
  --shr-primary-glow: rgba(99, 102, 241, 0.2);
  
  --shr-emerald: #10B981;
  --shr-emerald-bg: rgba(16, 185, 129, 0.12);
  --shr-emerald-border: rgba(16, 185, 129, 0.25);
  
  --shr-amber: #F59E0B;
  --shr-amber-bg: rgba(245, 158, 11, 0.12);
  --shr-amber-border: rgba(245, 158, 11, 0.25);
  
  --shr-rose: #EF4444;
  --shr-rose-bg: rgba(239, 68, 68, 0.12);
  --shr-rose-border: rgba(239, 68, 68, 0.25);

  --shr-sky: #0EA5E9;
  --shr-sky-bg: rgba(14, 165, 233, 0.12);
  --shr-sky-border: rgba(14, 165, 233, 0.25);

  --shr-purple: #8B5CF6;
  --shr-purple-bg: rgba(139, 92, 246, 0.12);
  --shr-purple-border: rgba(139, 92, 246, 0.25);

  --shr-text-main: #F8FAFC;
  --shr-text-muted: #94A3B8;
  --shr-text-dim: #64748B;

  --shr-radius-xl: 24px;
  --shr-radius-lg: 18px;
  --shr-radius-md: 12px;
  --shr-radius-sm: 8px;
  --shr-radius-full: 9999px;
}

/* WordPress Admin Wrapper Isolation & Reset */
body.smart-hr-admin-page {
  background-color: var(--shr-bg) !important;
  color: var(--shr-text-main) !important;
  font-family: 'Cairo', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

body.smart-hr-admin-page #wpcontent {
  background-color: var(--shr-bg) !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.smart-hr-admin-page #wpbody-content {
  padding-bottom: 40px !important;
  float: none !important;
}

body.smart-hr-admin-page .notice,
body.smart-hr-admin-page div.updated,
body.smart-hr-admin-page div.error {
  margin: 16px 24px !important;
  border-radius: var(--shr-radius-md) !important;
  background: var(--shr-card-bg-elevated) !important;
  border: 1px solid var(--shr-border) !important;
  color: var(--shr-text-main) !important;
}

/* Main Container */
.shr-app,
.smart-hr-bento-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px;
  box-sizing: border-box;
  color: var(--shr-text-main);
  font-family: 'Cairo', 'Plus Jakarta Sans', system-ui, sans-serif;
  direction: rtl;
  text-align: right;
}

.shr-app *,
.smart-hr-bento-container * {
  box-sizing: border-box;
}

/* Typography */
.shr-page-header,
.smart-hr-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--shr-border);
  gap: 16px;
  flex-wrap: wrap;
}

.shr-page-title {
  color: #FFFFFF !important;
  font-size: 24px !important;
  font-weight: 800 !important;
  margin: 0 0 6px 0 !important;
  line-height: 1.3 !important;
  letter-spacing: -0.02em;
}

.shr-page-subtitle {
  color: var(--shr-text-muted) !important;
  font-size: 13.5px !important;
  margin: 0 !important;
  line-height: 1.5 !important;
}

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

/* Bento Grid System */
.shr-grid-12,
.smart-hr-bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

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

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

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

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

@media (max-width: 768px) {
  .shr-grid-4, .shr-grid-2 { grid-template-columns: 1fr; }
  .shr-grid-12, .smart-hr-bento-grid { grid-template-columns: 1fr; }
  .smart-hr-bento-card[style*="grid-column"] { grid-column: span 12 !important; }
}

/* Cards */
.shr-card,
.smart-hr-bento-card {
  background-color: var(--shr-card-bg);
  border: 1px solid var(--shr-border);
  border-radius: var(--shr-radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.shr-card:hover,
.smart-hr-bento-card:hover {
  border-color: var(--shr-border-hover);
}

.smart-hr-bento-hero {
  grid-column: span 7;
  background: linear-gradient(145deg, #16161C, #121216);
  border-radius: var(--shr-radius-xl);
}

.smart-hr-bento-indigo-card {
  grid-column: span 5;
  background: linear-gradient(135deg, #6366F1, #4338CA);
  border-radius: var(--shr-radius-xl);
  color: #FFFFFF;
  border: none;
}

/* KPI Stat Cards */
.shr-kpi-card {
  background-color: var(--shr-card-bg);
  border: 1px solid var(--shr-border);
  border-radius: var(--shr-radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s ease;
}

.shr-kpi-card:hover {
  border-color: var(--shr-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.shr-kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--shr-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.shr-kpi-icon-wrap .dashicons {
  font-size: 24px;
  width: 24px;
  height: 24px;
}

.shr-icon-indigo { background: rgba(99, 102, 241, 0.15); color: #818CF8; border: 1px solid rgba(99, 102, 241, 0.3); }
.shr-icon-emerald { background: var(--shr-emerald-bg); color: #34D399; border: 1px solid var(--shr-emerald-border); }
.shr-icon-amber { background: var(--shr-amber-bg); color: #FBBF24; border: 1px solid var(--shr-amber-border); }
.shr-icon-rose { background: var(--shr-rose-bg); color: #F87171; border: 1px solid var(--shr-rose-border); }
.shr-icon-sky { background: var(--shr-sky-bg); color: #38BDF8; border: 1px solid var(--shr-sky-border); }
.shr-icon-purple { background: var(--shr-purple-bg); color: #A78BFA; border: 1px solid var(--shr-purple-border); }

.shr-kpi-body {
  flex: 1;
}

.shr-kpi-label {
  display: block;
  color: var(--shr-text-muted);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.shr-kpi-val {
  color: #FFFFFF;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.shr-kpi-meta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.shr-btn,
.shr-badge-indigo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: var(--shr-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: inherit;
  line-height: 1.4;
}

.shr-btn-primary {
  background: var(--shr-primary);
  color: #FFFFFF !important;
  box-shadow: 0 4px 14px var(--shr-primary-glow);
}
.shr-btn-primary:hover {
  background: var(--shr-primary-hover);
  transform: translateY(-1px);
}

.shr-btn-secondary {
  background: var(--shr-card-bg-elevated);
  border-color: var(--shr-border);
  color: var(--shr-text-main) !important;
}
.shr-btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: #23232C;
}

.shr-btn-success {
  background: var(--shr-emerald);
  color: #FFFFFF !important;
}
.shr-btn-success:hover {
  background: #059669;
}

.shr-btn-danger {
  background: var(--shr-rose);
  color: #FFFFFF !important;
}
.shr-btn-danger:hover {
  background: #DC2626;
}

.shr-btn-ghost {
  background: transparent;
  color: var(--shr-text-muted) !important;
}
.shr-btn-ghost:hover {
  color: var(--shr-text-main) !important;
  background: rgba(255, 255, 255, 0.05);
}

.shr-btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--shr-radius-sm);
}

.shr-btn-xs {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--shr-radius-sm);
}

/* Badges & Chips */
.shr-badge,
.smart-hr-badge-indigo,
.smart-hr-badge-emerald,
.smart-hr-badge-amber,
.smart-hr-badge-rose {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--shr-radius-full);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
}

.shr-badge-success,
.smart-hr-badge-emerald {
  background: var(--shr-emerald-bg);
  color: #34D399;
  border: 1px solid var(--shr-emerald-border);
}

.shr-badge-warning,
.smart-hr-badge-amber {
  background: var(--shr-amber-bg);
  color: #FBBF24;
  border: 1px solid var(--shr-amber-border);
}

.shr-badge-danger,
.smart-hr-badge-rose {
  background: var(--shr-rose-bg);
  color: #F87171;
  border: 1px solid var(--shr-rose-border);
}

.shr-badge-info,
.smart-hr-badge-indigo {
  background: rgba(99, 102, 241, 0.15);
  color: #818CF8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.shr-badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--shr-text-muted);
  border: 1px solid var(--shr-border);
}

/* Tables */
.shr-table-card {
  padding: 0;
  overflow: hidden;
}

.shr-table-responsive {
  width: 100%;
  overflow-x: auto;
}

.shr-table,
.smart-hr-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  color: var(--shr-text-main);
  text-align: right;
}

.shr-table thead tr,
.smart-hr-table thead tr {
  background: #101014;
  border-bottom: 1px solid var(--shr-border);
}

.shr-table th,
.smart-hr-table th {
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--shr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--shr-border);
  white-space: nowrap;
}

.shr-table td,
.smart-hr-table td {
  padding: 15px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.shr-table tbody tr,
.smart-hr-table tbody tr {
  transition: background-color 0.15s ease;
}

.shr-table tbody tr:hover,
.smart-hr-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.025);
}

.shr-table tbody tr:last-child td,
.smart-hr-table tbody tr:last-child td {
  border-bottom: none;
}

/* Filters & Forms */
.shr-filter-card {
  background: var(--shr-card-bg);
  border: 1px solid var(--shr-border);
  border-radius: var(--shr-radius-lg);
  padding: 18px 22px;
  margin-bottom: 20px;
}

.shr-filter-grid {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.shr-search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.shr-input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--shr-text-dim);
  pointer-events: none;
}

.shr-input,
.shr-select,
.shr-textarea {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--shr-card-bg-elevated);
  border: 1px solid var(--shr-border);
  border-radius: var(--shr-radius-md);
  color: #FFFFFF;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.shr-search-input-wrap .shr-input {
  padding-right: 38px;
}

.shr-input:focus,
.shr-select:focus,
.shr-textarea:focus {
  border-color: var(--shr-primary);
  box-shadow: 0 0 0 3px var(--shr-primary-glow);
}

.shr-select {
  cursor: pointer;
}

.shr-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.shr-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--shr-text-muted);
}

/* Alerts Banner */
.shr-alerts-banner {
  background: var(--shr-card-bg);
  border: 1px solid var(--shr-border);
  border-radius: var(--shr-radius-lg);
  padding: 14px 20px;
  margin-bottom: 20px;
}

.shr-alerts-list {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.shr-alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--shr-radius-md);
  font-size: 12.5px;
  font-weight: 600;
}

.shr-alert-warning { background: var(--shr-amber-bg); color: #FBBF24; border: 1px solid var(--shr-amber-border); }
.shr-alert-danger { background: var(--shr-rose-bg); color: #F87171; border: 1px solid var(--shr-rose-border); }
.shr-alert-info { background: var(--shr-sky-bg); color: #38BDF8; border: 1px solid var(--shr-sky-border); }

.shr-alert-link {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  margin-right: 4px;
}

/* Tabs */
.shr-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--shr-border);
  margin-bottom: 20px;
  padding-bottom: 2px;
}

.shr-tab-btn {
  background: transparent;
  border: none;
  color: var(--shr-text-muted);
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--shr-radius-md) var(--shr-radius-md) 0 0;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  font-family: inherit;
}

.shr-tab-btn:hover {
  color: #FFFFFF;
}

.shr-tab-btn.active {
  color: var(--shr-primary);
}

.shr-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--shr-primary);
  border-radius: 2px;
}

/* Modals */
.shr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.shr-modal-overlay.active {
  display: flex;
}

.shr-modal {
  background: var(--shr-card-bg);
  border: 1px solid var(--shr-border);
  border-radius: var(--shr-radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: shrModalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  direction: rtl;
  text-align: right;
}

@keyframes shrModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.shr-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--shr-border);
}

.shr-modal-title {
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.shr-modal-close {
  background: transparent;
  border: none;
  color: var(--shr-text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
.shr-modal-close:hover { color: #FFFFFF; }

.shr-modal-body {
  padding: 24px;
}

.shr-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid var(--shr-border);
  background: var(--shr-card-bg-subtle);
}

/* Helpers */
.text-emerald { color: #34D399 !important; }
.text-amber { color: #FBBF24 !important; }
.text-rose { color: #F87171 !important; }
.text-indigo { color: #818CF8 !important; }
.shr-text-muted { color: var(--shr-text-muted) !important; }
.shr-text-center { text-align: center !important; }
.shr-text-left { text-align: left !important; }
.shr-mb-6 { margin-bottom: 24px !important; }
.shr-code {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  color: #A5B4FC;
}
