/* Główne zmienne kolorów */
:root {
  --primary-color: #CC66FF;       /* Podstawowy kolor fioletowy */
  --primary-light: #D98FFF;       /* Jasny fioletowy */
  --primary-dark: #AA44DD;        /* Ciemny fioletowy */
  --secondary-color: #9933CC;     /* Akcentowy ciemniejszy fioletowy */
  --dark-color: #2e2e2e;          /* Ciemny tekst */
  --light-color: #f8f9fa;         /* Jasne tło */
  --success-color: #28a745;       /* Zielony do sukcesu */
  --warning-color: #ffc107;       /* Żółty dla ostrzeżeń */
  --danger-color: #dc3545;        /* Czerwony dla błędów */
}

/* Podstawowe style */
body {
  font-family: 'Poppins', sans-serif;
  background-color: #f0f2f5;
  color: var(--dark-color);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Kontenery */
.quiz-container {
  width: 800px;  /* Stała szerokość zamiast max-width */
  margin: 0 auto;
  padding: 20px;
  flex: 1;
}

.main-quiz-container {
  max-width: 450px;  /* Zmiana szerokości z 550px na 450px */
  margin: 0 auto;
  padding: 20px;
  flex: 1;
}

/* Nagłówek quizu */
.quiz-header {
  text-align: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 20px;
}

.quiz-header h1 {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1.75rem;
  margin-bottom: 5px;
}

.quiz-header p {
  margin-bottom: 0;
  color: #6c757d;
}

/* Stopka quizu */
.quiz-footer {
  text-align: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-top: 1px solid #e9ecef;
  margin-top: 20px;
  color: #6c757d;
  font-size: 0.9rem;
}

/* Karty */
.card {
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border: none;
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border-radius: 15px 15px 0 0 !important;
  padding: 20px;
}

.card-body {
  padding: 20px;
}

/* Przyciski */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  border-radius: 10px;
  padding: 12px 25px;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  color: white;
}

.btn-outline-secondary {
  color: var(--primary-color);
  border-color: var(--primary-color);
  transition: all 0.3s;
}

.btn-outline-secondary:hover, .btn-outline-secondary:focus, .btn-outline-secondary:active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
  transition: all 0.3s;
}

.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Progressbary */
.progress {
  height: 8px;
  border-radius: 0;
  overflow: hidden;
  background-color: #e9ecef;
  margin-bottom: 0;
}

.progress-bar {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.bg-primary {
  background-color: var(--primary-color) !important;
}

.bg-warning {
  background-color: var(--warning-color) !important;
}

.bg-success {
  background-color: var(--success-color) !important;
}

.bg-danger {
  background-color: var(--danger-color) !important;
}

/* Badge */
.badge.bg-primary {
  background-color: var(--primary-color) !important;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 20px;
}

/* Timer */
.timer-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: conic-gradient(var(--primary-color) var(--progress, 100%), #f0f0f0 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-right: 15px;
}

.timer-circle::before {
  content: "";
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: white;
}

.timer-text {
  position: relative;
  font-weight: 600;
  color: var(--primary-color);
}

/* Treść pytania */
.question-text {
  min-height: 80px;  /* Minimalna wysokość dla treści pytania */
  font-size: 1.25rem;
  margin: 25px 0;
  line-height: 1.6;
  font-weight: 500;
}

/* Sekcja odpowiedzi */
.answers-container {
  min-height: 200px;  /* Minimalna wysokość dla sekcji odpowiedzi */
}

/* Opcje odpowiedzi */
.answer-option {
  min-height: 60px;  /* Minimalna wysokość dla opcji odpowiedzi */
  display: flex;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  border: 2px solid #adb5bd;
  border-radius: 12px;
  transition: all 0.3s;
  cursor: pointer;
}

.answer-option:hover {
  border-color: var(--primary-color);
  background-color: rgba(204, 102, 255, 0.05);
}

.answer-option.selected {
  border-color: var(--primary-color);
  background-color: rgba(204, 102, 255, 0.1);
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.form-check-label {
  cursor: pointer;
  width: 100%;
  color: #495057;
  font-weight: 400;
}

/* Przycisk "Następne pytanie" */
.next-button-container {
  margin-top: 20px;
  padding-top: 10px;
}

/* Alerty */
.alert-info {
  background-color: rgba(204, 102, 255, 0.1);
  border-color: rgba(204, 102, 255, 0.2);
  color: var(--primary-dark);
}

.alert-info i {
  color: var(--primary-color);
}

/* Formularze */
.form-control {
  border-radius: 10px;
  padding: 12px;
  border: 2px solid #e1e1e1;
  transition: all 0.3s;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(204, 102, 255, 0.25);
}

.input-with-icon {
  position: relative;
}

.input-with-icon .form-control {
  padding-left: 45px;
}

.input-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
}

/* Wyniki quizu */
.result-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  color: white;
}

.result-details {
  padding: 25px;
  text-align: center;
}

.score-display {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 20px 0;
  color: var(--primary-color);
}

.circular-progress {
  position: relative;
  height: 150px;
  width: 150px;
  margin: 20px auto;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent !important; /* Upewniamy się, że tło jest przezroczyste */
}

.circular-progress::before {
  content: "";
  position: absolute;
  height: 150px;
  width: 150px;
  border-radius: 50%;
  background: conic-gradient(var(--primary-color) var(--progress-percent, 0deg), #ededed 0deg);
  z-index: 1;
}

.circular-progress::after {
  content: "";
  position: absolute;
  height: 120px; /* Mniejszy wewnętrzny krąg */
  width: 120px;
  border-radius: 50%;
  background-color: white; /* Biały środek */
  z-index: 2;
}

.progress-value {
  position: relative;
  font-size: 28px;
  font-weight: 600;
  color: var(--primary-color);
  z-index: 3; /* Ponad wszystkimi warstwami */
}

/* Poziomy i odznaki */
.level-badge {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 50px;
  font-weight: 600;
  margin-bottom: 20px;
}

.level-badge.beginner {
  background-color: #F2E6FF;
  color: #AA44DD;
}

.level-badge.intermediate {
  background-color: #E6CCFF;
  color: #9933CC;
}

.level-badge.advanced {
  background-color: #D9B3FF;
  color: #8822BB;
}

.level-badge.expert {
  background-color: #CC99FF;
  color: #7711AA;
}

.level-badge.master {
  background-color: #BF80FF;
  color: #6600AA;
}

.level-badge.unknown {
  background-color: #f8f9fa;
  color: #6c757d;
}

/* Bardziej widoczny opis wyniku */
.result-description {
  margin: 20px 0;
}

.result-text {
  font-size: 1.2rem;
  line-height: 1.6;
  font-weight: 500;
  color: var(--primary-dark);
  margin-bottom: 0;
}

/* Stylowanie dla administratora */
.navbar-admin {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

.card-admin-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
  color: white;
  padding: 15px 20px;
  font-weight: 600;
}

.btn-admin {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-admin:hover {
  background: linear-gradient(135deg, #9933BB 0%, #BB55FF 100%);
  transform: translateY(-2px);
  color: white;
}

.admin-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

/* Style dla tabel w panelu administratora */
#questions-table th, 
#questions-table td,
#tokens-table th,
#tokens-table td,
#results-table th,
#results-table td {
  padding: 6px 10px;
  vertical-align: middle;
  font-size: 0.9rem;
  line-height: 1.2;
  border-bottom: 1px solid #dee2e6;
}

#questions-table tr,
#tokens-table tr,
#results-table tr {
  height: 40px; /* Zmniejszona wysokość wierszy */
}

#questions-table th,
#tokens-table th,
#results-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #495057;
}

/* Style dla odstępów w tabeli */
.table > :not(caption) > * > * {
  padding: 6px 10px;
}

/* Treść pytań w tabelach administratora */
.question-text-cell {
  max-width: 500px; /* Maksymalna szerokość komórki */
}

.question-text {
  font-size: 0.9rem;
  line-height: 1.2;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap; /* Jedna linia */
  margin: 0;
  padding: 0;
}

/* Lepsza responsywność tabeli */
.table-responsive {
  margin-bottom: 0;
}

/* Wyrównanie zawartości kolumn */
.text-center {
  text-align: center !important;
}

/* Przyciski akcji w tabelach administracyjnych */
.btn-action {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  margin-right: 5px;
  transition: all 0.2s ease;
  border: none;
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

.btn-action.btn-info {
  background-color: #17a2b8;
  color: white;
}

.btn-action.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-action.btn-danger {
  background-color: #dc3545;
  color: white;
}

.action-btns {
  white-space: nowrap;
  text-align: center;
}

/* Style dla edycji pytań */
.answer-row {
  position: relative;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
  background-color: #f8f9fa;
}

.answer-number {
  position: absolute;
  top: -10px;
  left: -10px;
  background-color: var(--primary-color);
  color: white;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.remove-answer-btn {
  border-radius: 6px;
  padding: 5px 10px;
  transition: all 0.2s;
}

.remove-answer-btn:hover:not(:disabled) {
  background-color: #c82333;
  transform: translateY(-2px);
}

.form-check-inline {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
  white-space: nowrap; /* Zapobiega zawijaniu tekstu */
  width: auto; /* Automatyczna szerokość zamiast stałej */
}

/* Poszerzone pole na etykietę */
.form-check-label {
  white-space: nowrap; /* Zapobiega zawijaniu tekstu */
  overflow: visible; /* Pozwala na widoczność całego tekstu */
  width: auto; /* Automatyczna szerokość */
}

/* Wygląd radio button jako poprawnej odpowiedzi */
.correct-answer-radio:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Style dla podglądu odpowiedzi */
.answer-card {
  display: flex;
  align-items: center;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 10px;
  border: 1px solid #e9ecef;
  background-color: #f8f9fa;
  position: relative;
}

.answer-card.correct {
  background-color: rgba(40, 167, 69, 0.1);
  border-color: rgba(40, 167, 69, 0.3);
  border-left: 5px solid #28a745;
}

.answer-number {
  flex: 0 0 30px;
  font-weight: bold;
  color: #6c757d;
}

.answer-text {
  flex: 1;
  padding: 0 15px;
}

.answer-points {
  flex: 0 0 60px;
  text-align: right;
  font-weight: bold;
  color: #28a745;
}

.correct-badge {
  font-weight: 600;
}

/* Style dla statystyk odpowiedzi */
.stats-bar {
  height: 25px;
  border-radius: 5px;
  margin-top: 5px;
  margin-bottom: 15px;
  position: relative;
  overflow: hidden;
  background-color: #e9ecef;
}

.stats-bar-fill {
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  transition: width 0.5s ease;
}

.stats-bar-fill.correct {
  background-color: #28a745;
}

.stats-bar-fill.incorrect {
  background-color: #6c757d;
}

.stats-label {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-weight: bold;
  z-index: 2;
  text-shadow: 0 0 3px rgba(0,0,0,0.5);
}

.stats-card {
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.stats-title {
  font-weight: 600;
  margin-bottom: 15px;
}

.stats-summary {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.stats-summary-item {
  text-align: center;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 10px;
  flex: 1;
  margin: 0 5px;
}

.stats-summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.stats-summary-label {
  font-size: 0.9rem;
  color: #6c757d;
}

/* Media queries dla responsywności */
@media (max-width: 850px) {
  .quiz-container {
    width: 95%;  /* Na mniejszych ekranach dostosowuje się do szerokości urządzenia */
  }
  
  .main-quiz-container {
    width: 95%;
  }
  
  .question-text {
    font-size: 1.1rem;
  }
  
  .card-body {
    padding: 15px;
  }
  
  .quiz-header h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 576px) {
  .card {
    min-height: auto;  /* Na bardzo małych ekranach usuwamy minimalną wysokość */
  }
  
  .question-text {
    min-height: auto;
  }
  
  .answers-container {
    min-height: auto;
  }
  
  .stats-summary {
    flex-direction: column;
  }
  
  .stats-summary-item {
    margin: 5px 0;
  }
}

/* Style dla zdjęć w pytaniach */
.question-image {
  display: flex;
  justify-content: center;
  margin: 1rem auto;
  max-width: 75%;
  max-height: 350px;
  overflow: hidden;
}

.question-image img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Animacja pojawienia się zdjęcia */
.question-image img {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}