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

/* =========================================================
   THEME TOKENS — Dark (default) + Light
   Higher contrast text, more comfortable surfaces.
   ========================================================= */
:root {
  /* Surfaces */
  --bg-primary: #0b0c14;
  --bg-secondary: #14162a;
  --bg-card: rgba(255,255,255,0.05);
  --bg-card-hover: rgba(255,255,255,0.09);
  --glass: rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.12);

  /* Text — AA-compliant on dark */
  --text-primary: #f5f6fb;
  --text-secondary: #c2c7d6;   /* was #9ca3af — now ~10:1 */
  --text-muted: #8a90a3;       /* was #6b7280 — now ~5:1 */

  /* Brand */
  --accent: #8b5cf6;
  --accent-light: #b794ff;
  --accent-glow: rgba(139,92,246,0.28);
  --cyan: #22d3ee;
  --cyan-glow: rgba(34,211,238,0.28);
  --green: #22c55e;
  --amber: #fbbf24;
  --red: #f87171;
  --pink: #f472b6;

  /* Match-card glass */
  --card-glass-bg: rgba(20, 22, 42, 0.45);
  --card-glass-border: rgba(255,255,255,0.10);
  --card-glass-blur: 18px;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 999px;
  --shadow: 0 8px 32px rgba(0,0,0,0.45);
  --shadow-soft: 0 4px 18px rgba(0,0,0,0.18);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: dark;
}

/* ---------- LIGHT THEME ---------- */
:root[data-theme="light"] {
  --bg-primary: #f6f7fb;
  --bg-secondary: #ffffff;
  --bg-card: rgba(15, 17, 38, 0.04);
  --bg-card-hover: rgba(15, 17, 38, 0.08);
  --glass: rgba(15, 17, 38, 0.04);
  --glass-border: rgba(15, 17, 38, 0.10);

  --text-primary: #11142a;
  --text-secondary: #4a4f63;     /* ~9:1 on white */
  --text-muted: #6b7186;          /* ~5:1 on white */

  --accent: #6d28d9;
  --accent-light: #7c3aed;
  --accent-glow: rgba(109,40,217,0.22);
  --cyan: #0891b2;
  --cyan-glow: rgba(8,145,178,0.22);
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --pink: #be185d;

  --card-glass-bg: rgba(255,255,255,0.55);
  --card-glass-border: rgba(15,17,38,0.10);
  --card-glass-blur: 14px;

  --shadow: 0 10px 30px rgba(15,17,38,0.10);
  --shadow-soft: 0 4px 14px rgba(15,17,38,0.06);

  color-scheme: light;
}

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

body {
  font-family: 'Inter', 'Cairo', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: var(--accent-light); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

.page { display: none; min-height: calc(100vh - 70px); padding: 24px; max-width: 1200px; margin: 0 auto; }
.page.active { display: block; animation: fadeUp 0.4s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--cyan-glow); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ====== NAV ====== */
.navbar {
  display: none;
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in oklab, var(--bg-primary) 80%, transparent);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 24px; height: 64px;
  align-items: center; justify-content: space-between;
}
.navbar.visible { display: flex; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem; color: var(--accent-light); }
.nav-brand span { background: linear-gradient(135deg, var(--accent), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-link {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.7rem; font-weight: 500;
  background: none; border: none; transition: var(--transition); position: relative;
}
.nav-link i { font-size: 1.15rem; }
.nav-link:hover, .nav-link.active { color: var(--accent-light); background: var(--bg-card); }
.nav-link .badge {
  position: absolute; top: 4px; right: 8px;
  background: var(--red); color: #fff; font-size: 0.6rem;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.nav-profile {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius-full);
  background: var(--bg-card); border: 1px solid var(--glass-border); transition: var(--transition);
}
.nav-profile:hover { background: var(--bg-card-hover); }

/* ====== AVATAR ====== */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: #fff; flex-shrink: 0;
}
.avatar.sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 2rem; border: 3px solid var(--accent); }

/* ====== LANDING ====== */
#landing { max-width: 100%; padding: 0; flex-direction: column; align-items: center; }
#landing.active { display: flex; }
.hero {
  width: 100%; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 40px 24px; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, var(--accent-glow) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, var(--cyan-glow) 0%, transparent 50%);
  pointer-events: none;
}
.hero-orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.15; pointer-events: none;
}
.hero-orb:nth-child(1) { width: 400px; height: 400px; background: var(--accent); top: -100px; left: -100px; animation: float 8s ease-in-out infinite; }
.hero-orb:nth-child(2) { width: 300px; height: 300px; background: var(--cyan); bottom: -50px; right: -50px; animation: float 6s ease-in-out infinite 1s; }
.hero-orb:nth-child(3) { width: 200px; height: 200px; background: var(--pink); top: 30%; right: 10%; animation: float 10s ease-in-out infinite 2s; }

.hero-content { position: relative; z-index: 1; max-width: 700px; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 800; margin-bottom: 20px; line-height: 1.15; }
.hero h1 .gradient {
  background: linear-gradient(135deg, var(--accent-light), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { font-size: 1.15rem; color: var(--text-secondary); margin-bottom: 36px; max-width: 520px; margin-inline: auto; }
.hero-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px; padding: 80px 24px; max-width: 1100px; width: 100%;
}
.feature-card {
  background: var(--bg-card); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 32px; text-align: center;
  transition: var(--transition);
}
.feature-card:hover { transform: translateY(-6px); background: var(--bg-card-hover); border-color: var(--accent); }
.feature-card .icon { font-size: 2.2rem; margin-bottom: 16px; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { font-size: 0.85rem; color: var(--text-secondary); }

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 0.9rem; border: none;
  transition: var(--transition); white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #9333ea);
  color: #fff; box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 30px var(--accent-glow); }
.btn-secondary {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.btn-sm { padding: 8px 18px; font-size: 0.8rem; }
.btn-ghost { background: none; color: var(--text-secondary); border: none; padding: 8px 12px; }
.btn-ghost:hover { color: var(--accent-light); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ====== AUTH ====== */
.auth-container {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.auth-card {
  background: var(--bg-secondary); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 40px; width: 100%; max-width: 440px;
  box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 1.6rem; margin-bottom: 8px; }
.auth-card .subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 0.9rem; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.form-input {
  width: 100%; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--glass-border);
  color: var(--text-primary); font-size: 0.9rem; transition: var(--transition); outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input { appearance: none; cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 80px; }

.auth-toggle { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--text-secondary); }
.auth-toggle a { color: var(--accent-light); cursor: pointer; font-weight: 600; }

/* ====== CARDS ====== */
.card {
  background: var(--bg-card); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 24px; transition: var(--transition);
}
.card:hover { background: var(--bg-card-hover); border-color: rgba(124,58,237,0.3); }

.user-card { display: flex; flex-direction: column; gap: 14px; }
.user-card-header { display: flex; align-items: center; gap: 14px; }
.user-card-info h3 { font-size: 1rem; font-weight: 600; }
.user-card-info p { font-size: 0.8rem; color: var(--text-secondary); }
.user-card-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-muted); }
.user-card-meta span { display: flex; align-items: center; gap: 4px; }
.user-card-skills { display: flex; gap: 6px; flex-wrap: wrap; }
.user-card-actions { display: flex; gap: 8px; margin-top: 4px; }

.project-card { display: flex; flex-direction: column; gap: 12px; }
.project-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.project-card h3 { font-size: 1.05rem; font-weight: 700; }
.project-card .desc { font-size: 0.85rem; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.project-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }

/* ====== TAGS / BADGES ====== */
.tag {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: var(--radius-full); font-size: 0.72rem; font-weight: 600;
  background: rgba(124,58,237,0.15); color: var(--accent-light); border: 1px solid rgba(124,58,237,0.2);
}
.tag.cyan { background: rgba(6,182,212,0.15); color: var(--cyan); border-color: rgba(6,182,212,0.2); }
.tag.green { background: rgba(16,185,129,0.15); color: var(--green); border-color: rgba(16,185,129,0.2); }
.tag.amber { background: rgba(245,158,11,0.15); color: var(--amber); border-color: rgba(245,158,11,0.2); }
.tag.pink { background: rgba(236,72,153,0.15); color: var(--pink); border-color: rgba(236,72,153,0.2); }
.category-badge { padding: 5px 14px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

/* ====== GRID LAYOUTS ====== */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ====== PAGE HEADERS ====== */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 6px; }
.page-header p { color: var(--text-secondary); font-size: 0.9rem; }

.section { margin-bottom: 36px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-header h2 { font-size: 1.2rem; font-weight: 700; }

/* ====== SEARCH & FILTERS ====== */
.search-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--glass-border);
  border-radius: var(--radius-full); padding: 10px 20px; margin-bottom: 24px; transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-bar i { color: var(--text-muted); }
.search-bar input { flex: 1; background: none; border: none; color: var(--text-primary); font-size: 0.9rem; outline: none; }
.filter-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-tab {
  padding: 8px 18px; border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--glass-border); color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
}
.filter-tab:hover, .filter-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.filters-row { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filters-row select { padding: 8px 14px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--glass-border); color: var(--text-primary); font-size: 0.8rem; outline: none; }

/* ====== PROFILE ====== */
.profile-hero {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(6,182,212,0.1));
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 40px; display: flex; gap: 28px; align-items: center; margin-bottom: 28px; position: relative;
}
.profile-info h1 { font-size: 1.6rem; font-weight: 800; }
.profile-info .title { color: var(--accent-light); font-size: 1rem; margin-bottom: 8px; }
.profile-info .bio { color: var(--text-secondary); font-size: 0.9rem; max-width: 500px; }
.profile-stats { display: flex; gap: 24px; margin-top: 16px; }
.stat { text-align: center; }
.stat .num { font-size: 1.4rem; font-weight: 800; color: var(--accent-light); }
.stat .label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.profile-edit-btn { position: absolute; top: 20px; right: 20px; }

/* ====== REQUESTS ====== */
.request-card {
  display: flex; align-items: center; gap: 16px; padding: 20px;
  background: var(--bg-card); border: 1px solid var(--glass-border);
  border-radius: var(--radius); margin-bottom: 12px; transition: var(--transition);
}
.request-card:hover { background: var(--bg-card-hover); }
.request-info { flex: 1; }
.request-info h4 { font-size: 0.95rem; font-weight: 600; }
.request-info p { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }
.request-info .type-badge { font-size: 0.7rem; }
.request-actions { display: flex; gap: 8px; }

/* ====== CHAT ====== */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 112px); gap: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--glass-border); }
.chat-sidebar { background: var(--bg-secondary); border-right: 1px solid var(--glass-border); overflow-y: auto; }
.chat-sidebar-header { padding: 20px; border-bottom: 1px solid var(--glass-border); font-weight: 700; font-size: 1.1rem; }
.chat-contact {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  cursor: pointer; transition: var(--transition); border-bottom: 1px solid rgba(255,255,255,0.03);
}
.chat-contact:hover, .chat-contact.active { background: var(--bg-card-hover); }
.chat-contact-info h4 { font-size: 0.85rem; font-weight: 600; }
.chat-contact-info p { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.chat-main { display: flex; flex-direction: column; background: var(--bg-primary); }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--glass-border); background: var(--bg-secondary); }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.9rem; }
.message { max-width: 70%; padding: 12px 18px; border-radius: 18px; font-size: 0.88rem; line-height: 1.5; }
.message.sent { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.message.received { background: var(--bg-card); border: 1px solid var(--glass-border); align-self: flex-start; border-bottom-left-radius: 6px; }
.message .time { font-size: 0.65rem; opacity: 0.6; margin-top: 4px; }
.chat-input-area { display: flex; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--glass-border); background: var(--bg-secondary); }
.chat-input-area input { flex: 1; padding: 12px 18px; border-radius: var(--radius-full); background: var(--bg-card); border: 1px solid var(--glass-border); color: var(--text-primary); outline: none; font-size: 0.9rem; }
.chat-input-area input:focus { border-color: var(--accent); }
.chat-input-area button { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; border: none; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; transition: var(--transition); }
.chat-input-area button:hover { transform: scale(1.05); }

/* ====== MODAL ====== */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); z-index: 200; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 32px; width: 100%; max-width: 500px;
  box-shadow: var(--shadow); animation: fadeUp 0.3s ease;
}
.modal h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ====== SKILLS INPUT ====== */
.skills-input-wrap { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); min-height: 44px; }
.skills-input-wrap input { flex: 1; min-width: 120px; background: none; border: none; color: var(--text-primary); outline: none; font-size: 0.85rem; padding: 4px; }
.skill-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-full); background: rgba(124,58,237,0.2); color: var(--accent-light); font-size: 0.75rem; font-weight: 600; }
.skill-tag .remove { cursor: pointer; opacity: 0.6; font-size: 0.85rem; }
.skill-tag .remove:hover { opacity: 1; }

/* ====== EMPTY STATE ====== */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }

/* ====== TOAST ====== */
.toast-container { position: fixed; top: 80px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 14px 22px; border-radius: var(--radius-sm); color: #fff; font-size: 0.85rem; font-weight: 500;
  animation: fadeUp 0.3s ease; box-shadow: var(--shadow); min-width: 260px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--accent); }

/* ====== TABS ====== */
.tabs { display: flex; border-bottom: 1px solid var(--glass-border); margin-bottom: 24px; }
.tab-btn { padding: 12px 24px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; transition: var(--transition); }
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--accent-light); border-bottom-color: var(--accent); }

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .nav-links { gap: 2px; }
  .nav-link span { display: none; }
  .nav-link { padding: 8px 10px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .profile-hero { flex-direction: column; text-align: center; }
  .profile-stats { justify-content: center; }
  .hero h1 { font-size: 2rem; }
  .features-grid { grid-template-columns: 1fr; }
  .filters-row { flex-direction: column; }
}
