/* ═══════════════════════════════════════════════
   ReferralNet - Modern Professional Stylesheet
   ═══════════════════════════════════════════════ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #0f172a;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Navbar ─── */
.navbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.logo-icon {
  font-size: 1.2em;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  text-decoration: none;
  color: var(--gray-600);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-700);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

/* ─── Cards ─── */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 24px;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.card-body {
  color: var(--gray-600);
  font-size: 0.9rem;
}

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

/* ─── Tags / Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-gray {
  background: var(--gray-100);
  color: var(--gray-600);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--gray-800);
  background: white;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

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

.form-hint {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ─── Hero Section ─── */
.hero {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 80px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(37,99,235,0.3) 0%, transparent 60%),
              radial-gradient(circle at 70% 80%, rgba(245,158,11,0.15) 0%, transparent 50%);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── Stats ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 1280px;
  margin: -40px auto 40px;
  padding: 0 24px;
  position: relative;
  z-index: 2;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-lg);
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--gray-500);
  font-weight: 500;
  margin-top: 4px;
}

/* ─── Page Sections ─── */
.page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px;
}

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

.page-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gray-900);
}

.page-subtitle {
  color: var(--gray-500);
  margin-top: 4px;
  font-size: 0.95rem;
}

/* ─── Search & Filters ─── */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 250px;
  padding: 12px 18px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

.filter-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-300);
  background: white;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.filter-chip:hover, .filter-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* ─── Grid Layouts ─── */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.requests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ─── Job Card ─── */
.job-card {
  cursor: pointer;
}

.job-card .job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.job-card .job-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.job-card .job-description {
  margin-top: 12px;
  color: var(--gray-600);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Member Card ─── */
.member-card {
  text-align: center;
  padding: 32px 24px;
}

.member-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 16px;
}

.member-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
}

.member-title {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.member-company {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 2px;
}

.member-skills {
  margin-top: 12px;
}

/* ─── Request Card ─── */
.request-card .request-role {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.request-card .request-company {
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9rem;
}

.request-card .request-message {
  margin-top: 10px;
  color: var(--gray-600);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 24px;
  z-index: 200;
  overflow-y: auto;
}

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

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-400);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--gray-900);
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Dashboard ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.dashboard-card {
  padding: 28px;
}

.dashboard-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Guidelines Section ─── */
.guidelines-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guideline-item {
  padding: 20px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--primary);
}

.guideline-item h3 {
  font-size: 1rem;
  color: var(--gray-800);
  margin-bottom: 6px;
}

.guideline-item p {
  font-size: 0.9rem;
  color: var(--gray-600);
}

/* ─── Detail View ─── */
.detail-container {
  max-width: 800px;
  margin: 0 auto;
}

.detail-header {
  margin-bottom: 24px;
}

.detail-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gray-900);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  color: var(--gray-500);
  font-size: 0.9rem;
}

.detail-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-section {
  margin-top: 24px;
}

.detail-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-100);
}

.detail-section p, .detail-section div {
  color: var(--gray-600);
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-400);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.2rem;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ─── Profile Page ─── */
.profile-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 32px;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-info h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
}

.profile-info .profile-title {
  color: var(--gray-500);
  font-size: 1rem;
}

.profile-info .profile-company {
  color: var(--primary);
  font-weight: 600;
}

/* ─── Tabs ─── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.tab:hover {
  color: var(--gray-700);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ─── User Menu ─── */
.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.user-menu-btn:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.user-menu-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.user-menu-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--gray-700);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  display: none;
  overflow: hidden;
  z-index: 50;
}

.user-dropdown.active {
  display: block;
}

.user-dropdown a, .user-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--gray-700);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.user-dropdown a:hover, .user-dropdown button:hover {
  background: var(--gray-50);
  color: var(--primary);
}

.dropdown-divider {
  border-top: 1px solid var(--gray-100);
  margin: 4px 0;
}

/* ─── Loading ─── */
.loading {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Footer ─── */
.footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 48px 24px 24px;
  margin-top: 60px;
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 40px;
}

.footer-section h3 {
  color: white;
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.footer-section h4 {
  color: var(--gray-200);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.footer-section p {
  font-size: 0.88rem;
  line-height: 1.7;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  padding: 4px 0;
  font-size: 0.88rem;
}

.footer-section ul a {
  color: var(--gray-400);
  text-decoration: none;
  transition: var(--transition);
}

.footer-section ul a:hover {
  color: var(--primary-light);
}

.footer-bottom {
  max-width: 1280px;
  margin: 32px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--gray-700);
  text-align: center;
  font-size: 0.85rem;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    margin-top: -20px;
  }

  .jobs-grid, .requests-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .detail-title {
    font-size: 1.4rem;
  }

  .user-menu-name {
    display: none;
  }

  .modal {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .members-grid {
    grid-template-columns: 1fr;
  }
}
