/* ================= Common Shared Styles ================= */
/* Typography & Body */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  line-height: 1.6;
  color: #212529;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  min-height: 100vh;
}

/* Header (shared gradient crimson) */
header {
  background: linear-gradient(135deg, #DC143C 0%, #B91C3C 100%);
  color: #fff;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(220, 20, 60, 0.3);
}

header h1 {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: 1px;
}

/* Hero (base styling, pages can override specifics) */
.hero {
  text-align: center;
  margin: 40px auto;
  padding: 50px 20px;
  border-radius: 15px;
  background: linear-gradient(135deg, #DC143C, #B91C3C);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Navigation */
nav {
  background: #fff;
  padding: 12px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  border-bottom: 3px solid #DC143C;
  flex-wrap: wrap;
}

nav a {
  text-decoration: none;
  color: #DC143C;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 25px;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

nav a:hover {
  background: linear-gradient(135deg, #DC143C, #B91C3C);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(220, 20, 60, 0.3);
}

.polish-flag {
  width: 28px;
  height: 18px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: linear-gradient(to bottom, #fff 0% 50%, #DC143C 50% 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Generic Grid Pattern */
.grid-auto-cards,
.alphabet-grid,
.calendar-grid,
.cases-grid,
.numbers-grid,
.verb-grid,
.pronouns-cases-grid,
.pref-mov-grid,
.prep-cases-grid,
.gender-grid,
.conj-card-grid,
.exercise-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 25px;
  margin: 40px auto;
  max-width: 1200px;
  padding: 0 20px;
}

.pref-mov-grid,
.prep-cases-grid,
.conj-card-grid,
.gender-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.exercise-cards {
  gap: 20px;
  margin-top: 40px;
}

/* Card Base */
.card,
.alphabet-card,
.calendar-card,
.case-card,
.number-card,
.verb-card,
.perf-imperf-card,
.prep-case-card,
.pronouns-case-card,
.pref-mov-card,
.gender-card,
.colors-card,
.conj-type-card {
  background: #fff;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
  text-align: center;
  cursor: pointer;
  border-top: 6px solid transparent;
}

.card:hover,
.alphabet-card:hover,
.calendar-card:hover,
.case-card:hover,
.number-card:hover,
.verb-card:hover,
.pronouns-case-card:hover,
.pref-mov-card:hover,
.gender-card:hover,
.colors-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
}

.card h3,
.alphabet-card h3,
.calendar-card h3,
.case-card h3,
.number-card h3,
.verb-card h3,
.pronouns-case-card h3 {
  margin-bottom: 12px;
  font-size: 1.2rem;
  font-weight: 600;
}

.card p,
.alphabet-card p,
.calendar-card p,
.case-card .usage,
.number-card p,
.verb-card p,
.pronouns-case-card .usage,
.pref-mov-card p,
.gender-card p,
.colors-card p {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.5;
}

.case-card .questions,
.pronouns-case-card .questions {
  font-weight: 600;
  color: #444;
  margin-bottom: 8px;
}

/* Tables (generic) */
.table-base,
.alphabet-table,
.calendar-table,
.case-table,
.numbers-table,
.verb-table,
.pronouns-case-table,
.prep-case-table,
.exercise-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.95rem;
}

.exercise-table th,
.verb-table th,
.alphabet-table th,
.calendar-table th,
.case-table th,
.numbers-table th,
.pronouns-case-table th {
  font-weight: 600;
}

.exercise-table th,
.exercise-table td,
.verb-table td,
.pronouns-case-table td {
  padding: 12px 15px;
}

/* Alternate row generic helpers */
.striped-even tr:nth-child(even) td,
.verb-table tr:nth-child(even) td,
.alphabet-table tr:nth-child(even) td,
.calendar-table tr:nth-child(even) td {
  background: #f7f5fc;
}

/* Modal Base */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity .3s ease;
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: #fff;
  margin: 5% auto;
  padding: 25px;
  border-radius: 15px;
  width: 85%;
  max-width: 700px;
  max-height: 80%;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  transform: scale(.9);
  transition: transform .3s ease;
  position: relative;
  border-top: 6px solid transparent;
}

.modal.show .modal-content {
  transform: scale(1);
}

.modal-content h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
}

.close:hover {
  color: #000;
}

/* Generic Buttons */
.btn,
.card .btn,
#info-btn.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  background: linear-gradient(135deg, #DC143C, #B91C3C);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all .3s ease;
}

.btn:hover {
  background: linear-gradient(135deg, #B91C3C, #DC143C);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(220, 20, 60, 0.3);
}

/* Utility highlight classes (from style.css) */
.stem {
  color: #0066CC;
  font-weight: 600;
  background: rgba(0, 102, 204, 0.1);
  padding: 2px 4px;
  border-radius: 4px;
}

.ending-present {
  color: #28a745;
  font-weight: 600;
  background: rgba(40, 167, 69, 0.12);
  padding: 2px 4px;
  border-radius: 4px;
}

.ending-past {
  color: #FF8C00;
  font-weight: 600;
  background: rgba(255, 140, 0, 0.15);
  padding: 2px 4px;
  border-radius: 4px;
}

.ending-future {
  color: #8B008B;
  font-weight: 600;
  background: rgba(40, 167, 69, 0.12);
  padding: 2px 4px;
  border-radius: 4px;
}

.ending-nominative {
  color: #DC143C;
  font-weight: 600;
  background: rgba(139, 32, 0, 0.15);
  padding: 2px 4px;
  border-radius: 4px;
}

.ending-plural {
  color: #8a2be2;
  font-weight: 600;
  background: rgba(204, 153, 255, 0.12);
  padding: 2px 4px;
  border-radius: 4px;
}

.impf {
  color: #004C4C;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
}

.pf {
  color: #FF1493;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
}

.male {
  color: #1E90FF;
  font-weight: bold;
}

.female {
  color: #FF1493;
  font-weight: bold;
}

.neuter {
  color: #228B22;
  font-weight: bold;
}

.chosen-pronoun {
  color: #daa520;
  font-weight: bold;
}

/* Collapse (shared) */
.collapse {
  width: 100%;
  max-width: 1000px;
  margin: 20px 0;
}

.collapse-header {
  background: linear-gradient(135deg, #DC143C, #B91C3C);
  color: #fff;
  padding: 16px 20px;
  margin: 0;
  cursor: pointer;
  user-select: none;
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: .5px;
  border-radius: 10px 10px 0 0;
  transition: all .3s ease;
}

.collapse-header:hover {
  background: linear-gradient(135deg, #B91C3C, #A01A3A);
}

.collapse-content {
  background: #fff;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  border: 1px solid #e9ecef;
  border-top: none;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .5s ease, opacity .4s ease, padding .4s ease;
  padding: 0 20px;
}

.collapse-content.active {
  max-height: none;
  opacity: 1;
  padding: 20px;
}

.toggle-btn {
  float: right;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  transition: transform .3s ease;
}

.toggle-btn.rotated {
  transform: rotate(45deg);
}

/* Animation */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(25px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.exercise {
  background: transparent;
  margin: 30px auto;
  width: 100%;
  box-shadow: none;
  border: none;
  overflow: visible;
  animation: slideUp .6s ease-out;
}

.exercise h2 {
  background: linear-gradient(135deg, #DC143C, #B91C3C);
  color: #fff;
  text-align: center;
  margin: 0;
  padding: 12px;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: .5px;
  border-radius: 8px 8px 0 0;
}

/* Responsive Table Wrapper */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  background: #fff;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Scrollbar styling for table wrapper */
.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 0 0 8px 8px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #DC143C;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #B91C3C;
}

/* Responsive tweaks */
@media (max-width:768px) {
  header h1 {
    font-size: 2rem;
  }

  nav {
    flex-direction: column;
    gap: 12px;
  }

  .collapse {
    width: 98%;
  }

  /* Table wrapper adjustments for mobile */
  .table-wrapper {
    margin-bottom: 25px;
    position: relative;
  }

  .table-wrapper table {
    min-width: 650px;
  }

  .exercise-table th,
  .exercise-table td {
    font-size: 0.85rem;
    padding: 10px 12px;
    white-space: nowrap;
  }

  /* Add scroll indicator on mobile */
  .table-wrapper::after {
    content: '→';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(220, 20, 60, 0.9);
    color: white;
    padding: 6px 12px;
    font-size: 1rem;
    font-weight: 600;
    pointer-events: none;
    border-radius: 4px;
    opacity: 0.8;
    animation: pulseArrow 2s infinite;
  }

  @keyframes pulseArrow {

    0%,
    100% {
      opacity: 0.8;
      transform: translateY(-50%) translateX(0);
    }

    50% {
      opacity: 1;
      transform: translateY(-50%) translateX(5px);
    }
  }
}

@media (max-width:480px) {
  header h1 {
    font-size: 1.6rem;
  }

  .exercise h2 {
    font-size: 1rem;
    padding: 10px;
  }

  .collapse-header {
    font-size: 1.1rem;
    padding: 12px 16px;
  }

  .table-wrapper table {
    min-width: 600px;
  }

  .exercise-table th,
  .exercise-table td {
    font-size: 0.8rem;
    padding: 8px 10px;
  }
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  background: #f8f9fa;
  border-top: 3px solid #DC143C;
  margin-top: 50px;
  font-size: 0.9rem;
  color: #495057;
}