/* ===================================================================
   DAILY CHALLENGE - Glasmorphism Design (Green-Blue Theme)
   =================================================================== */

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #e5e7eb;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background Video */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.4) contrast(1.08) saturate(1.15);
  opacity: 0.8;
}

/* Main Container */
.challenge-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
}

/* Header */
.challenge-header {
  text-align: center;
  margin-bottom: 32px;
}

.back-link {
  display: inline-block;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 20px;
  transition: color 0.2s;
}

.back-link:hover {
  color: #10b981;
}

.challenge-header h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.challenge-subtitle {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

.stat-icon {
  font-size: 32px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 80px 20px;
}

.loader {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  border: 4px solid rgba(16, 185, 129, 0.2);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
}

/* Challenge Selection */
.challenge-selection {
  animation: fadeIn 0.3s ease-out;
}

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

.challenge-intro {
  text-align: center;
  margin-bottom: 32px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
}

.challenge-intro h2 {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

#challenge-theme {
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.challenge-intro p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
}

/* Difficulty Grid */
.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.difficulty-card {
  padding: 28px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  transition: all 0.3s;
  cursor: pointer;
}

.difficulty-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.difficulty-badge {
  display: inline-block;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.difficulty-badge.beginner {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.difficulty-badge.intermediate {
  background: rgba(14, 165, 233, 0.15);
  color: #0ea5e9;
}

.difficulty-badge.expert {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.difficulty-card h3 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.difficulty-desc {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
  margin-bottom: 16px;
  min-height: 60px;
}

.difficulty-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.meta-item {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

.btn-select {
  width: 100%;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-select:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Completed Today */
.completed-today {
  text-align: center;
  padding: 48px 32px;
  background: rgba(16, 185, 129, 0.1);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
}

.completed-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.completed-today h3 {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.completed-today p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 24px;
}

.today-result {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
}

.result-badge {
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.result-score {
  font-size: 28px;
  font-weight: 700;
  color: #10b981;
}

/* Challenge Active */
.challenge-active {
  animation: fadeIn 0.3s ease-out;
}

.challenge-info {
  padding: 32px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  margin-bottom: 24px;
}

.btn-back {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.challenge-difficulty {
  margin-bottom: 16px;
}

#active-difficulty {
  display: inline-block;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  text-transform: uppercase;
}

#active-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
}

.active-task {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.7;
  margin-bottom: 20px;
}

.hint-box {
  padding: 16px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.hint-box strong {
  color: #10b981;
}

/* Answer Section */
.answer-section {
  padding: 32px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
}

.answer-section label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

#answer-input {
  width: 100%;
  padding: 16px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  color: #e5e7eb;
  resize: vertical;
  transition: all 0.2s;
  line-height: 1.7;
}

#answer-input:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.answer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 16px;
}

.char-count {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

#answer-chars {
  color: #10b981;
  font-weight: 600;
}

.btn-submit {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Result Display */
.challenge-result {
  animation: fadeIn 0.5s ease-out;
}

.result-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  padding: 48px 32px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  margin-bottom: 24px;
}

.badge-display {
  text-align: center;
}

.badge-icon {
  font-size: 80px;
  margin-bottom: 12px;
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.badge-name {
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge-name.gold {
  color: #fbbf24;
}

.badge-name.silver {
  color: #94a3b8;
}

.badge-name.bronze {
  color: #d97706;
}

.result-score {
  text-align: center;
}

.score-value {
  display: block;
  font-size: 56px;
  font-weight: 700;
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.score-label {
  display: block;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

.result-summary {
  padding: 24px 32px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  margin-bottom: 24px;
  text-align: center;
}

#result-summary-text {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
}

.result-feedback {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.feedback-section {
  padding: 24px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

.feedback-section h4 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.feedback-section ul {
  list-style: none;
  padding: 0;
}

.feedback-section li {
  padding: 8px 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

.feedback-section li::before {
  content: "• ";
  color: #10b981;
  font-weight: 700;
  margin-right: 8px;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-secondary,
.btn-primary {
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* History Section */
.history-section {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease-out;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 800px;
  margin: 0 auto 32px;
}

.history-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

.btn-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 800px;
  margin: 0 auto 32px;
}

.history-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

.history-stat .stat-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.history-stat .stat-count {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}

.history-stat .stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
}

.history-list {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.history-item {
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item-info {
  flex: 1;
}

.history-date {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
}

.history-difficulty {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.history-item-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-badge-icon {
  font-size: 32px;
}

.history-score {
  font-size: 20px;
  font-weight: 700;
  color: #10b981;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 24px;
  background: rgba(16, 185, 129, 0.95);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlide {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .challenge-container {
    padding: 24px 16px;
  }

  .challenge-header h1 {
    font-size: 32px;
  }

  .difficulty-grid {
    grid-template-columns: 1fr;
  }

  .result-header {
    flex-direction: column;
    gap: 24px;
  }

  .result-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn-secondary,
  .btn-primary {
    width: 100%;
  }

  .answer-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-submit {
    width: 100%;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.3);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.5);
}
