/* Timer Progress Bar */
.timer-container {
  width: 100%;
  margin: 20px 0;
}

.timer-label {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.timer-progress {
  width: 100%;
  height: 30px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  position: relative;
}

.timer-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success-color) 0%, var(--accent-color) 50%, var(--danger-color) 100%);
  transition: width 0.1s linear;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1rem;
}

.timer-expired {
  background: var(--danger-color) !important;
}

/* Admin timer styles */
.admin-timer-container {
  margin: 15px 0;
  padding: 15px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

.admin-timer-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.admin-timer-progress {
  width: 100%;
  height: 20px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.admin-timer-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success-color) 0%, var(--accent-color) 50%, var(--danger-color) 100%);
  transition: width 0.1s linear;
  text-align: center;
  color: white;
  font-weight: bold;
  font-size: 0.85rem;
  line-height: 20px;
}

/* Theater Quiz Mobile-Friendly Styles */

:root {
  --primary-color: #6B46C1;
  --secondary-color: #9F7AEA;
  --accent-color: #F59E0B;
  --success-color: #10B981;
  --danger-color: #EF4444;
  --text-light: #F3F4F6;
  --text-dark: #1F2937;
  --background-overlay: rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100%;
  color: var(--text-light);
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* Quiz page background */
.quiz-page {
  background-image: url('/background/background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.quiz-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--background-overlay);
  z-index: 0;
}

/* Language selector */
.language-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 10px;
}

/* Username header */
.username-header {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 8px 15px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.username-display {
  color: var(--text-light);
  font-weight: 600;
  font-size: 14px;
}

.username-header form {
  display: inline;
  margin: 0;
}

.reset-username-btn {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  margin: 0;
  width: auto;
  max-width: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reset-username-btn:hover {
  transform: scale(1.2) rotate(180deg);
  filter: brightness(1.3);
}

.language-selector button {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: var(--text-light);
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 5px;
}

.flag-icon {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
}

.language-selector button:hover,
.language-selector button.active {
  background: var(--primary-color);
  border-color: var(--secondary-color);
  transform: scale(1.1);
}

/* Main container */
.quiz-container {
  position: relative;
  z-index: 1;
  max-width: 600px;
  width: 90%;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.quiz-container h1 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.quiz-container h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--accent-color);
}

.quiz-container p {
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 1rem;
}

/* Forms */
form {
  width: 100%;  
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 15px;
  font-size: 1.1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  backdrop-filter: blur(10px);
  margin-bottom: 15px;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--secondary-color);
  background: rgba(255, 255, 255, 0.15);
}

/* Buttons */
button,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger {
  padding: 15px 30px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 400px;
  margin: 10px 0;
}

button[type="submit"],
.btn-primary {
  background: var(--primary-color);
  color: var(--text-light);
}

button[type="submit"]:hover,
.btn-primary:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
  background: #6B7280;
  color: var(--text-light);
}

.btn-success {
  background: var(--success-color);
  color: var(--text-light);
}

.btn-danger {
  background: var(--danger-color);
  color: var(--text-light);
}

/* Refresh button */
.btn-refresh {
  background: transparent;
  border: 2px solid rgba(107, 70, 193, 0.5);
  color: var(--primary-color);
  padding: 8px 12px;
  font-size: 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 40px;
  height: 40px;
  margin: 0;
}

.btn-refresh:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: rotate(180deg);
}

.btn-refresh:active {
  transform: scale(0.95);
}

.btn-refresh:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Answer buttons */
.answer-form {
  width: 100%;
  display: flex;
  align-items: center;
  flex-direction: column;
}

.answer-button {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;  
  background: rgba(255, 255, 255, 0.1);
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  text-align: left;
  backdrop-filter: blur(10px);
}

.answer-button-error {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  margin: 15px 0;
  background: rgba(255, 0, 0, 0.1);
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  
  color: white;
  transition: all 0.3s ease;
  width: 100%;
  text-align: left;
  backdrop-filter: blur(10px);
}
.answer-button-correct {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  margin: 15px 0;
  background: rgba(0, 255, 0, 0.1);
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;  
  color: white;
  transition: all 0.3s ease;
  width: 100%;
  text-align: left;
  backdrop-filter: blur(10px);
}

.answer-button-normal {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  margin: 15px 0;
  background: rgba(255, 255, 255, 0.1);
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  color: white;
  transition: all 0.3s ease;
  width: 100%;
  text-align: left;
  backdrop-filter: blur(10px);
}

.answer-button:hover {
  background: rgba(159, 122, 234, 0.3);
  border-color: var(--secondary-color);
  transform: scale(1.02);
}

.answer-button:active {
  transform: scale(0.98);
}

.incorrect-answer {
  font-size: larger;
  padding-top: 1em;
  font-weight: 600;
}

.incorrect-answer2 {
  font-size: large;
  padding: 1em;
  font-weight: 600;
}

.correct-answer {
  font-size: large;
  padding: 1em;
  font-weight: 600;
}

/* Animation for correct answer background */
@keyframes celebrate-flash {
  0%, 100% { background-color: rgba(16, 185, 129, 0.3); }
  50% { background-color: rgba(16, 185, 129, 0.6); }
}

@keyframes celebrate-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes float-up {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

/* Animation for incorrect answer background */
@keyframes sad-flash {
  0%, 100% { background-color: rgba(239, 68, 68, 0.3); }
  50% { background-color: rgba(239, 68, 68, 0.6); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Correct answer result styling */
.result-correct-container {
  position: relative;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.4) 0%, rgba(16, 185, 129, 0.2) 100%);
  border: 3px solid var(--success-color);
  border-radius: 20px;
  padding: 30px;
  margin: 20px 0;
  animation: celebrate-flash 2s ease-in-out infinite, celebrate-pulse 1s ease-in-out 3;
  overflow: hidden;
}

.result-correct-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
  animation: celebrate-pulse 2s ease-in-out infinite;
}

/* Celebration emoji floating animation */
.celebration-emoji {
  position: absolute;
  font-size: 3rem;
  animation: float-up 3s ease-out 5;
  pointer-events: none;
  opacity: 0;
}

.celebration-emoji:nth-child(1) { left: 10%; animation-delay: 0s; }
.celebration-emoji:nth-child(2) { left: 30%; animation-delay: 0.5s; }
.celebration-emoji:nth-child(3) { left: 50%; animation-delay: 1s; }
.celebration-emoji:nth-child(4) { left: 70%; animation-delay: 1.5s; }
.celebration-emoji:nth-child(5) { left: 90%; animation-delay: 2s; }

/* Incorrect answer result styling */
.result-incorrect-container {
  position: relative;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(239, 68, 68, 0.2) 100%);
  border: 3px solid var(--danger-color);
  border-radius: 20px;
  padding: 30px;
  margin: 20px 0;
  animation: sad-flash 2s ease-in-out infinite, shake 0.5s ease-in-out 3;
}

/* Sad emoji animation */
.sad-emoji {
  position: absolute;
  font-size: 3rem;
  animation: float-up 3s ease-out 5;
  pointer-events: none;
  opacity: 0;
}

.sad-emoji:nth-child(1) { left: 15%; animation-delay: 0s; }
.sad-emoji:nth-child(2) { left: 40%; animation-delay: 0.7s; }
.sad-emoji:nth-child(3) { left: 65%; animation-delay: 1.4s; }
.sad-emoji:nth-child(4) { left: 85%; animation-delay: 2.1s; }

.answer-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: bold;
  flex-shrink: 0;
}

.answer-text {
  font-size: 1.1rem;
  flex: 1;
}

/* Question content */
.question-content {
  width: 100%;
  text-align: center;
}

.question-content h1 {
  font-size: 1.5rem;
  margin-bottom: 30px;
  padding: 20px;
  background: rgba(245, 158, 11, 0.2);
  border-radius: 15px;
  border: 2px solid var(--accent-color);
}

/* Waiting content */
.waiting-content {
  text-align: center;
}

.waiting-message {
  font-size: 1.3rem;
  margin: 30px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

/* Loader animation */
.loader {
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top: 5px solid var(--accent-color);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin: 30px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Results */
.results-list {
  width: 100%;
  margin: 20px 0;
}

.results-separator {
  text-align: center;
  margin: 20px 0;
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.5);
  padding: 10px 0;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.result-item.winner {
  background: rgba(245, 158, 11, 0.3);
  border-color: var(--accent-color);
  border-width: 3px;
}

.result-item.current-user {
  background: rgba(107, 70, 193, 0.3);
  border-color: var(--primary-color);
  border-width: 3px;
}

.result-item .position {
  font-size: 1.2rem;
  font-weight: bold;
  min-width: 50px;
}

.result-item .name {
  flex: 1;
  font-size: 1.1rem;
}

.result-item .score {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--accent-color);
}

.result-item .time {
  font-size: 0.9rem;
  opacity: 0.8;
}

.winner-announcement {
  margin-top: 40px;
  padding: 30px;
  background: rgba(245, 158, 11, 0.2);
  border: 3px solid var(--accent-color);
  border-radius: 20px;
  text-align: center;
}

.winner-name {
  font-size: 2.5rem;
  color: var(--accent-color);
  margin: 20px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Messages */
.error-message {
  background: rgba(239, 68, 68, 0.8);
  color: white;
  padding: 15px;
  border-radius: 10px;
  margin: 15px 0;
  text-align: center;
}

.success-message {
  background: rgba(16, 185, 129, 0.8);
  color: white;
  padding: 15px;
  border-radius: 10px;
  margin: 15px 0;
  text-align: center;
}

.info-message {
  background: rgba(59, 130, 246, 0.8);
  color: white;
  padding: 15px;
  border-radius: 10px;
  margin: 15px 0;
}

/* Admin pages */
.admin-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  font-size: 14px;
}

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  padding: 30px;
  border-radius: 15px;
  color: var(--text-dark);
}

.admin-container h1 {
  color: var(--primary-color);
  margin-bottom: 30px;
  font-size: 1.75rem;
}

.admin-container h2 {
  font-size: 1.35rem;
}

.admin-container h3 {
  font-size: 1.1rem;
}

/* Admin page inputs - black text color */
.admin-page input[type="text"],
.admin-page input[type="password"],
.admin-page input[type="number"],
.admin-page textarea,
.admin-page select {
  color: black;
  font-size: 0.9rem;
}

.admin-page button,
.admin-page .btn-primary,
.admin-page .btn-secondary,
.admin-page .btn-success,
.admin-page .btn-danger {
  font-size: 0.95rem;
  padding: 10px 20px;
}

.admin-page label {
  font-size: 0.9rem;
}

.admin-links {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.admin-link-button {
  display: inline-block;
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.admin-link-button:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

.active-round-panel,
.no-active-round {
  margin-top: 30px;
  padding: 20px;
  background: rgba(107, 70, 193, 0.1);
  border-radius: 10px;
}

.active-round-container {
  display: flex;
  gap: 20px;
  margin-top: 30px;
}

.active-round-main {
  flex: 1;
  padding: 20px;
  background: rgba(107, 70, 193, 0.1);
  border-radius: 10px;
}

.active-round-sidebar {
  width: 350px;
  padding: 20px;
  background: rgba(107, 70, 193, 0.1);
  border-radius: 10px;
  max-height: 80vh;
  overflow-y: auto;
}

.active-round-sidebar h3 {
  margin-bottom: 15px;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.participants-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.participant-item {
  background: white;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
}

.participant-name {
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--text-dark);
  font-size: 0.9rem;
}

.result-item-admin {
  background: white;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.result-item-admin:nth-child(1) {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
  border: 2px solid var(--accent-color);
}

.result-item-admin:nth-child(2) {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.15) 0%, rgba(192, 192, 192, 0.05) 100%);
  border: 2px solid #C0C0C0;
}

.result-item-admin:nth-child(3) {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.15) 0%, rgba(205, 127, 50, 0.05) 100%);
  border: 2px solid #CD7F32;
}

.progress-squares {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
}

.progress-square {
  width: 25px;
  height: 25px;
  border: 2px solid #ccc;
  border-radius: 4px;
  background: white;
  transition: all 0.3s ease;
}

.progress-square.correct {
  background: var(--success-color);
  border-color: var(--success-color);
}

 .progress-square.incorrect {
    background: var(--danger-color);
    border-color: var(--danger-color);
 }

.participant-score {
  font-size: 0.9rem;
  color: #666;
  text-align: right;
}

.round-controls,
.round-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.participants ul {
  list-style: none;
  padding: 0;
}

.participants li {
  padding: 10px;
  margin: 5px 0;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 5px;
}

.button-icon {
  width: auto;
}

.question-list,
.round-list {
  margin: 20px 0;
}

.question-item,
.round-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  margin: 10px 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
  flex-direction: column;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .quiz-container {
    padding: 20px 15px;
  }
  
  .quiz-container h1 {
    font-size: 1.5rem;
  }
  
  .language-selector {
    top: 10px;
    right: 10px;
  }
  
  .username-header {
    top: 10px;
    left: 10px;
    padding: 6px 12px;
    gap: 6px;
  }
  
  .username-display {
    font-size: 13px;
  }
  
  .reset-username-btn {
    font-size: 14px;
  }
  
  .language-selector button {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .answer-button {
    padding: 15px;
    gap: 15px;
  }
  
  .answer-number {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .admin-links {
    flex-direction: column;
  }
  
  .admin-link-button {
    width: 100%;
    text-align: center;
  }
  
  .active-round-container {
    flex-direction: column;
  }
  
  .active-round-sidebar {
    width: 100%;
    max-height: none;
  }
  
  .progress-square {
    width: 20px;
    height: 20px;
  }
}
