* {
  max-width: 100%;
  box-sizing: border-box;
}

:root {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --accent-color: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.5);
}

[data-theme="light"] {
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-color: #0f172a;
  --text-muted: #64748b;
  --accent-color: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Cairo", sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  direction: inherit;
  text-align: start;
  transition:
    background 0.3s,
    color 0.3s;
}

/* النافبار العلوي */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 5%;
  background: var(--card-bg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--accent-color);
}

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

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--accent-color);
}

.nav-tools {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tool-btn {
  background: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--accent-color);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s;
}

.tool-btn:hover {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow);
}

/* --- تنسيقات زر وقائمة اللغات المنسدلة --- */
.lang-dropdown {
  position: relative;
  display: inline-block;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--bg-color);
  border: 1px solid var(--accent-color);
  color: var(--text-color);
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.lang-btn:hover {
  box-shadow: 0 0 15px var(--accent-glow);
  transform: translateY(-2px);
}

.lang-menu {
  display: none;
  position: absolute;
  top: 125%;
  right: 0;
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 8px;
  min-width: 160px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.lang-menu.show {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.2s ease-in-out;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text-color);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
  text-align: right;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-4px);
}

/* ألوان تأثير التمرير (Hover) على خيارات اللغات */
.ar-opt:hover {
  color: #10b981;
} /* مصر - أخضر */
.en-opt:hover {
  color: #38bdf8;
} /* بريطانيا - أزرق سماوي */
.fr-opt:hover {
  color: #3b82f6;
} /* فرنسا - أزرق */
.es-opt:hover {
  color: #ef4444;
} /* إسبانيا - أحمر */
.it-opt:hover {
  color: #22c55e;
} /* إيطاليا - أخضر إيطالي */
.de-opt:hover {
  color: #eab308;
} /* ألمانيا - ذهبي */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* قسم الـ Hero وصورة المهندس الرقمي */
.hero-section {
  padding: 60px 5%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.profile-img-container {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px solid var(--accent-color);
  overflow: hidden;
  box-shadow: 0 0 25px var(--accent-glow);
  margin-bottom: 10px;
}

.profile-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-badge {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-color);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 900;
}

.hero-title span {
  color: var(--accent-color);
}

.hero-desc {
  max-width: 600px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.social-links-bar {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 10px;
}

.social-links-bar .tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.hero-cta {
  padding: 12px 25px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.3s;
}

.hero-cta.primary {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.hero-cta.secondary {
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--text-muted);
}

/* المشاريع والخدمات */
.projects-section,
.services-section,
.contact-section {
  padding: 60px 5%;
}

.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 900;
}

.section-header h2 span {
  color: var(--accent-color);
}

.project-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.tab-btn {
  background: var(--card-bg);
  color: var(--text-color);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s;
}

.tab-btn.active,
.tab-btn:hover {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow);
}

.project-content {
  display: none;
  background: var(--card-bg);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.project-content.active {
  display: block;
}

/* الشات وباقي العناصر */
.chat-container {
  margin-top: 20px;
  background: var(--bg-color);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.chat-header {
  background: var(--card-bg);
  padding: 12px 20px;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-messages {
  height: 250px;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  padding: 10px 15px;
  border-radius: 8px;
  max-width: 80%;
  font-size: 0.95rem;
}

.chat-msg.user {
  background: var(--accent-color);
  color: #fff;
  align-self: flex-end;
}

.chat-msg.ai {
  background: var(--card-bg);
  color: var(--text-color);
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-input-area {
  display: flex;
  padding: 12px;
  background: var(--card-bg);
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-input-area input {
  flex: 1;
  background: var(--bg-color);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  border-radius: 8px;
  color: var(--text-color);
  outline: none;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

.service-card {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: 0.3s;
}

.service-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-color);
  box-shadow: 0 10px 25px var(--accent-glow);
}

.contact-form {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 15px;
  border-radius: 8px;
  color: var(--text-color);
  outline: none;
}

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

footer {
  text-align: center;
  padding: 30px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 40px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-box {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-box input {
  background: var(--bg-color);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 8px;
  color: var(--text-color);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent-color);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 15px var(--accent-glow);
  transform: translateY(100px);
  opacity: 0;
  transition: 0.3s;
  z-index: 3000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}
