/* App Mode - Mobile-First Dashboard Design */
/* To disable: Remove the <link> tag from the EJS template */

/* ============================================
   SIDEBAR - Keep visible alongside bottom nav
   ============================================ */
/* Sidebar stays visible - best of both worlds! */

/* ============================================
   SLIM HEADER
   ============================================ */
.navbar .nav-content {
  padding: 0 1rem;
}

/* Hide most nav items, keep only language + theme + settings + logout */
.navbar .nav-right #edit-mode-toggle,
.navbar .nav-right > a:not([href="/settings"]):not([href="/logout"]):not(.theme-dropdown-container) {
  display: none !important;
}

/* Make settings icon-only */
.navbar .nav-right a[href="/settings"] {
  padding: 0.5rem;
  min-width: auto;
}

/* ============================================
   APP LAYOUT
   ============================================ */
/* Removed flex-direction: column to keep sidebar full height */

.main-content {
  padding: 1rem;
  /* Bottom padding is now handled in media query for mobile */
}

/* Hide section headings that are redundant */
.dashboard .section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

/* ============================================
   BOTTOM NAVIGATION BAR - Mobile Only
   ============================================ */
.bottom-nav {
  display: none; /* Hidden by default (desktop) */
}

@media (max-width: 768px) {
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* Hide left sidebar on mobile - use bottom nav instead */
  .left-sidebar {
    display: none !important;
  }

  /* Adjust main content padding for bottom nav */
  .main-content {
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-lg)) !important;
  }
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.6rem;
  font-weight: 500;
  padding: 0.4rem 0.25rem;
  flex: 1;
  max-width: 20%;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.bottom-nav a span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.bottom-nav a:hover {
  background: var(--bg-secondary);
}

.bottom-nav a.active {
  color: var(--primary);
}

.bottom-nav a.active svg {
  transform: scale(1.1);
}

.bottom-nav a svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

/* Very small screens - more compact bottom nav */
@media (max-width: 380px) {
  .bottom-nav a {
    font-size: 0.5rem;
    padding: 0.35rem 0.15rem;
    gap: 0.1rem;
  }

  .bottom-nav a svg {
    width: 1rem;
    height: 1rem;
  }
}

/* ============================================
   FLOATING ACTION BUTTON (FAB)
   ============================================ */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-lg));
  right: var(--space-lg);
  width: clamp(3rem, 8vw, 4rem);
  height: clamp(3rem, 8vw, 4rem);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  font-size: var(--text-2xl);
  cursor: pointer;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

/* Mobile FAB - positioned to not overlap bottom nav labels */
@media (max-width: 768px) {
  .fab {
    bottom: calc(var(--bottom-nav-height, 3.5rem) + 1.5rem);
    right: 1rem;
    width: 3rem;
    height: 3rem;
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .fab {
    bottom: calc(var(--bottom-nav-height, 3.5rem) + 1rem);
    right: 0.75rem;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.1rem;
  }
}

.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.fab:active {
  transform: scale(0.95);
}

/* ============================================
   CARD STYLING - MORE APP-LIKE
   ============================================ */
.deck-card {
  border-radius: 16px;
  margin-bottom: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border);
}

.deck-card:hover {
  transform: none; /* Disable hover effect on mobile */
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.deck-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Deck items inside section - no separate card styling */
.deck-list-inside-section {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 1rem;
}

.deck-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.deck-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.deck-item h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.deck-item .deck-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.deck-item .deck-stats {
  margin-bottom: 0.75rem;
}

.card {
  border-radius: 16px;
}

/* ============================================
   QUICK START CARD - LARGER
   ============================================ */
.dashboard > div:first-child {
  margin-bottom: 1rem;
}

/* ============================================
   STATS - EQUAL SIZING AND HORIZONTAL SCROLL
   ============================================ */
.dashboard [style*="grid-template-columns: repeat(4"] {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.75rem;
}

.dashboard [style*="grid-template-columns: repeat(4"] > div {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ============================================
   DECK STATS ROW
   ============================================ */
.deck-stats {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 1rem;
}

.deck-stats::-webkit-scrollbar {
  display: none;
}

.deck-stats .stat {
  min-width: 70px;
  flex-shrink: 0;
}

/* Stat labels - prevent truncation on mobile */
.deck-stats .stat .stat-label {
  font-size: 0.6rem;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  letter-spacing: -0.2px;
}

/* Very small screens - even smaller font */
@media (max-width: 380px) {
  .deck-stats .stat {
    min-width: 60px;
  }
  .deck-stats .stat .stat-label {
    font-size: 0.55rem;
  }
  .deck-stats .stat .stat-value {
    font-size: 1rem;
  }
}

/* ============================================
   BUTTONS - LARGER TOUCH TARGETS
   ============================================ */
.btn {
  min-height: 44px;
  padding: 0.75rem 1.25rem;
}

.btn-primary {
  font-size: 1rem;
  font-weight: 600;
}

/* ============================================
   MOTIVATIONAL BANNER - COMPACT
   ============================================ */
#motivationalBanner {
  padding: 0.75rem 1rem !important;
  margin-bottom: 1rem !important;
  border-radius: 12px !important;
}

#motivationalBanner span:first-child {
  font-size: 1.25rem !important;
}

/* ============================================
   LEVEL/XP CARDS - COMPACT
   ============================================ */
.dashboard [style*="grid-template-columns: 1fr 1fr"] {
  gap: 0.75rem !important;
}

/* ============================================
   DARK MODE ADJUSTMENTS
   ============================================ */
[data-theme="dark"] .bottom-nav,
[data-theme="ocean-blue"] .bottom-nav,
[data-theme="forest-green"] .bottom-nav,
[data-theme="sunset-orange"] .bottom-nav,
[data-theme="purple"] .bottom-nav {
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .fab,
[data-theme="ocean-blue"] .fab,
[data-theme="forest-green"] .fab,
[data-theme="sunset-orange"] .fab,
[data-theme="purple"] .fab {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fab-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.fab.pulse {
  animation: fab-pulse 2s ease infinite;
}

/* ============================================
   MOBILE RESPONSIVE DASHBOARD
   ============================================ */
@media (max-width: 768px) {
  /* Dashboard stats: 4 cols → 2 cols */
  .dashboard [style*="grid-template-columns: repeat(4"] {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    overflow-x: visible;
  }

  .dashboard [style*="grid-template-columns: repeat(4"] > div {
    min-width: auto;
    flex-shrink: 1;
  }

  /* Level/Goal row: 2 cols → 1 col */
  .dashboard [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Smaller card padding */
  .card {
    padding: 1rem !important;
  }

  /* Hide keyboard hints on mobile */
  .keyboard-hint {
    display: none !important;
  }

  /* Back to Dashboard more prominent */
  .practice-header .btn-minimal {
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    border: 1px solid var(--border);
  }

  /* Practice header compact */
  .practice-header {
    padding: 0.5rem 1rem;
  }

  .practice-header-left a {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  /* Even smaller screens: reduce padding */
  .main-content {
    padding: 0.75rem !important;
    padding-bottom: 80px !important;
  }

  /* Dashboard stat cards smaller */
  .dashboard [style*="grid-template-columns: repeat(4"] > div {
    padding: 0.75rem !important;
  }

  .dashboard [style*="grid-template-columns: repeat(4"] > div > div:first-child {
    font-size: 1.25rem !important;
  }
}

/* ============================================
   RESPONSIVE FOOTER - Minimal single line
   Above bottom nav on mobile
   ============================================ */
@media (max-width: 768px) {
  footer {
    padding: 0.5rem 0.75rem !important;
    padding-bottom: calc(var(--bottom-nav-height, 3.5rem) + 0.75rem) !important;
    font-size: 0.7rem !important;
    margin-bottom: 0 !important;
  }

  footer .container > div {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 0.4rem !important;
  }

  footer a {
    font-size: 0.7rem;
  }

  footer p {
    font-size: 0.7rem;
  }
}

/* ============================================
   PWA STANDALONE MODE - Cleaner interface
   ============================================ */
@media (display-mode: standalone) {
  /* Hide website navigation in standalone */
  .navbar { display: none !important; }

  /* Adjust layout since no navbar */
  .app-layout { min-height: 100vh; }

  /* Safe area padding for notch phones */
  .main-content { padding-top: env(safe-area-inset-top, 0.5rem) !important; }

  /* Hide elements that are redundant in PWA mode */
  .pwa-hide { display: none !important; }
}
