:root {
  --primary: #012b76;
  --blue: #073d8f;
  --blue-darken: #03337b;
  --blue-disabled: #829dc3;
  --yellow: #ffc30e;
  --yellow-darken: #e6ae08;
  --yellow-disabled: #ddca93;
  --gray: #e7e7e7;
  --border-radius: 5px;
  --button-checked: #0c0e10;
  --text-color: #1e1e1e;
  --active-part-color: #6c757d;
  --answer-color: #e9e9e9;
  --ok: #1e8b1e;
}

html,
body,
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  color: var(--text-color);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

body.login {
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 2fr 3fr;
  background-color: rgb(245, 245, 245);
}

@media only screen and (max-width: 768px) {
  body,
  body.login {
    grid-template-columns: 1fr;
  }
}

.container {
  max-width: 1200px;
  padding: 0 50px;
  margin: 0 auto;
}

@media only screen and (max-width: 768px) {
  .container {
    padding: 0 20px;
  }
}

.login .imagesWrapper {
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.imagesWrapper > img {
  width: 100%;
  height: 50%;
  object-fit: cover;
  display: block;
}

.login .top h2 {
  color: white;
  margin-top: 20px;
  font-size: 1.4rem;
  text-align: center;
}

.login .top {
  position: absolute;
  background-color: var(--primary);
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px 10px;
  z-index: 3;
}

.login .left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.loginWrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 70%;
  max-width: 450px;
  background: #ffffff;
  border: 1px solid var(--gray);
  border-radius: 16px;
  padding: 60px 50px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 3;
}

.loginWrapper h1 {
  font-size: 2rem;
  color: var(--blue-darken);
  margin-bottom: 30px;
  font-weight: 600;
  text-align: center;
}

form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.formGroup {
  display: flex;
  flex-direction: column;
}

.formGroup label {
  font-size: 0.95rem;
  color: var(--blue-darken);
  margin-bottom: 6px;
  font-weight: 500;
}

.formGroup input {
  padding: 12px 14px;
  border: 1px solid #c7c7c7;
  border-radius: var(--border-radius);
  font-size: 1rem;
  color: var(--text-color);
  background-color: #fafafa;
  transition: all 0.25s ease;
}

.formGroup input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

button,
.button,
input[type='submit'] {
  margin-top: 15px;
  padding: 12px 18px;
  border: none;
  border-radius: var(--border-radius);
  background-color: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.1s ease;
  text-align: center;
  text-decoration: none;
}

.button:hover,
button:hover,
input[type='submit']:hover {
  background-color: var(--blue-darken);
}

button:active,
input[type='submit']:active {
  transform: scale(0.98);
}

.sectionModal-buttons .button,
.buttons .button,
td .button {
  margin-top: 0;
}

.loginWrapper a {
  display: inline-block;
  margin-top: 15px;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.25s ease;
}

.loginWrapper a:hover {
  color: var(--blue-darken);
}

.imagesWrapper .overflow {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-content: center;
  background-color: rgba(0, 0, 0, 0.6);
}

.formGroup {
  display: flex;
  flex-direction: column;
}

.bg {
  position: absolute;
  bottom: 0;
  height: 100%;
  opacity: 0.2;
}

.error {
  color: red;
  margin-top: 1rem;
}

.header {
  background: linear-gradient(90deg, #012b76, #0056d6);
  color: white;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

@media only screen and (max-width: 768px) {
  .header {
    padding: 1rem;
  }
}

.header-left {
  font-size: 1.4rem;
  font-weight: 500;
}

.logout-btn {
  background: #ffffff33;
  border: 1px solid #ffffff55;
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s ease;
  text-decoration: none;
}

.logout-btn:hover {
  background: #ffffff55;
}

.mainWrapper {
  max-width: 900px;
  margin: 2rem auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 2rem 3rem;
}

@media only screen and (max-width: 768px) {
  .mainWrapper {
    padding: 1rem;
  }
}

h1 {
  margin-bottom: 1rem;
  font-weight: 600;
  color: #012b76;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.stat-box {
  background: #f8faff;
  border: 1px solid #e2e6f0;
  border-radius: 10px;
  padding: 1.2rem;
  text-align: center;
  transition: 0.2s ease;
}

.stat-box:hover {
  background: #eaf1ff;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: #012b76;
  margin-bottom: 0.3rem;
}

.stat-label {
  color: #555;
  font-size: 0.9rem;
}

.access-info {
  margin-top: 2rem;
  font-size: 1rem;
  background: #f0f3fa;
  padding: 1rem 1.5rem;
  border-radius: 8px;
}

.buttons {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

footer {
  text-align: center;
  margin-top: 3rem;
  font-size: 0.9rem;
  color: #666;
}

.examButton {
  flex: 1;
  min-width: 200px;
}

footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  text-decoration: underline;
}

#categoryModal {
  display: none;
  position: fixed;
  inset: 0;
  background: #00000088;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#categoryModal .modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  text-align: center;
}

@media only screen and (max-width: 768px) {
  .loginWrapper {
    margin-top: 50px;
    width: 90%;
    padding: 60px 30px;
  }
  .login .imagesWrapper {
    display: none;
  }

  .login .top h2 {
    font-size: 1.05rem;
  }
}

.flashMessage {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;

  padding: 12px 20px;
  border-radius: 8px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 800px;
  width: fit-content;
  animation: slideDown 0.3s ease;
  opacity: 0.95;
}

/* Animacja lekkiego wjechania z góry */
@keyframes slideDown {
  from {
    transform: translate(-50%, -20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 0.95;
  }
}

.flashMessage.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flashMessage.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.flashMessage.info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.button[disabled],
.button[disabled]:hover {
  background: #ccc;
  color: #666;
  cursor: default;
  border: none;
  opacity: 0.7;
}

.expired {
  color: #c00;
  text-align: center;
  width: 100%;
  margin-top: 1rem;
}

.categorySingleBtn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  border-radius: 10px;
  cursor: pointer;
}

.learning-progress {
  margin-top: 3rem;
  background: #f8faff;
  border: 1px solid #e2e6f0;
  border-radius: 12px;
  padding: 1.8rem 2rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.learning-progress h2 {
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
  color: var(--primary);
  text-align: left;
}

.progress-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  color: #333;
}

.progress-table th,
.progress-table td {
  padding: 0.8rem 1rem;
  text-align: center;
  border-bottom: 1px solid #e0e5f2;
}

.progress-table th {
  background-color: #eef3ff;
  color: var(--primary);
  font-weight: 600;
}

.progress-table tr:nth-child(even) {
  background-color: #fafcff;
}

.progress-table tr:hover {
  background-color: #eaf1ff;
}

.progress-table td:first-child,
.progress-table th:first-child {
  text-align: left;
}

.progress-table td:last-child {
  text-align: center;
}

.button.small {
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  border-radius: 6px;
  background-color: var(--primary);
  color: #fff;
  text-decoration: none;
  transition: background 0.2s ease;
}

.button.small:hover {
  background-color: var(--blue-darken);
}

@media only screen and (max-width: 768px) {
  .progress-table th,
  .progress-table td {
    padding: 0.6rem 0.4rem;
    font-size: 0.85rem;
  }

  .learning-progress {
    padding: 1.2rem;
  }

  .learning-progress h2 {
    text-align: center;
    font-size: 1.2rem;
  }
}

/* === Modal resetowania postępu nauki === */

#resetModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none; /* włączane JS-em */
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}

#resetModal .modal-box {
  background: #fff;
  color: #222;
  padding: 2rem 2.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-width: 420px;
  width: 90%;
  text-align: center;
  animation: fadeInScale 0.25s ease-out;
}

#resetModal h2 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  color: #111;
}

#resetModal p {
  font-size: 1rem;
  line-height: 1.5;
  color: #444;
}

#resetModal .modal-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.8rem;
}

@media only screen and (max-width: 768px) {
  #resetModal .modal-buttons {
    flex-direction: column;
  }
}

.scroll-hint {
  text-align: right;
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.5rem;
  margin-bottom: 0;
  opacity: 0.8;
}

@media (min-width: 769px) {
  .scroll-hint {
    display: none;
  }
}

#resetModal .modal-buttons button {
  min-width: 120px;
  margin-top: 0;
}

#resetConfirm {
  background: #ffc107;
  color: #000;
}

#resetConfirm:hover {
  background: #ffb300;
}

#resetCancel {
  background: #ccc;
  color: #000;
}

#resetCancel:hover {
  background: #bbb;
}

/* Animacja przy otwieraniu */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.favoritesWrapper {
  text-align: center;
}

.progress-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* płynne przewijanie na iOS */
}

.progress-table {
  min-width: 600px; /* zabezpieczenie przed łamaniem kolumn */
}

.favButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 8px;
  font-size: 0.8rem;
  margin-top: 0;
}

.sectionModal {
  position: fixed;
  inset: 0;
  background: #00000088;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.sectionModal-box {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  max-width: 420px;
  width: 90%;
  animation: fadeInScale 0.25s ease-out;
}

.sectionModal h2 {
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
  color: var(--primary);
}

.sectionModal-buttons {
  margin-top: 1.5rem;
  display: grid;
  grid-gap: 1rem;
  grid-template-columns: 1fr 1fr;
}

@media only screen and (max-width: 768px) {
  .sectionModal-buttons {
    grid-template-columns: 1fr;
  }
}

.cancelSectionBtn {
  margin-top: 1.5rem;
  background: #ccc;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  color: #000;
}

.cancelSectionBtn:hover {
  background: #bbb;
}

#categoryButtons {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

@media only screen and (max-width: 768px) {
  .sectionModal-box {
    padding: 1.5rem;
  }

  .sectionModal h2 {
    font-size: 1.2rem;
  }
}
