/* Hifdh Page Styles */

/* Main wrap */
.hifdh-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px clamp(20px, 4vw, 40px);
  display: grid;
  gap: 24px;
}

/* Hero adjustments */
.hifdh-hero {
  background: linear-gradient(135deg, rgb(12, 62, 24) 0%, rgb(20, 110, 46) 100%);
}

.hero-progress-bar {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d0a12b 0%, #f9cd55 100%);
  box-shadow: 0 0 20px rgba(249, 205, 85, 0.4);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card header */
.card-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.card-header > div {
  flex: 1;
}

.menu-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), rgba(12, 62, 24, 0.8));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6em;
  flex-shrink: 0;
  box-shadow: 0 10px 30px rgba(12, 62, 24, 0.2);
}

.menu-card h2 {
  font-size: 1.75em;
  margin: 0 0 8px 0;
  color: var(--text);
  font-weight: 700;
}

.menu-card p {
  color: var(--muted);
  font-size: 1.05em;
  margin: 0;
  line-height: 1.6;
}

/* Enhanced stats */
.hifdh-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.hifdh-stats .stat {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-soft);
  border: 2px solid rgba(12, 62, 24, 0.12);
  border-radius: 20px;
  padding: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hifdh-stats .stat:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(12, 62, 24, 0.15);
  border-color: rgba(12, 62, 24, 0.2);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(12, 62, 24, 0.1), rgba(12, 62, 24, 0.08));
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6em;
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-content .k {
  color: var(--muted);
  font-size: 0.88em;
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.stat-content .v {
  font-weight: 700;
  font-size: 1.8em;
  color: var(--text);
  line-height: 1;
}

/* Surah controls */
.surah-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.control-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95em;
  flex: 1;
}

.control-info ion-icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

/* Surah list */
.surah-list {
  display: grid;
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 8px;
}

/* Custom scrollbar */
.surah-list::-webkit-scrollbar {
  width: 8px;
}

.surah-list::-webkit-scrollbar-track {
  background: rgba(12, 62, 24, 0.05);
  border-radius: 999px;
}

.surah-list::-webkit-scrollbar-thumb {
  background: rgba(12, 62, 24, 0.2);
  border-radius: 999px;
}

.surah-list::-webkit-scrollbar-thumb:hover {
  background: rgba(12, 62, 24, 0.3);
}

/* Surah row */
.surah {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: center;
  border: 2px solid rgba(12, 62, 24, 0.1);
  background: var(--surface);
  border-radius: 18px;
  padding: 16px;
  transition: all 0.3s ease;
}

.surah:hover {
  border-color: rgba(12, 62, 24, 0.2);
  box-shadow: 0 8px 20px rgba(12, 62, 24, 0.08);
  transform: translateX(4px);
}

.sid {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary);
  background: rgba(12, 62, 24, 0.08);
  border-radius: 12px;
  font-size: 1.1em;
}

.names {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.names .en {
  font-weight: 600;
  font-size: 1.05em;
  color: var(--text);
}

.names .ar {
  font-family: 'Amiri Quran', serif;
  color: var(--muted);
  font-size: 1.3em;
  line-height: 1.4;
}

.ctrls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Memorized checkbox */
.memorized-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 2px solid rgba(12, 62, 24, 0.15);
  transition: all 0.2s ease;
  position: relative;
}

.memorized-checkbox:hover {
  background: rgba(12, 62, 24, 0.05);
  border-color: var(--primary);
}

.memorized-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkmark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid rgba(12, 62, 24, 0.3);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.checkmark ion-icon {
  font-size: 18px;
  color: #ffffff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.memorized-checkbox input[type="checkbox"]:checked ~ .checkmark {
  background: linear-gradient(135deg, var(--primary), rgba(20, 110, 46, 0.9));
  border-color: var(--primary);
}

.memorized-checkbox input[type="checkbox"]:checked ~ .checkmark ion-icon {
  opacity: 1;
}

.checkbox-label {
  font-size: 0.95em;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.memorized-checkbox input[type="checkbox"]:checked ~ .checkbox-label {
  color: var(--primary);
}

.ctrls .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ctrls .top .muted {
  font-size: 0.9em;
  color: var(--muted);
}

.ctrls .top .perc {
  font-weight: 600;
  color: var(--primary);
  font-size: 0.95em;
  min-width: 90px;
  text-align: right;
}

/* Calculator results */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.calc-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.calc-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface-soft);
  border: 2px solid rgba(12, 62, 24, 0.1);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.calc-result-item:hover {
  border-color: rgba(12, 62, 24, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(12, 62, 24, 0.1);
}

.calc-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(12, 62, 24, 0.08);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  flex-shrink: 0;
}

.calc-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-label {
  font-size: 0.85em;
  color: var(--muted);
  font-weight: 500;
}

.calc-value {
  font-size: 1.4em;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

/* Daily plan */
.plan-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.plan-start-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.plan-radio-option input[type="radio"] {
  display: none;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface-soft);
  border: 2px solid rgba(12, 62, 24, 0.12);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.radio-card ion-icon {
  font-size: 1.4em;
  color: var(--primary);
}

.radio-card span {
  font-size: 0.95em;
  font-weight: 500;
  color: var(--text);
}

.plan-radio-option input[type="radio"]:checked ~ .radio-card {
  border-color: var(--primary);
  background: rgba(12, 62, 24, 0.05);
  box-shadow: 0 0 0 3px var(--ring);
}

.plan-radio-option:hover .radio-card {
  border-color: rgba(12, 62, 24, 0.2);
  transform: translateY(-2px);
}

.plan-summary-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(12, 62, 24, 0.04);
  border: 1px solid rgba(12, 62, 24, 0.1);
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.95em;
  line-height: 1.5;
}

.plan-summary-box ion-icon {
  font-size: 1.3em;
  flex-shrink: 0;
}

.plan-current-assignment {
  background: linear-gradient(135deg, rgba(12, 62, 24, 0.05), rgba(20, 110, 46, 0.05));
  border: 2px solid rgba(12, 62, 24, 0.15);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
}

.plan-current-assignment.completed {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
  border-color: rgba(34, 197, 94, 0.3);
}

.assignment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.assignment-day {
  display: flex;
  align-items: center;
  gap: 10px;
}

.day-label {
  font-size: 0.9em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.assignment-day ion-icon {
  font-size: 1.4em;
  color: var(--accent);
}

.assignment-content {
  display: grid;
  gap: 12px;
}

.assignment-text {
  font-size: 1.3em;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.assignment-status {
  font-size: 0.95em;
  color: var(--muted);
  line-height: 1.5;
}

.plan-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.plan-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: rgba(12, 62, 24, 0.04);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.9em;
}

.plan-info ion-icon {
  font-size: 1.2em;
}

/* Strength map */
.strength-controls {
  display: grid;
  gap: 20px;
  margin-bottom: 24px;
}

.strength-filter-section {
  display: grid;
  gap: 10px;
}

.strength-scope-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  align-items: end;
}

.strength-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(12, 62, 24, 0.03);
  border-radius: 14px;
}

.strength-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.sm-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
}

.sm-legend-swatch {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.sm-legend-count {
  font-weight: 700;
  color: var(--text);
  margin-left: 4px;
}

.strength-totals {
  font-size: 0.85em;
  color: var(--muted);
  font-weight: 500;
}

.canvas-container {
  position: relative;
  border-radius: 20px;
  background: var(--surface);
  border: 2px solid rgba(12, 62, 24, 0.1);
  box-shadow: inset 0 2px 8px rgba(12, 62, 24, 0.04);
  overflow: hidden;
  margin-bottom: 20px;
}

.canvas-container canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state ion-icon {
  font-size: 4em;
  opacity: 0.5;
}

.empty-state p {
  max-width: 400px;
  line-height: 1.6;
  margin: 0;
}

/* Form controls */
.input-label {
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.modern-input,
.modern-select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 2px solid rgba(12, 62, 24, 0.12);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1em;
  font-weight: 500;
  transition: all 0.3s ease;
}

.modern-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230c3e18'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

.modern-input:hover,
.modern-select:hover {
  background-color: rgba(12, 62, 24, 0.02);
  border-color: rgba(12, 62, 24, 0.2);
}

.modern-input:focus,
.modern-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
  background-color: #ffffff;
}

.stack {
  display: grid;
  gap: 16px;
}

.sep {
  height: 1px;
  background: rgba(12, 62, 24, 0.12);
  margin: 16px 0;
}

/* Responsive */
@media (max-width: 900px) {
  .surah {
    grid-template-columns: 48px 1fr;
    gap: 12px;
  }
  
  .ctrls {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .hifdh-wrap {
    padding: 16px;
  }
  
  .card-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .surah-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .calc-results,
  .hifdh-stats {
    grid-template-columns: 1fr;
  }
  
  .plan-actions {
    grid-template-columns: 1fr;
  }
  
  .strength-controls {
    gap: 16px;
  }
  
  .strength-scope-section {
    grid-template-columns: 1fr;
  }
}

/* Dark theme support */
body[data-theme="dark"] .menu-card {
  background: rgba(30, 50, 35, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .menu-card h2 {
  color: #ffffff;
}

body[data-theme="dark"] .menu-card p {
  color: rgba(255, 255, 255, 0.7);
}

body[data-theme="dark"] .stat,
body[data-theme="dark"] .calc-result-item,
body[data-theme="dark"] .radio-card,
body[data-theme="dark"] .plan-current-assignment {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .modern-input,
body[data-theme="dark"] .modern-select {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

body[data-theme="dark"] .modern-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ffffff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

body[data-theme="dark"] .stat-content .k,
body[data-theme="dark"] .calc-label,
body[data-theme="dark"] .control-info {
  color: rgba(255, 255, 255, 0.6);
}

body[data-theme="dark"] .stat-content .v,
body[data-theme="dark"] .calc-value,
body[data-theme="dark"] .assignment-text {
  color: rgba(255, 255, 255, 0.95);
}

body[data-theme="dark"] .memorized-checkbox {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="dark"] .memorized-checkbox:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

body[data-theme="dark"] .checkmark {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}
