/* main.css */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap');

html {
  scroll-padding-top: 80px;
  /* adjust based on your navbar height */
  scroll-behavior: smooth;
}

/* Smooth transitions */
button,
a,
.content-box,
.quiz-box,
.badge-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ensure body content is pushed down below the fixed navbar */
body {
  padding-top: 66px;
  font-family: 'Lato', sans-serif;
  background-color: var(--scandi-1);
}

/* Site-wide headings */
h1 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-top: 1.2rem;
  margin-bottom: 1.2rem;
  color: var(--scandi-7);
}

h3 {
  font-size: 1.2375rem;
  color: var(--scandi-7);
}

a {
  color: purple;
  font-weight: bold;
}

/* Keep the links on the overview page basic. */
.overview-page a {
  color: var(--scandi-7) !important;
  font-weight: normal !important;
}

code {
  color: var(--scandi-6);
}

.accordion-item {
  background-color: var(--scandi-2);
}

.accordion-button {
  background-color: var(--scandi-2);
}

/* Navbar: stick to top */
.top-nav {
  background-color: var(--scandi-7);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 66px;
  z-index: 1050;
  /* higher than sidebar and content */
}

.top-nav .navbar-brand {
  margin-left: 2rem;
}

.top-nav .nav-link {
  margin-right: 2rem;
}

/* Hide navigation items on small screens */
@media (max-width: 768px) {
  .nav-hide-mobile {
    display: none !important;
  }
}

/* Show only on mobile devices */
.nav-show-mobile {
  display: none !important;
}

@media (max-width: 768px) {

  /* Hide some topbar elements on mobile */
  .navbar-brand {
    display: none !important;
  }

  /* Show sidebar icons in topbar horizontally */
  #sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 50px !important;
    right: 0 !important;
    bottom: auto !important;
    width: auto !important;
    height: 66px !important;
    background-color: transparent !important;
    display: flex !important;
    flex-direction: row !important;
    z-index: 1050 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    padding: 0 !important;
    margin: 0 !important;
    align-items: center !important;
    justify-content: space-evenly !important;
    width: 100% !important;
    gap: 0 !important;
  }

  .sidebar-item {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
  }

  .sidebar-link {
    padding: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-left: none !important;
  }

  /* Hide text labels, show only icons */
  .sidebar-link span {
    display: none !important;
  }

  .sidebar-link i {
    font-size: 1.5rem !important;
    margin-right: 0 !important;
  }

  /* Hide profile link (already have toggle button) and auth dropdown */
  .sidebar-item:has(#auth-dropdown),
  .sidebar-item:has(a[href*="profile"]) {
    display: none !important;
  }

  /* Optimize container for mobile - use full width with consistent padding */
  .main.container {
    max-width: 100% !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Ensure main has consistent padding on mobile */
  .main {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Set consistent padding for all containers on mobile */
  .container,
  .container-fluid {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Reduce heading margins on mobile */
  h1 {
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    font-size: 2rem !important;
  }

  h2 {
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
  }

  h3 {
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
  }

  /* Optimize vocabulary table for mobile */
  #vocabTable {
    border: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }

  #vocabTable tbody {
    display: block !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Hide table headers on mobile */
  #vocabTable thead {
    display: none !important;
  }

  /* Make each table row a card on mobile */
  #vocabTable tbody tr {
    display: block !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 1rem !important;
    border: 1px solid var(--scandi-6) !important;
    border-radius: 0.5rem !important;
    padding: 0.75rem !important;
    background-color: var(--scandi-1) !important;
  }

  /* Make table cells display as rows with labels */
  #vocabTable tbody td {
    display: block !important;
    text-align: left !important;
    padding: 0.25rem 0 !important;
    border: none !important;
  }

  /* Add labels before each cell using data attributes */
  #vocabTable tbody td:nth-child(1)::before {
    content: "Uke: ";
    font-weight: bold;
    color: var(--scandi-7);
  }

  #vocabTable tbody td:nth-child(2)::before {
    content: "Ord: ";
    font-weight: bold;
    color: var(--scandi-7);
  }

  #vocabTable tbody td:nth-child(3)::before {
    content: "Ordklasse: ";
    font-weight: bold;
    color: var(--scandi-7);
  }

  #vocabTable tbody td:nth-child(4)::before {
    content: "Engelsk: ";
    font-weight: bold;
    color: var(--scandi-7);
  }

  #vocabTable tbody td:nth-child(5)::before {
    content: "Cognate: ";
    font-weight: bold;
    color: var(--scandi-7);
  }

  #vocabTable tbody td:nth-child(6)::before {
    content: "Lyd: ";
    font-weight: bold;
    color: var(--scandi-7);
  }

  /* Make the Norwegian word (2nd column) stand out more on mobile */
  #vocabTable tbody td:nth-child(2) {
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    color: var(--scandi-7) !important;
    margin-bottom: 0.5rem !important;
  }

  /* Remove extra margins since container now provides padding */
}

/* Reset and defaults */
*,
::after,
::before {
  box-sizing: border-box;
}

a {
  cursor: pointer;
  text-decoration: none;
}

li {
  list-style: none;
}

.example {
  margin-left: 2em;
  /* indent about one tab */
}

.example code {
  margin: 0 0.3em;
}

.example li {
  list-style: disc;
}

/* Logo sizing */
.logo {
  width: clamp(64px, 12vw, 96px);
}

/* Layout */
.wrapper {
  display: flex;
}

.main {
  min-height: 1;
  width: 100%;
  overflow: hidden;
  transition: all 0.35s ease-in-out;
  background-color: var(--scandi-1);
  margin-left: 3rem;
  padding: 1rem 2rem;
  transition: margin-left 0.35s ease-in-out;
}

/* Cognate table */
.cognate-table {
  border-collapse: collapse;
  margin: 25px 0 25px 40px;
  font-size: 0.9em;
  min-width: 400px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  border: 2px solid #0e2238;
}

.cognate-table th {
  padding: 12px 15px;
  border-bottom: 2px solid #0e2238;
}

.cognate-table td {
  padding: 12px 15px;
}

.cognate-table tbody tr {
  border-bottom: 1px solid var(--scandi-1);
}

.cognate-table tbody tr:nth-of-type(even) {
  background-color: var(--scandi-2);
}

/* Dialect Maps */
.dialect-map-container {
  position: relative;
  display: inline-block;
}

.dialect-map-container img {
  display: block;
  width: 500px;
  max-width: 100%;
  height: auto;
}

.dialect-label {
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  padding: 5px 10px;
  border: 1px solid #333;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.dialect-label:hover {
  background: rgba(255, 255, 200, 0.9);
}

/* Progress Ring */
.progress-ring {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 80px;
  height: 80px;
  z-index: 1000;
}

.progress-ring__svg {
  transform: rotate(-90deg);
}

.progress-ring__circle {
  transition: stroke-dashoffset 0.35s;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
}

.progress-ring__circle--progress {
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
}

.progress-ring__text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1em;
  font-weight: bold;
  color: #333;
}

/* Tooltips */
.gloss {
  position: relative;
  cursor: pointer;
  border-bottom: 1px dotted #333;
}

.gloss::after {
  content: attr(data-gloss);
  visibility: hidden;
  opacity: 0;
  width: auto;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 5px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  transition: opacity 0.3s;
  white-space: nowrap;
}

.gloss:hover::after {
  visibility: visible;
  opacity: 1;
}

/* Image borders for status */
.img-thumbnail.border-success {
  box-shadow: 0 0 10px rgba(40, 167, 69, 0.6);
}

.img-thumbnail.border-danger {
  box-shadow: 0 0 10px rgba(220, 53, 69, 0.6);
}

input[type="checkbox"],
input[type="radio"] {
  all: revert !important;
}

/* Quiz matching boxes */
.match-btn {
  cursor: pointer;
  margin: 0.25rem;
  padding: 0.5rem 1rem;
  font-weight: bold;
  transition: all 0.2s ease-in-out;
  min-width: 200px;
}

#profile-toggle-wrapper {
  display: flex;
  align-items: center;
  height: 66px;
  padding-left: 0.8rem;
  /* Add left padding */
  width: 100%;
}

/* Styling for Badges */
.badge-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  border-radius: 10px;
  background: #f8f9fa;
  transition: transform 0.2s ease;
}

.badge-item:hover {
  transform: translateY(-2px);
}

.badge-svg {
  width: 80px;
  height: 80px;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.badge-name {
  font-weight: bold;
  font-size: 12px;
  text-align: center;
  color: #333;
  margin-bottom: 5px;
}

.badge-description {
  font-size: 10px;
  color: #666;
  text-align: center;
  line-height: 1.2;
}

.category-title {
  color: #2c3e50;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
  margin-bottom: 25px;
  font-size: 24px;
}

.earned {
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  }

  to {
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
  }
}

.progress-bar {
  background: #e9ecef;
  border-radius: 10px;
  height: 20px;
  margin: 20px 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 12px;
}


.shadowing-container {
  position: relative;
  width: fit-content;
  margin-bottom: 2rem;
}

.shadowing-text-line {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  position: relative;
  margin-top: 2rem;
}

.shadowing-word {
  font-size: 1.5rem;
  position: relative;
}

.shadowing-ball {
  width: 20px;
  height: 20px;
  background-color: #047f33;
  border-radius: 50%;
  position: absolute;
  bottom: 100%;
  left: 0;
  top: 0;
  transform: translateY(0);
  transition: top 0.2s ease, left 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 1;
  /* make sure it’s above text */
}

.shadowing-word {
  transition: color 0.3s ease;
  color: #555;
  /* default muted color */
}

.dim1 {
  color: #047f33;
}

/* current word - green */
.dim2 {
  color: #2ea36b;
}

/* trailing 1 */
.dim3 {
  color: #7bc9a2;
}

/* trailing 2 */
.dim4 {
  color: #b6ded0;
}

/* trailing 3 */
.dim5 {
  color: #ddd;
}

/* trailing 4 */

.class-weeks {
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.class-weeks.collapsed {
  max-height: 0;
  /* Height is set in js */
}

.class-heading {
  margin-top: 1rem;
  /* space above each heading */
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  border-top: 1px solid #ddd;
  /* optional: visual separation */
}

/* General table style */
.styled-table {
  border-collapse: collapse;
  margin: 25px 0;
  font-size: 0.95em;
  min-width: 500px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  border: 2px solid var(--scandi-7);
  background-color: var(--scandi-1);
  color: var(--scandi-7);
}

/* Header */
.styled-table th {
  background-color: var(--scandi-7);
  color: var(--scandi-1);
  text-align: left;
  padding: 12px 15px;
  font-weight: 700;
}

/* Table cells */
.styled-table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--scandi-2);
}

/* Row striping */
.styled-table tbody tr:nth-of-type(even) {
  background-color: var(--scandi-2);
}

.styled-table tbody tr:nth-of-type(odd) {
  background-color: var(--scandi-1);
}

/* Hover effect */
.styled-table tbody tr:hover {
  background-color: var(--scandi-3);
  cursor: pointer;
  transform: scale(1.01);
}

/* Dividing border under <tr> */
.styled-table tr .thick-border-bottom {
  border-bottom: 2px solid var(--scandi-7) !important;
}

.gray-borders tbody th,
.gray-borders tbody td {
  border: 1px solid #d3d3d3;
}

/* Crossed out text */
.crossed-out {
  text-decoration: line-through;
}

input {
  background-color: var(--scandi-2);
}

.circle-progress-combined {
  width: 1.3em;
  /* 50% larger than font size */
  height: 1.3em;
  display: inline-block;
  vertical-align: text-bottom;
  cursor: help;
  transition: filter .2s ease;
}

.circle-progress-combined circle {
  fill: none;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke .2s ease, stroke-width .2s ease;
}

/* Background tracks */
.completion-bg {
  stroke: #eee;
  stroke-width: 1.5;
}

.score-bg {
  stroke: #eee;
  stroke-width: 1.5;
}

/* Progress lines */
.completion {
  stroke: var(--scandi-6);
  stroke-width: 2.5;
}

/* outer */
.score {
  stroke: #4caf50;
  stroke-width: 3.5;
}

/* inner thicker */

/* Hover glow */
.circle-progress-combined:hover {
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, .25));
}

.circle-progress-combined:hover .completion {
  stroke-width: 2;
}

.circle-progress-combined:hover .score {
  stroke-width: 3;
}

/* Audio play button */
.audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.2em 0.4em;
}

/* Insert the icon before the button content */
.audio-btn::before {
  content: "🔊";
  /* Change this once, applies everywhere */
  display: inline-block;
}

/* Profile pictures in tables */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  /* makes it round */
  object-fit: cover;
  /* crops instead of squishing */
  border: 1px solid #ddd;
  /* optional: subtle border */
}

figcaption {
  text-align: center;
}

/* Insta grid */
.insta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

/* remove Instagram's inline border/margin */
.instagram-media {
  margin: 0 !important;
  border: none !important;
  box-shadow: none !important;
  width: 50% !important;
}