/* =====================================================================
   pages.css — Styles for multi-page navigation cards and AI diagnostic page
   ===================================================================== */

/* ============ NAVIGATION CARDS (Home page) ============ */
.nav-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.nav-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: right;
  background: rgba(0, 20, 45, 0.6);
  border: 1px solid rgba(0, 170, 255, 0.15);
  border-radius: 16px;
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text, #cde7ff);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.nav-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 170, 255, 0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

.nav-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent, #00d4ff), transparent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s;
}

.nav-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: 0 12px 40px rgba(0, 170, 255, 0.15), 0 0 0 1px rgba(0, 212, 255, 0.2);
  background: rgba(0, 30, 60, 0.7);
}

.nav-card:hover::before { opacity: 1; }
.nav-card:hover::after { transform: scaleX(1); }

.nav-card-icon {
  font-size: 2.6rem;
  margin-bottom: 14px;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(0, 170, 255, 0.3));
}

.nav-card h3 {
  font-family: 'Cairo', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
}

.nav-card-fr {
  font-family: 'Tajawal', sans-serif;
  font-size: 0.85rem;
  color: var(--accent, #00d4ff);
  opacity: 0.8;
  margin: 0 0 12px;
  direction: ltr;
  text-align: right;
}

.nav-card p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: rgba(205, 231, 255, 0.7);
  margin: 0 0 18px;
  flex-grow: 1;
}

.nav-card-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent, #00d4ff);
  transition: gap 0.3s;
}

.nav-card:hover .nav-card-go { gap: 12px; }

/* AI card special highlight */
.nav-card-ai {
  border-color: rgba(0, 212, 255, 0.35);
  background: linear-gradient(135deg, rgba(0, 30, 70, 0.6), rgba(0, 15, 40, 0.6));
}

.nav-card-ai .nav-card-icon {
  filter: drop-shadow(0 0 16px rgba(0, 212, 255, 0.5));
}

/* ============ AI DIAGNOSTIC PAGE ============ */
.ai-page-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.ai-hero-box {
  background: linear-gradient(135deg, rgba(0, 25, 55, 0.7), rgba(0, 10, 30, 0.7));
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.ai-hero-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(0, 170, 255, 0.08) 0%, transparent 50%);
  animation: ai-pulse 6s ease-in-out infinite;
}

@keyframes ai-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; }
}

.ai-hero-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  position: relative;
  filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.5));
}

.ai-hero-box h2 {
  font-family: 'Cairo', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 10px;
  position: relative;
}

.ai-hero-box p {
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(205, 231, 255, 0.75);
  margin: 0 auto;
  max-width: 620px;
  position: relative;
}

.ai-input-box {
  background: rgba(0, 20, 45, 0.5);
  border: 1px solid rgba(0, 170, 255, 0.2);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.ai-input-label {
  display: block;
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent, #00d4ff);
  margin-bottom: 10px;
}

.ai-input-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.ai-code-input {
  flex: 1;
  min-width: 220px;
  padding: 14px 18px;
  background: rgba(0, 5, 16, 0.7);
  border: 1.5px solid rgba(0, 170, 255, 0.3);
  border-radius: 10px;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  transition: all 0.3s;
  direction: ltr;
}

.ai-code-input::placeholder {
  color: rgba(205, 231, 255, 0.3);
  letter-spacing: 1px;
  font-weight: 400;
}

.ai-code-input:focus {
  outline: none;
  border-color: var(--accent, #00d4ff);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15), 0 0 20px rgba(0, 170, 255, 0.2);
  background: rgba(0, 10, 25, 0.8);
}

.ai-ask-btn {
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--primary, #00aaff), var(--accent, #00d4ff));
  border: none;
  border-radius: 10px;
  color: #001020;
  font-family: 'Cairo', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.ai-ask-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 170, 255, 0.4);
}

.ai-ask-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ai-example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.ai-example-chips span {
  font-size: 0.78rem;
  color: rgba(205, 231, 255, 0.5);
  align-self: center;
}

.ai-chip {
  padding: 5px 12px;
  background: rgba(0, 170, 255, 0.1);
  border: 1px solid rgba(0, 170, 255, 0.25);
  border-radius: 20px;
  color: var(--accent, #00d4ff);
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

.ai-chip:hover {
  background: rgba(0, 170, 255, 0.2);
  border-color: var(--accent, #00d4ff);
  transform: translateY(-1px);
}

.ai-response-box {
  background: rgba(0, 20, 45, 0.5);
  border: 1px solid rgba(0, 170, 255, 0.2);
  border-radius: 16px;
  padding: 0;
  min-height: 100px;
  overflow: hidden;
  display: none;
}

.ai-response-box.visible { display: block; }

.ai-response-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  background: rgba(0, 170, 255, 0.08);
  border-bottom: 1px solid rgba(0, 170, 255, 0.15);
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent, #00d4ff);
}

.ai-response-body {
  padding: 22px;
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  line-height: 1.85;
  color: rgba(205, 231, 255, 0.9);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.ai-response-body h3,
.ai-response-body h4 {
  color: #fff;
  font-family: 'Cairo', sans-serif;
  margin: 16px 0 8px;
}

.ai-response-body strong { color: var(--accent, #00d4ff); }
.ai-response-body code {
  background: rgba(0, 170, 255, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--accent, #00d4ff);
}
.ai-response-body ul, .ai-response-body ol {
  padding-right: 24px;
  margin: 10px 0;
}
.ai-response-body li { margin-bottom: 6px; }

.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 22px;
  color: rgba(205, 231, 255, 0.7);
  font-family: 'Cairo', sans-serif;
}

.ai-dots {
  display: inline-flex;
  gap: 4px;
}

.ai-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #00d4ff);
  animation: ai-bounce 1.2s infinite ease-in-out;
}

.ai-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.ai-error {
  padding: 18px 22px;
  color: #ff7a7a;
  font-family: 'Cairo', sans-serif;
  background: rgba(255, 50, 50, 0.08);
  border-right: 3px solid rgba(255, 80, 80, 0.5);
}

.ai-info-note {
  margin-top: 28px;
  padding: 18px 22px;
  background: rgba(0, 170, 255, 0.05);
  border: 1px solid rgba(0, 170, 255, 0.15);
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: rgba(205, 231, 255, 0.6);
}

.ai-info-note strong { color: var(--accent, #00d4ff); }

.ai-history {
  margin-top: 24px;
}

.ai-history-title {
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(205, 231, 255, 0.5);
  margin-bottom: 10px;
}

.ai-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(0, 20, 45, 0.4);
  border: 1px solid rgba(0, 170, 255, 0.1);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.25s;
}

.ai-history-item:hover {
  background: rgba(0, 30, 60, 0.5);
  border-color: rgba(0, 170, 255, 0.3);
}

.ai-history-code {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: var(--accent, #00d4ff);
  direction: ltr;
}

.ai-history-time {
  font-size: 0.75rem;
  color: rgba(205, 231, 255, 0.4);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
  .nav-cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .nav-card { padding: 22px 18px; }
  .nav-card-icon { font-size: 2.2rem; }
  .ai-hero-box { padding: 28px 18px; }
  .ai-hero-box h2 { font-size: 1.4rem; }
  .ai-input-row { flex-direction: column; }
  .ai-ask-btn { width: 100%; }
}
