@import url('./fonts/yekan-bakh/yekan-bakh.css');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.25);
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #0ea5e9;
  --info-light: #f0f9ff;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #818cf8;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 8px 30px rgba(79, 70, 229, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'YekanBakh', system-ui, -apple-system, sans-serif !important;
  background-color: var(--bg-page);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Visibility Control */
.view-hidden {
  display: none !important;
}

/* ==========================================================================
   Login Page Styling
   ========================================================================== */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #1e1b4b 0%, #0f172a 70%, #090d16 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-view::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 40px rgba(99, 102, 241, 0.2);
  padding: 38px 32px;
  position: relative;
  z-index: 10;
  animation: cardAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardAppear {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo-box {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
  margin: 0 auto 16px auto;
}

.login-title {
  font-weight: 800;
  font-size: 20px;
  color: #0f172a;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 24px;
}

.form-floating-custom {
  position: relative;
  margin-bottom: 18px;
}

.form-floating-custom label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.form-control-custom {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  border-radius: var(--radius-md);
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  font-size: 14px;
  color: #0f172a;
  transition: all 0.2s ease;
}

.form-control-custom:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  outline: none;
}

.input-icon-start {
  position: absolute;
  left: 14px;
  top: 36px;
  color: #94a3b8;
  font-size: 18px;
  pointer-events: none;
}

.btn-login-submit {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 18px -4px rgba(79, 70, 229, 0.4);
  transition: all 0.2s ease;
}

.btn-login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -4px rgba(79, 70, 229, 0.5);
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
}

/* ==========================================================================
   Main App Top Navigation & Header
   ========================================================================== */
.app-navbar {
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

.navbar-brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}

.navbar-brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.navbar-brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin: 0;
  line-height: 1.2;
}

.navbar-brand-sub {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.07);
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #4f46e5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
}

.user-name-txt {
  font-weight: 700;
  font-size: 13px;
  color: #f1f5f9;
}

.btn-nav-logout {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-nav-logout:hover {
  background: #ef4444;
  color: #fff;
}

/* ==========================================================================
   Navigation Bar Tabs
   ========================================================================== */
.subnav-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.subnav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-tabs-pill {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 10px 0;
}

.nav-pill-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-pill-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.nav-pill-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-add-lead-nav {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
  transition: all 0.2s ease;
}

.btn-add-lead-nav:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

/* ==========================================================================
   Dashboard Metrics
   ========================================================================== */
.content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

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

.metric-value {
  font-size: 26px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
}

.metric-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

/* Colors */
.metric-blue .metric-icon-wrap { background: #eff6ff; color: #2563eb; }
.metric-amber .metric-icon-wrap { background: #fffbeb; color: #d97706; }
.metric-emerald .metric-icon-wrap { background: #ecfdf5; color: #059669; }
.metric-purple .metric-icon-wrap { background: #faf5ff; color: #9333ea; }

/* ==========================================================================
   Table & Cards Styling
   ========================================================================== */
.crm-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.crm-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}

.crm-card-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.crm-table th {
  background: #f8fafc;
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.crm-table td {
  padding: 16px 20px;
  font-size: 13.5px;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.crm-table tbody tr {
  transition: background-color 0.15s ease;
}

.crm-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-status.status-new { background: #e0e7ff; color: #3730a3; }
.badge-status.status-contacted { background: #fef3c7; color: #92400e; }
.badge-status.status-followup { background: #ffedd5; color: #9a3412; }
.badge-status.status-demo { background: #e0f2fe; color: #0369a1; }
.badge-status.status-won { background: #d1fae5; color: #065f46; }
.badge-status.status-lost { background: #fee2e2; color: #991b1b; }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Domain Favicon / Avatar */
.domain-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  margin-left: 10px;
  border: 1px solid #e2e8f0;
}

/* Action Buttons */
.btn-action-view {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-action-view:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ==========================================================================
   Duplication Warning Alert Box
   ========================================================================== */
.alert-duplicate-warning {
  background: #fef2f2;
  border: 1.5px solid #f87171;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  color: #991b1b;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
  animation: pulseAlert 2s infinite ease-in-out;
}

@keyframes pulseAlert {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   Timeline Feed in Modal
   ========================================================================== */
.timeline-feed {
  position: relative;
  padding-right: 28px;
  margin-top: 16px;
}

.timeline-feed::before {
  content: '';
  position: absolute;
  right: 8px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: #e2e8f0;
}

.timeline-card {
  position: relative;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.timeline-marker {
  position: absolute;
  right: -26px;
  top: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--primary-glow);
}
