/* ============================
   Reset and base styles
============================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  background-color: #ffffff;
  color: #333333;
}

/* ============================
   Top Mobile Header - MOBILE ONLY
============================ */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: flex-start;
  background-color: #0050ef;
  color: white;
  padding: 0.75rem 1rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 80, 239, 0.2);
  height: 60px;
}

.mobile-header .app-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-left: 1rem;
  flex: 1;
}

.menu-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

/* ============================
   Sidebar Navigation
============================ */
.sidebar-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background-color: #0050ef;
  color: white;
  transform: translateX(0);
  transition: transform 0.3s ease;
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 70px;
}

.sidebar-header h2 {
  font-size: 1.8rem;
  font-weight: 600;
  color: white;
}

/* Close button - hidden on desktop, visible on mobile */
.close-sidebar {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide close button on desktop */
@media (min-width: 1025px) {
  .close-sidebar {
    display: none;
  }
}

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
}

.sidebar-nav .nav-link {
  display: block;
  padding: 0.5rem 1.0rem;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  margin: 0.1rem 0;
  transition: background 0.2s;
  border-left: 4px solid transparent;
}

.sidebar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-nav .nav-link.active {
  background-color: white;
  color: #0050ef;
  font-weight: 600;
  border-left-color: #0050ef;
}

/* Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  z-index: 998;
}

/* ============================
   Main Content
============================ */
.content {
  margin-left: 280px;
  padding: 2rem;
  min-height: calc(100vh - 60px);
  transition: margin-left 0.3s ease;
}

/* ============================
   Fixed Bottom Navigation - MOBILE ONLY
============================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e0e0e0;
  justify-content: space-around;
  z-index: 1000;
  padding: 0.5rem 0;
  height: 60px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #666;
  padding: 0.5rem 0.2rem;
  flex: 1;
  min-width: 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  margin-bottom: 4px;
  stroke: currentColor;
  flex-shrink: 0;
}

.bottom-nav-item span {
  font-size: 0.75rem;
  font-weight: 500;
}

.bottom-nav-item.active {
  color: #0050ef;
  font-weight: 600;
}

/* ============================
   Footer
============================ */
.site-footer {
  background: #f5f5f5;
  padding: 1rem;
  text-align: center;
  color: #333;
  font-size: 0.9rem;
  border-top: 1px solid #e0e0e0;
  position: relative;
  margin-left: 280px;
  transition: margin-left 0.3s ease;
}

/* ============================
   Responsive - MOBILE
============================ */
@media (max-width: 1024px) {
  /* Show mobile header and bottom nav on mobile */
  .mobile-header {
    display: flex;
  }
  
  .bottom-nav {
    display: flex;
  }
  
  /* On mobile, sidebar should overlay on top of everything */
  .sidebar-menu {
    transform: translateX(-100%);
    z-index: 1002; /* Higher than mobile header (1000) */
    height: 100vh; /* Full height */
    top: 0; /* Start from top */
  }
  
  .sidebar-menu.mobile-open {
    transform: translateX(0);
  }
  
  /* Show close button on mobile */
  .close-sidebar {
    display: flex !important;
  }
  
  /* Adjust content for mobile */
  .content {
    margin-left: 0;
    padding: 4rem 1rem 5rem; /* Adjusted for bottom nav */
  }
  
  /* Adjust footer for mobile */
  .site-footer {
    margin-left: 0;
    padding-bottom: 4rem; /* Space for bottom nav */
  }
  
  /* Overlay should be below sidebar but above everything else */
  .sidebar-overlay.active {
    display: block;
    z-index: 1001; /* Below sidebar (1002) but above header (1000) */
  }
  
  /* Ensure mobile header stays visible but below sidebar overlay */
  .mobile-header {
    z-index: 1000;
  }
}

/* Animation for sidebar */
@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.sidebar-menu.mobile-open {
  animation: slideIn 0.3s ease;
}

/* Smooth transitions */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Remove focus outlines for better mobile experience */
button:focus, a:focus {
  outline: none;
}

/* Active state for bottom nav */
.bottom-nav-item.active .nav-icon {
  stroke: #0050ef;
}

.bottom-nav-item:hover {
  color: #0050ef;
}

/* Hover effect for desktop sidebar */
@media (min-width: 1025px) {
  .sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
  }
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .mobile-header {
    padding: 0.75rem;
    height: 56px;
  }
  
  .mobile-header .app-title {
    font-size: 1.3rem;
    margin-left: 0.75rem;
  }
  
  .menu-toggle {
    font-size: 1.3rem;
    width: 36px;
    height: 36px;
  }
  
  .bottom-nav {
    height: 56px;
  }
  
  .bottom-nav-item span {
    font-size: 0.7rem;
  }
  
  .nav-icon {
    width: 18px;
    height: 18px;
  }
  
  .content {
    padding: 3.5rem 1rem 5rem;
  }
}


/* Skeleton Loading */
.skeleton-loading {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  width: 100%;
}

.skeleton-card {
  background: white;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e9ecef;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.skeleton-word {
  width: 120px;
  height: 24px;
  background: #e9ecef;
  border-radius: 4px;
}

.skeleton-icon {
  width: 24px;
  height: 24px;
  background: #e9ecef;
  border-radius: 50%;
}

.skeleton-english {
  width: 180px;
  height: 18px;
  background: #e9ecef;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.skeleton-tags {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.skeleton-tag {
  width: 60px;
  height: 20px;
  background: #e9ecef;
  border-radius: 12px;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}