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

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

:root {
  --primary:      #1a6b5a;
  --primary-light:#22997f;
  --primary-glow: rgba(26,107,90,0.25);
  --accent:       #2dd4bf;
  --accent2:      #34d399;
  --gold:         #f59e0b;
  --dark:         #0d1f1b;
  --dark2:        #132923;
  --dark3:        #1c3b32;
  --card-bg:      #1e3530;
  --card-border:  rgba(45,212,191,0.15);
  --text-main:    #e2f0ee;
  --text-muted:   #8cb5ad;
  --text-light:   #c4ddd9;
  --white:        #ffffff;
  --sidebar-w:    310px;
  --radius:       16px;
  --radius-sm:    10px;
  --shadow:       0 8px 32px rgba(0,0,0,0.4);
  --shadow-card:  0 4px 20px rgba(0,0,0,0.3);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--dark);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
}

/* ========================
   SIDEBAR
======================== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, #0b1e1a 0%, #0d2620 40%, #102e26 100%);
  border-left: 1px solid var(--card-border);
  padding: 40px 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: fixed;
  top: 0;
  right: 0;
  overflow-y: auto;
  z-index: 10;
}

/* Avatar */
.avatar-wrap {
  position: relative;
  margin-bottom: 18px;
}

.avatar-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0%, var(--primary) 60%, var(--accent2) 100%);
  padding: 3px;
  animation: spin 6s linear infinite;
}

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

.avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3d35, #0d2620);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: var(--accent);
  animation: spin 6s linear infinite reverse;
  overflow: hidden;
}

.avatar-inner.photo {
  font-size: 0;
}

.avatar-inner.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,100% { opacity: 0; transform: scale(0.9); }
  50%      { opacity: 0.4; transform: scale(1.08); }
}

/* Name */
.name {
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.4;
  color: var(--white);
  margin-bottom: 8px;
}
.name span {
  color: var(--accent);
}

.job-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  background: rgba(45,212,191,0.08);
  border: 1px solid rgba(45,212,191,0.2);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.job-title i { color: var(--accent); margin-left: 5px; }

/* Divider */
.divider {
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--card-border), transparent);
  margin: 18px 0;
}

/* Section Label */
.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  width: 100%;
}
.section-label i { font-size: 0.8rem; }

/* Contact */
.contact-section,
.skills-section,
.lang-section {
  width: 100%;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.contact-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(45,212,191,0.1);
  border: 1px solid rgba(45,212,191,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: background 0.3s;
}
.contact-item:hover .contact-icon {
  background: rgba(45,212,191,0.2);
}

.contact-text {
  display: flex;
  flex-direction: column;
}
.contact-text .label {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.contact-text .value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
}

/* Skills */
.skill-item { margin-bottom: 13px; }

.skill-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 5px;
  font-weight: 600;
}

.skill-bar {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  width: var(--w, 0%);
  background: linear-gradient(90deg, var(--primary-light), var(--accent));
  border-radius: 10px;
  animation: fillBar 1.5s ease forwards;
  transform-origin: right;
}

@keyframes fillBar {
  from { width: 0%; }
  to   { width: var(--w); }
}

/* Languages */
.lang-section { width: 100%; }

.lang-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.lang-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
}

.lang-dots { display: flex; gap: 5px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(45,212,191,0.2);
}
.dot.active {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* ========================
   MAIN CONTENT
======================== */
.main-content {
  margin-right: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px 60px;
  min-height: 100vh;
}

/* Top Banner */
.top-banner {
  background: linear-gradient(135deg, #1a4a3d 0%, #0d2620 60%, #0b2e24 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 36px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.top-banner::before {
  content: '';
  position: absolute;
  top: -40px;
  left: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(45,212,191,0.15), transparent 70%);
  border-radius: 50%;
}

.banner-text h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 10px;
  line-height: 1.3;
}
.banner-text h2 span { color: var(--accent); }

.banner-text p {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 500px;
  line-height: 1.7;
}

.banner-icon {
  font-size: 5rem;
  color: var(--primary-light);
  opacity: 0.25;
  flex-shrink: 0;
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: default;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(45,212,191,0.1);
  border-color: rgba(45,212,191,0.35);
}
.stat-card i {
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}
.stat-num {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--white);
  line-height: 1;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Sections */
.cv-section {
  margin-bottom: 36px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  position: relative;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--card-border), transparent);
}

.section-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 0.95rem;
  box-shadow: 0 4px 15px var(--primary-glow);
  flex-shrink: 0;
}

.section-title h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
}

/* About */
.about-text {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
}
.about-text::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, var(--accent), var(--primary));
}
.about-text p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.9;
}
.about-text strong { color: var(--accent); }

/* Timeline */
.timeline {
  position: relative;
  padding-right: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  right: 7px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.timeline-item {
  display: flex;
  gap: 20px;
  margin-bottom: 22px;
  position: relative;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--dark);
  box-shadow: 0 0 10px var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}
.timeline-dot.edu-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }

.timeline-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 20px 22px;
  flex: 1;
  transition: border-color 0.3s, transform 0.3s;
}
.timeline-card:hover {
  border-color: rgba(45,212,191,0.35);
  transform: translateX(-4px);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.timeline-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
}
.timeline-date {
  font-size: 0.74rem;
  color: var(--accent);
  background: rgba(45,212,191,0.08);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(45,212,191,0.2);
  white-space: nowrap;
}
.timeline-date i { margin-left: 4px; }

.timeline-company {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.timeline-company i { margin-left: 5px; color: var(--accent); }

.timeline-list {
  list-style: none;
  padding: 0;
  margin-bottom: 12px;
}
.timeline-list li {
  font-size: 0.83rem;
  color: var(--text-light);
  padding: 4px 0 4px 0;
  display: flex;
  gap: 8px;
  line-height: 1.6;
}
.timeline-list li::before {
  content: '✦';
  color: var(--accent);
  font-size: 0.65rem;
  margin-top: 3px;
  flex-shrink: 0;
}

/* Tags */
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  font-size: 0.7rem;
  background: rgba(26,107,90,0.25);
  border: 1px solid rgba(26,107,90,0.4);
  color: var(--accent2);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* Certificates */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.cert-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 22px 16px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}
.cert-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transition: transform 0.3s;
}
.cert-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(45,212,191,0.12);
}
.cert-card:hover::after { transform: scaleX(1); }

.cert-icon {
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: 10px;
}
.cert-card h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 5px;
  line-height: 1.4;
}
.cert-card p {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.cert-year {
  font-size: 0.7rem;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--gold);
  padding: 2px 9px;
  border-radius: 20px;
}

/* Personal Grid */
.personal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.personal-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.3s;
}
.personal-item:hover { border-color: rgba(45,212,191,0.3); }

.personal-item > i {
  font-size: 1.2rem;
  color: var(--accent);
  width: 36px;
  height: 36px;
  background: rgba(45,212,191,0.08);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.p-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}
.p-value {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-light);
}

/* Footer */
.cv-footer {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.cv-footer i { color: #e74c3c; margin: 0 4px; }

/* Print Button */
.print-btn {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(26,107,90,0.5);
  transition: transform 0.3s, box-shadow 0.3s;
  z-index: 100;
}
.print-btn:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 10px 28px rgba(26,107,90,0.7);
}

/* ========================
   PRINT STYLES
======================== */
@media print {
  body {
    background: white !important;
    color: #000 !important;
  }
  .sidebar {
    position: relative !important;
    background: #f0f0f0 !important;
    border: none !important;
    color: #000 !important;
  }
  .main-content { margin-right: 0 !important; }
  .print-btn { display: none !important; }

  * {
    color: #000 !important;
    background: transparent !important;
    border-color: #ccc !important;
    box-shadow: none !important;
  }
  .sidebar { background: #f5f5f5 !important; }
}

/* ========================
   RESPONSIVE
======================== */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .personal-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  body { flex-direction: column; }

  .sidebar {
    position: relative;
    width: 100%;
    border-left: none;
    border-bottom: 1px solid var(--card-border);
    padding: 28px 20px;
  }

  .main-content {
    margin-right: 0;
    padding: 24px 16px 48px;
  }

  .top-banner { flex-direction: column; gap: 14px; padding: 24px; }
  .banner-icon { font-size: 3rem; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .personal-grid { grid-template-columns: 1fr 1fr; }
  .certs-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .personal-grid { grid-template-columns: 1fr; }
  .certs-grid { grid-template-columns: 1fr 1fr; }
  .timeline-header { flex-direction: column; }
}
