@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@3/dist/tabler-icons.min.css');

/* ===== Tailwind CDN (only utility classes) ===== */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

/* ===== Base Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; direction: rtl; }

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background var(--transition-base), color var(--transition-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Selection ===== */
::selection { background: rgba(108,92,231,0.2); color: var(--text-primary); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Navbar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-navbar);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: background var(--transition-base);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.navbar-brand .brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}

.navbar-brand span { color: var(--primary); }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  margin: 0 20px;
}

.navbar-nav a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.navbar-nav a:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.navbar-nav a.active {
  background: rgba(108,92,231,0.08);
  color: var(--primary);
  font-weight: 600;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mobile-menu-btn { display: none; }

/* ===== Search Bar ===== */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-bar input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-toolbar);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
  background: var(--bg-card);
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-toolbar);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108,92,231,0.05);
}

/* ===== Layout ===== */
.layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  padding: 16px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  transition: background var(--transition-base);
}

.sidebar-section { margin-bottom: 20px; }

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 12px 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-bottom: 1px;
}

.sidebar-item:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(108,92,231,0.08);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-item .icon { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-item .badge {
  margin-right: auto;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(0,184,148,0.1);
  color: var(--success);
  font-weight: 700;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  padding: 28px 36px;
  max-width: 100%;
  overflow-x: hidden;
  opacity: 1;
  transition: opacity var(--transition-base), transform var(--transition-base);
  min-height: calc(100vh - 64px);
}

.main-content.transitioning {
  opacity: 0;
  transform: translateY(8px);
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding: 0;
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { color: var(--border); font-size: 11px; }
.breadcrumbs .current { color: var(--text-primary); font-weight: 600; }

/* ===== Page Header ===== */
.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.3;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-top: 6px;
  max-width: 600px;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  transition: all var(--transition-base);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 { font-size: 16px; font-weight: 700; }

/* ===== Tool Cards Grid ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition-base);
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.tool-card:hover::before { transform: scaleX(1); }

.tool-card .icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}

.tool-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.tool-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tool-card .badge-free {
  position: absolute;
  top: 12px; left: 12px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(0,184,148,0.1);
  color: var(--success);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font);
  text-decoration: none;
  line-height: 1;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

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

.btn-accent:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg-toolbar);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108,92,231,0.05);
}

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { width: 40px; height: 40px; padding: 0; justify-content: center; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-toolbar);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
  background: var(--bg-card);
}

.form-input::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-input-group {
  display: flex;
  gap: 8px;
}

.form-input-group .form-input { flex: 1; }

/* ===== Skeleton Loader ===== */
.skeleton {
  background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-title { height: 22px; margin-bottom: 12px; width: 60%; }
.skeleton-card { height: 160px; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 12px; }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Tool Box ===== */
.tool-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  max-width: 680px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}

.tool-box h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.tool-box .sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ===== Result Box ===== */
.result-box {
  background: var(--bg-toolbar);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
  display: none;
  animation: fadeSlideUp 0.35s ease;
}

.result-box.show { display: block; }

.result-box .result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.result-box .result-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.result-content {
  background: var(--bg-card);
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

/* ===== Spinner ===== */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 20px auto;
  display: none;
}

.spinner.show { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Copy Button ===== */
.copy-btn {
  background: var(--bg-toolbar);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition-fast);
  font-family: var(--font);
  color: var(--text-secondary);
}

.copy-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108,92,231,0.05);
}

/* ===== Status Dot ===== */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); }
.status-dot.pending { background: var(--warning); }

/* ===== Stats ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
}

.stat-card .value {
  font-size: 28px !important;
  font-weight: 900 !important;
  color: var(--primary) !important;
  background: none !important;
  -webkit-text-fill-color: unset !important;
}

.stat-card .label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-copy {
  font-size: 14px;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover { color: var(--primary); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-primary);
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all var(--transition-base);
  pointer-events: none;
  box-shadow: var(--shadow-xl);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Download Button ===== */
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font);
  font-size: 15px;
  margin-top: 12px;
}

.download-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .sidebar { display: none; }
  .sidebar.open { display: block; position: fixed; top: 64px; left: 0; z-index: 999; width: 280px; box-shadow: var(--shadow-xl); }
  .main-content { padding: 20px 24px; }
  .search-bar { max-width: 200px; }
}

@media (max-width: 768px) {
  .navbar { padding: 0 16px; gap: 8px; }
  .navbar-nav { display: none; }
  .search-bar { max-width: 100%; }
  .mobile-menu-btn { display: flex !important; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-box { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header h1 { font-size: 22px; }
  .breadcrumbs { font-size: 12px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
}
