/* ===== ROOT VARIABLES ===== */
:root {
  --bg-dark: #0a0b10;
  --glass-bg: rgba(18, 20, 30, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-purple: #7b2ff7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-body: #e2e8f0;
  --font-ar: 'Tajawal', sans-serif;
  --font-en: 'Outfit', sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ===== GLOBAL RESETS ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-ar);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  font-size: 16px;
}

/* ===== LANGUAGE DROPDOWNS & VISIBILITY ===== */
body.lang-ar {
  font-family: var(--font-ar);
}

body.lang-en {
  font-family: var(--font-en);
}

body.lang-ar .en-text {
  display: none !important;
}

body.lang-en .ar-text {
  display: none !important;
}

/* In LTR (English), flip the back arrow direction */
body.lang-en .rtl-icon {
  transform: rotate(180deg);
}

/* Top bar for lang toggle */
.top-bar {
  position: absolute;
  top: 30px;
  left: 40px;
  z-index: 100;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: var(--transition-smooth);

  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-cyan);
}

/* ===== BACKGROUND BLOBS (ANIMATED) ===== */
.background-blobs {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  filter: blur(120px);
  opacity: 0.5;
}

.blob {
  position: absolute;
  border-radius: 50%;
  animation: float 25s infinite ease-in-out alternate;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-purple);
  top: -100px;
  left: -100px;
}

.blob-2 {
  width: 600px;
  height: 600px;
  background: var(--accent-blue);
  bottom: -200px;
  right: -100px;
  animation-delay: -5s;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: var(--accent-cyan);
  top: 30%;
  left: 40%;
  animation-delay: -10s;
  opacity: 0.4;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(120px, 80px) scale(1.1);
  }
}

/* ===== MAIN GLASS CONTAINER ===== */
.glass-container {
  width: 95%;
  max-width: 1300px;
  height: 85vh;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ===== VIEWS MANAGER ===== */
.view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 50px;
  display: flex;
  flex-direction: column;
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
}

.view.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

.view.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.03);
}

/* ===== LANDING VIEW ===== */
.main-header {
  text-align: center;
  margin-bottom: 60px;
}

.top-logotype {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  direction: ltr;
}

.logo-text {
  font-family: var(--font-en);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 5px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

.logo-svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 5px rgba(0, 210, 255, 0.4));
}

.title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 15px;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.3rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* CARDS */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 35px;
  flex-grow: 1;
  min-height: 0;
  /* Added for correct flex scrolling */
  padding: 0 20px;
}

.project-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 35px;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-card:hover {
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.highlight-card {
  border-color: rgba(0, 210, 255, 0.2);
}

.card-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(100% 100% at 50% 0%, rgba(79, 172, 254, 0.1), transparent);
  opacity: 0;
  transition: var(--transition-smooth);
}

.project-card:hover .card-glow {
  opacity: 1;
}

.card-icon {
  margin-bottom: 25px;
  color: var(--accent-cyan);
  width: 50px;
  height: 50px;
}

.card-titles h3 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: #fff;
}

.card-content p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 25px;
  align-self: flex-start;
}

.primary-badge {
  background: rgba(0, 210, 255, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 210, 255, 0.2);
}

/* Card Specific Theme Classes */
.card-glow-board {
  background: radial-gradient(100% 100% at 50% 0%, rgba(123, 47, 247, 0.1), transparent);
}

.card-icon-board {
  color: var(--accent-purple);
}

.badge-board {
  background: rgba(123, 47, 247, 0.1);
  color: var(--accent-purple);
  border: 1px solid rgba(123, 47, 247, 0.2);
}

.card-glow-spaces {
  background: radial-gradient(100% 100% at 50% 0%, rgba(255, 255, 255, 0.05), transparent);
}

.card-icon-spaces {
  color: var(--text-muted);
}

.badge-spaces {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}


/* ===== PRESENTATION VIEW ===== */
.presentation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

body.lang-en .icon-btn:hover {
  transform: translateX(-5px);
  /* reverse hover for LTR */
}

#pres-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  margin-bottom: 50px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 3px;
}

.presentation-body {
  flex-grow: 1;
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 40px;
  min-height: 0;
  /* Added for correct flex scrolling */
}

.slide-content {
  display: flex;
  gap: 60px;
  align-items: center;
  width: 100%;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.slide-content.fade-out {
  opacity: 0;
  transform: translateY(-15px);
}

.slide-content.fade-in {
  opacity: 0;
  transform: translateY(15px);
}

/* SVG Illustration Side */
.illustration-container {
  flex: 0 0 35%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.illus-glow {
  position: absolute;
  width: 250px;
  height: 250px;
  background: var(--accent-cyan);
  opacity: 0.15;
  filter: blur(80px);
  border-radius: 50%;
  z-index: 1;
}

.slide-svg {
  width: 200px;
  height: 200px;
  color: var(--accent-blue);
  z-index: 2;
  stroke-width: 1.2;
}

.text-container {
  flex: 1;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0 15px;
}

/* Custom scrollbar for text-container */
.text-container::-webkit-scrollbar {
  width: 6px;
}

.text-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.text-container::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 3px;
}

.slide-title {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 30px;
  color: var(--accent-cyan);
  line-height: 1.3;
}

.slide-body {
  font-size: 1.35rem;
  /* Larger font */
  line-height: 2;
  /* Increased readability */
  color: var(--text-body);
  font-weight: 400;
}

.slide-body p {
  margin-bottom: 20px;
}

/* Main Bullet Points */
.slide-body ul {
  list-style: none;
  padding: 0;
  margin: 0 0 25px 0;
}

.slide-body li {
  position: relative;
  padding-left: 30px;
  margin-bottom: 18px;
}

.slide-body li::before {
  content: "■";
  color: var(--accent-cyan);
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 1rem;
}

/* RTL Layout for Main Bullet Points */
body.lang-ar .slide-body li {
  padding-right: 30px;
  padding-left: 0;
}

body.lang-ar .slide-body li::before {
  right: 0;
  left: auto;
}

/* Interactive Sub-levels (Details/Summary) */
.slide-body details {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  margin-bottom: 15px;
  padding: 15px 20px;
  transition: var(--transition-smooth);
}

.slide-body details[open] {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.slide-body summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  list-style: none;
  /* Hide default arrow */
  position: relative;
  padding-right: 30px;
  /* Arabic layout */
  outline: none;
  transition: color 0.3s ease;
}

body.lang-en .slide-body summary {
  padding-right: 0;
  padding-left: 30px;
}

.slide-body summary::-webkit-details-marker {
  display: none;
}

.slide-body summary::before {
  content: '+';
  position: absolute;
  right: 0;
  top: 0;
  color: var(--accent-cyan);
  font-size: 1.5rem;
  line-height: 1;
  transition: transform 0.3s ease;
}

body.lang-en .slide-body summary::before {
  right: auto;
  left: 0;
}

.slide-body details:hover summary {
  color: var(--accent-cyan);
}

.slide-body details[open] summary::before {
  content: '−';
  /* Minus sign */
  transform: rotate(180deg);
  color: var(--accent-purple);
}

.slide-body .sub-level {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1.8;
  animation: slideDown 0.3s ease-out forwards;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-body strong {
  color: #fff;
  font-weight: 700;
}

/* Controls */
.presentation-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn {
  padding: 14px 40px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.solid-btn {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  color: white;
  border: none;
  box-shadow: 0 4px 20px rgba(79, 172, 254, 0.4);
}

.solid-btn:hover {
  box-shadow: 0 8px 30px rgba(79, 172, 254, 0.6);
  transform: translateY(-2px);
}

.solid-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.outline-btn {
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.outline-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.5);
}

.outline-btn:disabled {
  border-color: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
}

.dots-indicator {
  display: flex;
  gap: 12px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: var(--transition-smooth);
}

.dot.active {
  background: var(--accent-cyan);
  transform: scale(1.4);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.6);
}

/* ===== MEDIA QUERIES (RESPONSIVE) ===== */
@media (max-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .glass-container {
    height: 90vh;
  }

  .title {
    font-size: 2.5rem;
  }

  .slide-content {
    flex-direction: column;
    gap: 20px;
  }

  .illustration-container {
    flex: 0 0 auto;
    width: 100%;
  }

  .text-container {
    max-height: none;
    overflow-y: visible;
  }

  .presentation-body {
    overflow-y: auto;
    align-items: flex-start;
    padding: 0 20px;
  }
}

@media (max-width: 768px) {
  .top-bar {
    top: 15px;
    left: 15px;
  }

  .logo-text {
    font-size: 0.9rem;
    letter-spacing: 2px;
  }

  .lang-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .glass-container {
    height: 93dvh;
    width: 95%;
    border-radius: 20px;
  }

  .view {
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }

  .main-header {
    margin-bottom: 20px;
  }

  .title {
    font-size: 1.8rem;
    margin-bottom: 10px;
  }

  .subtitle {
    font-size: 1rem;
    line-height: 1.5;
  }

  .cards-grid {
    gap: 15px;
    overflow-y: auto;
    padding: 5px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }

  .cards-grid::-webkit-scrollbar {
    width: 4px;
  }

  .cards-grid::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
  }

  .project-card {
    padding: 20px 15px;
  }

  .card-header-mobile {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
  }

  .card-icon {
    width: 35px;
    height: 35px;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .card-titles h3 {
    font-size: 1.15rem;
    margin-bottom: 0px;
  }

  .card-content p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 5px;
  }

  .badge {
    margin-top: 15px;
    padding: 6px 12px;
    font-size: 0.8rem;
    margin-bottom: 5px;
  }

  /* Presentation Mode fixes */
  .presentation-header {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    margin-bottom: 15px;
  }

  #pres-title {
    font-size: 1.15rem;
    text-align: left;
    margin-top: 2px;
    flex: 1;
    line-height: 1.3;
  }

  body.lang-ar #pres-title {
    text-align: right;
  }

  .icon-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
    flex-shrink: 0;
  }

  .progress-bar-container {
    margin-bottom: 15px;
  }

  .presentation-body {
    padding: 0 5px;
    align-items: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
  }

  .presentation-body::-webkit-scrollbar {
    width: 4px;
  }

  .slide-content {
    flex-direction: column;
    gap: 15px;
  }

  .illustration-container {
    margin-top: 5px;
    margin-bottom: 5px;
  }

  .slide-svg {
    width: 80px;
    height: 80px;
  }

  .illus-glow {
    width: 100px;
    height: 100px;
  }

  .slide-title {
    font-size: 1.4rem;
    text-align: center;
    margin-bottom: 15px;
  }

  .slide-body {
    font-size: 1rem;
    line-height: 1.6;
  }

  .slide-body summary {
    font-size: 1.05rem;
  }

  .slide-body ul {
    margin: 0 0 15px 0;
  }

  .slide-body li {
    margin-bottom: 10px;
  }

  .slide-body .sub-level {
    font-size: 0.95rem;
  }

  .presentation-controls {
    padding-top: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .btn {
    padding: 10px 15px;
    font-size: 0.95rem;
    flex: 1;
    text-align: center;
    min-width: 100px;
  }

  .dots-indicator {
    order: -1;
    width: 100%;
    justify-content: center;
    margin-bottom: 5px;
    gap: 8px;
    display: flex;
  }

  .dot {
    width: 8px;
    height: 8px;
  }
}

@media (max-width: 480px) {
  .glass-container {
    height: 96dvh;
    width: 96%;
    border-radius: 16px;
  }

  .title {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .project-card {
    padding: 15px;
  }

  .card-titles h3 {
    font-size: 1.05rem;
  }

  .slide-title {
    font-size: 1.2rem;
  }

  .slide-body {
    font-size: 0.95rem;
  }

  .presentation-header {
    margin-bottom: 10px;
  }

  #pres-title {
    font-size: 1rem;
  }

  .icon-btn span.ar-text,
  .icon-btn span.en-text {
    display: none !important;
  }
}