/* ===== AKIOCODES V4 GLOBAL ADDITIONS ===== */
/* Dark Theme Toggle, SVG Badges, Level System, Mobile Optimization, Google Translate Hidden */

/* ===== DARK THEME SUPPORT ===== */
/* The default is already dark. We add a light theme option */
[data-theme="light"],
.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #cbd5e1;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  --shadow-epic: 0 25px 50px -12px rgba(0, 0, 0, 0.15), 0 0 40px rgba(99, 102, 241, 0.05);
}

/* Theme toggle button */
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-secondary);
  font-size: 18px;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: scale(1.05);
}

.theme-toggle .fa-sun { display: none; }
.theme-toggle .fa-moon { display: inline; }
[data-theme="light"] .theme-toggle .fa-sun,
.light-theme .theme-toggle .fa-sun { display: inline; }
[data-theme="light"] .theme-toggle .fa-moon,
.light-theme .theme-toggle .fa-moon { display: none; }

/* ===== SVG BADGE ICON SYSTEM ===== */
.badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  padding: 4px;
  transition: all 0.2s ease;
  cursor: default;
  position: relative;
  flex-shrink: 0;
}

.badge-icon:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 5;
}

.badge-icon svg {
  width: 14px;
  height: 14px;
}

.badge-icon::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 100;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.badge-icon:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.user-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

/* Small badges for compact views */
.badge-icon-sm,
.repo-card.compact .badge-icon {
  width: 20px;
  height: 20px;
  padding: 3px;
  border-radius: 4px;
}

.badge-icon-sm svg,
.repo-card.compact .badge-icon svg {
  width: 12px;
  height: 12px;
}

/* ===== LEVEL SYSTEM STYLES ===== */
.level-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.level-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12px;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}

.level-badge:hover .level-icon {
  transform: scale(1.1);
}

.level-badge-sm .level-icon {
  width: 22px;
  height: 22px;
  font-size: 10px;
  border-radius: 6px;
}

.level-badge-lg .level-icon {
  width: 36px;
  height: 36px;
  font-size: 16px;
  border-radius: 10px;
}

/* Level Card (for profile page) */
.level-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.level-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.level-number {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 12px;
  color: white;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.level-star {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

.level-xp-info {
  text-align: right;
}

.level-xp-current {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.level-xp-next {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
}

.level-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.level-progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 1s ease;
  position: relative;
}

.level-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.level-progress-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ===== COMPACT MODE IMPROVEMENTS ===== */
.repo-grid.compact .repo-card.compact {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  align-items: center;
}

.repo-grid.compact .repo-card.compact:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.repo-card.compact .repo-info {
  min-width: 0;
  flex: 1;
}

.repo-card.compact .repo-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repo-card.compact .repo-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0 0 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.repo-card.compact .repo-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}

.repo-card.compact .repo-stats-compact {
  display: flex;
  gap: 12px;
  align-items: center;
}

.repo-card.compact .repo-stats-compact .stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.repo-card.compact .repo-actions-compact {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.repo-card.compact .repo-actions-compact .btn {
  padding: 6px 10px;
  font-size: 13px;
  min-width: auto;
  border-radius: 8px;
}

/* ===== RESPONSIVE DESCRIPTION FIX ===== */
.repo-description {
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

/* Fix for long descriptions in all views */
.repo-card .repo-description,
.repo-content .repo-description {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.repo-card.compact .repo-description {
  -webkit-line-clamp: 1;
}

/* ===== GOOGLE TRANSLATE INVISIBLE STYLES ===== */
iframe.goog-te-banner-frame, 
.goog-te-banner-frame, 
.goog-te-balloon-frame,
#goog-gt-tt, 
.goog-tooltip, 
.goog-tooltip:hover,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf-ti6hGc,
.VIpgJd-ZVi9od-ORHb-UswCRb {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
}

html, body {
    top: 0 !important;
    position: static !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

#google_translate_element {
    display: none !important;
}

.goog-text-highlight {
    background-color: transparent !important;
    box-shadow: none !important;
}

.skiptranslate {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
}

body > .skiptranslate {
    display: none !important;
    height: 0 !important;
}

/* ===== ENHANCED MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
  /* General mobile improvements */
  body {
    font-size: 14px;
  }
  
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Badge icons smaller on mobile */
  .badge-icon {
    width: 22px;
    height: 22px;
    padding: 3px;
    border-radius: 5px;
  }

  .badge-icon svg {
    width: 13px;
    height: 13px;
  }

  /* Level card compact on mobile */
  .level-card {
    padding: 14px;
  }

  .level-number {
    padding: 6px 12px;
    font-size: 15px;
  }

  .level-xp-current {
    font-size: 14px;
  }

  /* Compact mode mobile */
  .repo-grid.compact .repo-card.compact {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .repo-card.compact .repo-actions-compact {
    justify-content: flex-end;
    width: 100%;
  }

  .repo-card.compact .repo-description {
    -webkit-line-clamp: 2;
  }

  /* Nav improvements */
  .nav-controls {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  /* Stats grid mobile */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .quick-stats-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Sort/view buttons scrollable on mobile */
  .sort-buttons, .view-buttons {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    justify-content: flex-start;
  }

  .sort-buttons::-webkit-scrollbar,
  .view-buttons::-webkit-scrollbar {
    display: none;
  }

  /* Profile mobile */
  .profile-info {
    flex-direction: column !important;
    text-align: center;
    gap: 16px !important;
  }

  .profile-avatar {
    width: 90px !important;
    height: 90px !important;
  }

  .profile-details h1 {
    font-size: 1.5rem !important;
  }

  .profile-badges {
    justify-content: center;
  }

  .follow-stats {
    justify-content: center;
  }

  /* Search mobile */
  .search-container {
    max-width: 100%;
  }

  .hero-section .search-container {
    padding: 0 8px;
  }

  /* Repo cards mobile */
  .repo-grid {
    gap: 12px;
  }

  .repo-card {
    border-radius: 12px;
  }

  .repo-card .repo-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Stories mobile */
  .story-item {
    min-width: 68px;
  }

  .story-avatar {
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 480px) {
  .badge-icon {
    width: 20px;
    height: 20px;
    padding: 2.5px;
    border-radius: 4px;
  }

  .badge-icon svg {
    width: 12px;
    height: 12px;
  }

  .level-card-header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .level-xp-info {
    text-align: left;
  }

  .repo-card.compact .repo-meta {
    gap: 8px;
    font-size: 12px;
  }

  .repo-card.compact .repo-stats-compact {
    gap: 8px;
  }
}

/* ===== THEME TOGGLE SCRIPT HELPER ===== */
/* Smooth transition when switching themes */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}
