/* ===================================
   GLOBAL STYLES & RESET
   =================================== */

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

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: #2e3651;
}

/* ===================================
   MAIN APP CONTAINER
   =================================== */

#app {
  max-width: 980px;
  width: 100%;
  min-height: 90vh;
  border-radius: 28px;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37), 0 0 60px rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===================================
   TAB NAVIGATION
   =================================== */

.tab-nav {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 2px 20px rgba(131, 150, 231, 0.15);
  padding: 12px 20px;
  gap: 8px;
  flex-wrap: wrap;
}


.tab-btn {
background: rgba(255, 255, 255, 0.2);  
border: none;
  color: #6470a2;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 16px;
  padding: 12px 12px;  /* ← REDUCED: 16px → 12px horizontal padding */
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}


.tab-btn:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.tab-btn.active {
  background: linear-gradient(120deg, #a2c8f7 0%, #f3e5ff 100%);
  color: #2e3651;
  box-shadow: 0 4px 20px rgba(122, 191, 253, 0.5);
}

.tab-btn.disabled {
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.2);
  cursor: not-allowed;
  opacity: 0.85;
  position: relative;
}

.tab-btn.disabled::before {
  content: '🔒 ';
  font-size: 0.9em;
}


button.danger-btn {
  background: linear-gradient(110deg, #ff627a 8%, #ffaad2 92%);
  color: #fff;
  border-radius: 16px;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 5px 22px rgba(255, 104, 158, 0.4);
  padding: 10px 20px;
  margin-left: auto;
  margin-top: 0;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

button.danger-btn:hover {
  background: linear-gradient(110deg, #fb3e6a 24%, #ffa1d7 91%);
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(255, 104, 158, 0.6);
}


/* ===================================
   TAB CONTENT
   =================================== */

.tab-content {
  flex: 1;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 0 0 28px 28px;
  padding: 35px;
  overflow-y: auto;
}


h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #2e3651;
text-align: center;
}

h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 15px;
  color: #2e3651;
}

p {
  margin: 1em 0;
  font-size: 1.1rem;
  color: #5a6789;
  line-height: 1.6;
}

.message {
  color: #253363;       
  font-style: italic;
  margin-top: 0.8em;
  margin-bottom: 0;
}


/* ===================================
   GLASSMORPHISM SECTIONS & CARDS
   =================================== */

.glass-section {
  background: rgba(255, 255, 255, 0.75);  /* More transparent: was 0.92 */
  border-radius: 22px;
  box-shadow: 0 2px 8px rgba(131, 150, 231, 0.12);
  margin-bottom: 20px;
  padding: 20px 26px;
  border: 1px solid rgba(220, 225, 245, 0.6);
}


.question-item,
.student-question-item {
  background: rgba(255, 255, 255, 0.75);  /* More transparent: was 0.92 */
  border-radius: 22px;
  box-shadow: 0 2px 8px rgba(131, 150, 231, 0.12);
  margin-bottom: 18px;
  padding: 20px 26px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid rgba(220, 225, 245, 0.6);
}




/* ===================================
   FORM INPUTS
   =================================== */

input[type="text"],
input[type="number"],
input[type="password"],
input[type="url"],
textarea,
select {
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 1.05rem;
  font-weight: 600;
  border: 1.5px solid rgba(208, 232, 255, 0.6);
background: rgba(255, 255, 255, 0.95);
  color: #1d334e;
  outline: none;
  transition: all 0.25s ease;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #61b6ec;
  background: #f7fdff;
  box-shadow: 0 0 0 3px rgba(97, 182, 236, 0.15);
}

input[readonly],
input[disabled] {
  background: rgba(220, 230, 245, 0.4) !important;
  color: #8a8fa5 !important;
  border: 1px solid rgba(200, 210, 230, 0.4) !important;
  cursor: not-allowed;
}

textarea {
  min-height: 120px;
  resize: vertical;
  width: 100%;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Student Marks Entry with Pass/Fail Glow */
.marks-entry {
  min-width: 80px;
  width: 90px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  border: 2px solid #b1eaff;
  background: rgba(255, 255, 255, 0.9) !important;
}

.input-pass {
  border: 2.5px solid #3ae686 !important;
  background: linear-gradient(135deg, rgba(235, 255, 243, 0.95), rgba(200, 255, 230, 0.85)) !important;
  box-shadow: 0 0 20px rgba(58, 230, 134, 0.6),
              0 0 40px rgba(58, 230, 134, 0.3),
              inset 0 2px 15px rgba(255, 255, 255, 0.5) !important;
  animation: pulseGreen 2s ease-in-out infinite;
  color: #1a5d3a !important;
}

.input-fail {
  border: 2.5px solid #ff6575 !important;
  background: linear-gradient(135deg, rgba(255, 234, 238, 0.95), rgba(255, 200, 210, 0.85)) !important;
  box-shadow: 0 0 20px rgba(255, 101, 117, 0.6),
              0 0 40px rgba(255, 101, 117, 0.3),
              inset 0 2px 15px rgba(255, 255, 255, 0.5) !important;
  animation: pulseRed 2s ease-in-out infinite;
  color: #982232 !important;
}

@keyframes pulseGreen {
  0%, 100% {
    box-shadow: 0 0 20px rgba(58, 230, 134, 0.6), 0 0 40px rgba(58, 230, 134, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(58, 230, 134, 0.8), 0 0 60px rgba(58, 230, 134, 0.4);
  }
}

@keyframes pulseRed {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 101, 117, 0.6), 0 0 40px rgba(255, 101, 117, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 101, 117, 0.8), 0 0 60px rgba(255, 101, 117, 0.4);
  }
}

/* ===================================
   BUTTONS
   =================================== */

button:not(.tab-btn):not(.danger-btn) {
  background: linear-gradient(120deg, #6ba3ff 0%, #a98fff 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 12px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 18px rgba(107, 163, 255, 0.4);
  font-family: inherit;
}

button:not(.tab-btn):not(.danger-btn):hover {
  background: linear-gradient(120deg, #5a92ee 0%, #9878ee 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(107, 163, 255, 0.6);
}

button:not(.tab-btn):not(.danger-btn):active {
  transform: translateY(0);
}

button.secondary-btn { background: rgba(255, 255, 255, 0.5) !important; backdrop-filter: blur(15px); border: 1.5px solid rgba(255, 255, 255, 0.6) !important; color: #4a5a8a !important; box-shadow: 0 4px 15px rgba(74, 90, 138, 0.15) !important; margin-left: auto; flex-shrink: 0; }
button.secondary-btn:hover { background: rgba(255, 255, 255, 0.65) !important; border-color: rgba(255, 255, 255, 0.8) !important; }

button.success-btn {
  background: linear-gradient(120deg, #3ae686 0%, #7fffc5 100%) !important;
  box-shadow: 0 4px 18px rgba(58, 230, 134, 0.4) !important;
}

button.success-btn:hover {
  background: linear-gradient(120deg, #2dd575 0%, #6eeeb4 100%) !important;
}

.remove-question-btn,
.delete-btn {
  background: linear-gradient(95deg, #ff5a80 17%, #ffc0c8 90%) !important;
  color: #fff !important;
  font-weight: 700;
  padding: 8px 16px;
  font-size: 0.95rem;
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(255, 90, 128, 0.4) !important;
}

.remove-question-btn:hover,
.delete-btn:hover {
  background: linear-gradient(95deg, #ef4568 17%, #ffb0b8 90%) !important;
}

/* ===================================
   DRAG & DROP ZONE
   =================================== */

.drag-drop-zone {
  border: 3px dashed rgba(107, 163, 255, 0.5);
  border-radius: 20px;
  padding: 50px 30px;
  text-align: center;
  background: rgba(255, 255, 255, 0.25);
  transition: all 0.3s ease;
  cursor: pointer;
  margin-bottom: 25px;
}

.drag-drop-zone:hover,
.drag-drop-zone.drag-over {
  border-color: #6ba3ff;
  background: rgba(107, 163, 255, 0.15);
  box-shadow: 0 0 30px rgba(107, 163, 255, 0.3);
}

.drag-drop-zone p {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 10px 0;
  color: #4a5a8a;
}

.drag-drop-zone .browse-btn {
  margin-top: 15px;
}

/* ===================================
   PROGRESS BARS
   =================================== */

.progress-bar-container {
  width: 100%;
  height: 28px;
  background: rgba(200, 210, 230, 0.4);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 10px 0;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6ba3ff 0%, #a98fff 100%);
  border-radius: 14px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.progress-bar.pass {
  background: linear-gradient(90deg, #3ae686 0%, #7fffc5 100%);
}

.progress-bar.fail {
  background: linear-gradient(90deg, #ff6575 0%, #ffaad2 100%);
}

/* ===================================
   STUDENT/TEACHER DASHBOARD CARDS
   =================================== */

.student-card {
  background: rgba(255, 255, 255, 0.45);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 4px 20px rgba(182, 202, 246, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.student-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 28px rgba(182, 202, 246, 0.4);
}

.student-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.student-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2e3651;
}

.student-score {
  font-size: 1.1rem;
  font-weight: 700;
}

.student-card-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.student-card.expanded .student-card-details {
  max-height: 500px !important;
  overflow-y: auto !important;
  padding-right: 10px !important;
  scrollbar-width: thin !important;
}

.student-card.expanded .student-card-details::-webkit-scrollbar {
  width: 6px !important;
}

.student-card.expanded .student-card-details::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.1) !important;
  border-radius: 3px !important;
}

.student-card.expanded .student-card-details::-webkit-scrollbar-thumb {
  background: rgba(107,163,255,0.5) !important;
  border-radius: 3px !important;
}

.student-card .expand-icon {
  transition: transform 0.3s ease;
}

.student-card.expanded .expand-icon {
  transform: rotate(180deg);
}

/* ===================================
   TOPIC CARDS
   =================================== */

.topic-card {
  background: rgba(255, 255, 255, 0.45);
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(182, 202, 246, 0.3);
  border-left: 5px solid;
}

.topic-card.priority-high {
  border-left-color: #ff6575;
}

.topic-card.priority-medium {
  border-left-color: #ffa500;
}

.topic-card.priority-low {
  border-left-color: #3ae686;
}

.topic-card h3 {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topic-stats {
  font-size: 0.95rem;
  color: #5a6789;
  margin: 8px 0;
}

/* ===================================
   MODAL OVERLAY & CUSTOM MODALS
   =================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(30px);
  border-radius: 24px;
  padding: 35px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.6);
  animation: slideUp 0.4s ease;
  position: relative;
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #2e3651;
}

.modal-content p {
  margin-bottom: 25px;
  color: #5a6789;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a6789;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.8);
  color: #2e3651;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 16px 24px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  border-left: 5px solid;
  min-width: 280px;
  animation: slideInRight 0.4s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast.success {
  border-left-color: #3ae686;
}

.toast.error {
  border-left-color: #ff6575;
}

.toast.info {
  border-left-color: #6ba3ff;
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-weight: 600;
  color: #2e3651;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===================================
   QUESTION REORDER BUTTONS
   =================================== */

.reorder-buttons {
  display: flex;
  gap: 6px;
}

.reorder-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.6) !important;
  border: 1.5px solid rgba(107, 163, 255, 0.4) !important;
  color: #6ba3ff !important;
}

.reorder-btn:hover {
  background: rgba(107, 163, 255, 0.2) !important;
  border-color: #6ba3ff !important;
}

.reorder-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(200, 200, 200, 0.3) !important;
}

/* ===================================
   VALIDATION WARNINGS
   =================================== */

.validation-warnings {
  background: rgba(255, 165, 0, 0.15);
  border-left: 4px solid #ffa500;
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 20px;
}

.validation-warnings h4 {
  color: #d97706;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.validation-warnings ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.validation-warnings li {
  color: #92400e;
  margin: 6px 0;
  padding-left: 20px;
  position: relative;
}

.validation-warnings li::before {
  content: "⚠";
  position: absolute;
  left: 0;
  color: #ffa500;
}

/* ===================================
   HEAT MAP (Question Performance)
   =================================== */

.heat-map {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.heat-map-item {
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 15px 10px;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.heat-map-item:hover {
  transform: translateY(-3px);
}

.heat-map-item.strong {
  background: linear-gradient(135deg, rgba(58, 230, 134, 0.3), rgba(127, 255, 197, 0.3));
  border: 2px solid #3ae686;
  color: #1a5d3a;
}

.heat-map-item.moderate {
  background: linear-gradient(135deg, rgba(255, 165, 0, 0.3), rgba(255, 200, 100, 0.3));
  border: 2px solid #ffa500;
  color: #92400e;
}

.heat-map-item.weak {
  background: linear-gradient(135deg, rgba(255, 101, 117, 0.3), rgba(255, 170, 210, 0.3));
  border: 2px solid #ff6575;
  color: #982232;
}

.heat-map-label {
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.heat-map-value {
  font-size: 1.3rem;
}

/* ===================================
   STICKY NOTES
   =================================== */

.note-card {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 15px;
  box-shadow: 0 4px 16px rgba(182, 202, 246, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
}

.note-card.teacher-note {
  background: rgba(243, 229, 255, 0.4);
  border-left: 4px solid #a98fff;
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: #5a6789;
  font-weight: 600;
}

.note-content {
  color: #2e3651;
  font-size: 1.05rem;
  line-height: 1.6;
  word-wrap: break-word;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  #app {
    max-width: 100%;
    min-height: 95vh;
  }

  .tab-nav {
    padding: 10px 12px;
    gap: 6px;
  }

  .tab-btn {
    font-size: 0.9rem;
    padding: 10px 14px;
  }

  button.danger-btn {
    font-size: 0.85rem;
    padding: 8px 14px;
  }

  .tab-content {
    padding: 20px 16px;
  }

  h2 {
    font-size: 1.6rem;
  }

  h3 {
    font-size: 1.2rem;
  }

  .question-item,
  .student-question-item {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .question-item input,
  .student-question-item input {
    width: 100%;
    margin-bottom: 10px;
  }

  .marks-entry {
    width: 100% !important;
    min-width: 100%;
  }

  .drag-drop-zone {
    padding: 30px 20px;
  }

  .drag-drop-zone p {
    font-size: 1rem;
  }

  .modal-overlay {
    align-items: flex-start; 
    padding: 20px;
    padding-top: 150px;  /* ← ADJUST THIS NUMBER */
    overflow-y: auto;
  }

  .modal-content {
    margin: 0 auto;
    max-height: 85vh;
    overflow-y: auto;
  }

  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  .heat-map {
    gap: 8px;
  }

  .heat-map-item {
    min-width: 70px;
    padding: 12px 8px;
  }

  button {
    width: 100%;
    margin-bottom: 10px;
  }

  .reorder-buttons {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .tab-btn {
    font-size: 0.85rem;
    padding: 8px 12px;
  }

  h2 {
    font-size: 1.4rem;
  }

  button.danger-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
  }

  .modal-content {
    padding: 20px;
  }
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.hidden {
  display: none !important;
}

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

.text-success {
  color: #3ae686;
}

.text-error {
  color: #ff6575;
}

.text-warning {
  color: #ffa500;
}

.mb-20 {
  margin-bottom: 20px;
}

.mt-20 {
  margin-top: 20px;
}

.flex-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.flex-row.space-between {
  justify-content: space-between;
}

/* Teacher Login Button States */
#teacher-login-btn {
  transition: all 0.3s ease;
  white-space: nowrap;
flex-shrink: 0;
}

#teacher-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(107, 163, 255, 0.4);
}

/* ===================================
   CUSTOM FILE INPUT STYLING
   =================================== */

/* Hide default file input */
input[type="file"] {
  display: none;
}

/* Custom file input button wrapper */
.file-input-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 15px;
}

.file-input-label {
  background: linear-gradient(120deg, #6ba3ff 0%, #a98fff 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 12px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 18px rgba(107, 163, 255, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.file-input-label:hover {
  background: linear-gradient(120deg, #5a92ee 0%, #9878ee 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(107, 163, 255, 0.6);
}

.file-input-label::before {
  content: "📁";
  font-size: 1.2rem;
}

.file-name-display {
  display: inline-block;
  margin-left: 12px;
  color: #5a6789;
  font-size: 0.95rem;
  font-style: italic;
}

.file-name-display.has-file {
  color: #2d3748;
  font-weight: 600;
  font-style: normal;
}

.guide-section {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 22px;
  box-shadow: 0 5px 32px rgba(182, 202, 246, 0.25),
              0 0 18px rgba(238, 232, 255, 0.5),
              inset 0 2px 15px rgba(255, 255, 255, 0.3);
  margin-bottom: 20px;
  padding: 20px 26px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
}

.guide-section:hover {
  box-shadow: 0 6px 40px rgba(97, 182, 236, 0.5),
              0 0 30px rgba(130, 200, 255, 0.6);
  border: 2px solid rgba(97, 182, 236, 0.8);
  transform: translateY(-3px);
}

.guide-section.active {
  box-shadow: 0 8px 50px rgba(97, 182, 236, 0.7),
              0 0 40px rgba(130, 200, 255, 0.8);
  border: 3px solid #61b6ec;
}

.guide-section ul li,
.guide-section ol li {
  margin-bottom: 12px;
}

/* Made with Love footer */
.made-with-love {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: #6a7aa5;
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  box-shadow: 0 3px 15px rgba(182, 202, 246, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  letter-spacing: 0.02em;
}

@media (max-width: 600px) {
  .question-item input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    flex: 1 1 100% !important;
  }
  
  .question-header {
    display: none !important;
  }
 .glass-section input[type="text"],
  .glass-section input[type="url"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    flex: 1 1 100% !important;
    margin-left: 0 !important;
  }
  
  .glass-section label {
    width: 100%;
    margin-bottom: 8px;
  }
}

.total-marks-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 600px) {
  .total-marks-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
  }
  .total-marks-row label,
  .total-marks-row input {
    margin-bottom: 0 !important;
    min-width: unset !important;
    width: auto !important;
    flex: 0 0 auto !important;
  }
  #total-marks-input {
    width: 80px !important;
    max-width: 100px !important;
    min-width: 70px !important;
    text-align: center;
  }
}

.qn-header-desktop { display: flex; }
.student-prompt-mobile { display: none; }

@media (max-width: 600px) {
  .qn-header-desktop { display: none !important; }
  .student-prompt-mobile { 
    display: block;
    margin: 0 0 14px 0;
    font-size: 1.09em;
    color: #434f8b;
    background:rgba(255,255,255,0.55);
    border-radius: 12px;
    padding: 13px 10px;
    text-align: center;
    font-weight:600;
    box-shadow:0 2px 7px #cac8f209;
  }
}
.marks-counter-container {
  text-align: center;
  padding: 12px;
  margin: 15px 0;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700; /* Already bold here */
  transition: all 0.3s ease;
}

.marks-indicator {
  padding: 8px 16px;
  border-radius: 8px;
  display: inline-block;
  transition: all 0.3s ease;
  font-weight: 700; /* Make text bold */
  text-align: center; /* Ensure centered */
}

/* ========================================
   HORIZONTAL SCROLL + INNER VERTICAL SCROLL
   FOR USAGE GUIDE (ALL DEVICES)
   ======================================== */

/* Horizontal scroll container for all breakpoints */
#usage-guide-container {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  gap: 0;
  position: relative;
  align-items: stretch;
  padding: 20px 0; /* Changed from 20px 10px - removes horizontal padding */
}


/* Each slide: full width, fixed max height, flex column */
#usage-guide-container .guide-section {
  min-width: 100%;
  max-width: 100%;
  scroll-snap-align: start;
  flex-shrink: 0;
  padding: 16px 20px;
  box-sizing: border-box;
  margin-bottom: 0 !important;
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  border-radius: 22px;
  position: relative;
  
  /* Combine subtle box-shadow + inset glow */
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.45),
              0 2px 12px rgba(220, 230, 250, 0.35),
              inset 0 1px 8px rgba(255, 255, 255, 0.35) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.7) !important;
  
  /* This helps shadows follow curves better */
  overflow: hidden;
}

/* Boost the mystical aura with stronger gradient */
#usage-guide-container .guide-section::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 28px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(245, 248, 255, 0.4) 25%,
    rgba(230, 240, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.1) 70%,
    transparent 100%
  );
  z-index: -1;
  pointer-events: none;
  filter: blur(8px);
}

/* Inner content scrolls vertically when too long */
#usage-guide-container .guide-section-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
}

/* Hide horizontal scrollbar */
#usage-guide-container::-webkit-scrollbar {
  display: none;
}
#usage-guide-container {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Dots at top */
.guide-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  border-radius: 12px;
}

.guide-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: 2px solid rgba(107, 163, 255, 0.5);
  transition: all 0.3s ease;
  cursor: pointer;
}

.guide-dot:hover {
  transform: scale(1.2);
}

.guide-dot.active {
  background: #6ba3ff;
  width: 12px;
  height: 12px;
  box-shadow: 0 0 10px rgba(107, 163, 255, 0.6);
}

/* ===== CAROUSEL ARROWS - SIDE-BY-SIDE BOTTOM RIGHT ===== */

#usage-guide-container .carousel-nav {
  position: fixed !important;
  bottom: 80px !important;
  right: 20px !important;
  left: auto !important;      
  width: 120px !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  pointer-events: none !important;
  z-index: 9999 !important; /* INCREASED z-index */
}

#usage-guide-container .carousel-arrow {
  width: 50px !important;
  height: 50px !important;
  background: rgba(255, 255, 255, 0.25) !important;
  backdrop-filter: blur(12px) !important;
  border: 2px solid rgba(107, 163, 255, 0.6) !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  pointer-events: all !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  
  /* FLICKER FIXES */
  will-change: transform, box-shadow !important;
  contain: layout style paint !important;
  transform: translateZ(0) !important;
  
  /* Optimized transitions */
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  animation: arrowPulse 2.5s ease-in-out infinite !important;
  box-shadow: 0 8px 32px rgba(107, 163, 255, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

/* Hover: Pause animation + smooth scale */
#usage-guide-container .carousel-arrow:hover {
  animation-play-state: paused !important;
  transform: scale(1.08) translateZ(0) !important;
  box-shadow: 0 12px 48px rgba(107, 163, 255, 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
}

#usage-guide-container .carousel-arrow path {
  stroke: #6ba3ff !important;
  stroke-width: 2.5 !important;
  stroke-linecap: round !important;
  transition: stroke 0.3s ease !important;
}

/* Glow + Pulse Animation (KEEP) */
@keyframes arrowPulse {
  0%, 100% { 
    box-shadow:
      0 8px 32px rgba(107, 163, 255, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.5);
  }
  50% { 
    box-shadow:
      0 12px 48px rgba(107, 163, 255, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.7);
  }
}

/* Left-Right Motion (KEEP) */
#usage-guide-container .carousel-arrow-left {
  animation: arrowLeftMotion 2.5s ease-in-out infinite !important;
}
#usage-guide-container .carousel-arrow-right {
  animation: arrowRightMotion 2.5s ease-in-out infinite !important;
}

@keyframes arrowLeftMotion {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
@keyframes arrowRightMotion {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(3px); }
  75% { transform: translateX(-3px); }
}


/* Safari Desktop Only - Fixed at red circle position */
@supports (-webkit-hyphens:none) {
  #usage-guide-container .carousel-nav {
    position: fixed !important;
    right: auto !important;
    left: calc(50% + 350px) !important;  /* Adjust 180px to match red circle */
    bottom: 130px !important;
    transform: none !important;
  }
}

/* MOBILE FIXED - FULLY VISIBLE */
@media (max-width: 768px) {
  #usage-guide-container .carousel-nav {
    position: fixed !important;
    bottom: 120px !important;  /* HIGHER - clears "Made with ❤️" */
    right: 16px !important;
    left: auto !important;
    width: 120px !important;
    height: 60px !important;
    z-index: 10001 !important;
    transform: translateZ(0) !important;
  }
  
  #usage-guide-container .carousel-arrow {
    width: 44px !important;
    height: 44px !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    /* Your glows/animations restored */
  }
}

/* Tablet/Desktop Hover Pause (KEEP) */
@media (min-width: 769px) {
  #usage-guide-container .carousel-arrow:hover {
    animation-play-state: paused !important;
  }
}

/* Hide Logic (ENHANCED) */
#usage-guide-container .carousel-arrow.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: scale(0.8) !important;
  pointer-events: none !important;
}

/* CLASS ANALYSIS SECTIONS */
.glass-section h3 {
  font-size: 1.2em;
  margin: 25px 0 12px 0;
  color: #6ba3ff;
  font-weight: 600;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
}

.glass-section h3 a {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-all;
  display: inline;
}


#reflections-container .reflections-grid {
  display: grid !important;
  gap: 2.5rem !important;  /* FIXED gap between R1-R2 */
  padding: 1rem 0;
}

.reflection-pair {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.reflection-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #6ba3ff;
}

.reflection-textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  padding: 0.75rem;
 border: 2px solid rgba(107, 163, 255, 0.4) !important;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  font-family: inherit;
  font-size: 1rem;
  color: #333;
}

.reflection-textarea:focus {
  outline: none;
border-color: #6ba3ff !important;
  box-shadow: 0 0 0 3px rgba(107, 163, 255, 0.1);
}

/* Responsive: Mobile stacks Q/Ans vertically */
@media (max-width: 768px) {
  .reflection-pair {
    padding: 1rem;
  }
  .reflections-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Tablet: 2 pairs side-by-side */
@media (min-width: 769px) and (max-width: 1024px) {
  .reflections-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Desktop: 2-3 pairs */
@media (min-width: 1025px) {
  .reflections-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
  }
}

/* Student Import Reflections - Force Gap */
.student-import-reflections.reflections-grid {
  display: grid !important;
  gap: 2.5rem !important;
  grid-template-columns: 1fr !important;
}

.student-import-reflections .reflection-pair {
  margin-bottom: 0 !important;
}

.circle-checkbox {
  appearance: none;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  border: 2px solid #6ba3ff;
  border-radius: 50%;
  background: transparent;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;  /* Prevents squeezing */
  margin-right: 8px;
}

.circle-checkbox:checked {
  background: #6ba3ff;
}

.circle-checkbox:checked::after {
  content: '✔';
  color: white;
  font-size: 11px;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.circle-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(107, 163, 255, 0.2);
}

/* Mobile: Extra protection */
@media (max-width: 768px) {
  .circle-checkbox {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
  }
}

.reflection-btn {
  background: rgba(107, 163, 255, 0.15) !important;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(107, 163, 255, 0.3);
  color: #6ba3ff !important;
  margin-top: 8px;
  border-radius: 25px;
  padding: 8px 16px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.reflection-btn:hover {
  background: rgba(107, 163, 255, 0.25) !important;
  transform: translateY(-1px);
}

/* Arrow shows DOWN by default */
.reflection-btn::after {
  content: ' ▼';
}

/* Arrow shows UP when reflections are open */
.student-card.reflections-open .reflection-btn::after {
  content: ' ▲';
}

/* Hide reflections by default */
.reflection-dropdown-content {
  display: none;
  margin-top: 15px !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

/* Show reflections when toggled open */
.student-card.reflections-open .reflection-dropdown-content {
  display: block;
  animation: slideDown 0.3s ease;
}

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


/* FIXED: No flicker + MOBILE BACKGROUND RESTORED */
html, body {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  /* ENSURE BACKGROUND RENDERS IN NEW STACKING CONTEXT */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  min-height: 100vh !important;
}

/* Disable backdrop-filter during scroll (anti-flicker) */
html.scrolling *,
body.scrolling * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* BASE: No backdrop-filter flicker globally */
* {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* GLASSMORPHISM ONLY WHERE NEEDED */
.modal-overlay,
.modal-content,
.toast,
#toast-container,
#header,
#top-bar,
.tab-buttons,
#app {  /* ADD #app BACK */
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
}

/* Rest of your modal centering code stays exactly the same... */
.modal-overlay.active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10000 !important;
  overflow: hidden !important;
}

body.modal-open {
  overflow: hidden !important;
  height: 100vh !important;
}

.modal-content {
  margin: 20px !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
}

/* ===================================
   PERFECT FIX: Template Setup Modal - Desktop/Tablet
   =================================== */
@media (min-width: 769px) {
  /* Template Setup tab + modal shown */
  body:has(.tab-btn[data-tab="teacher-setup"].active) #modal-overlay.active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: transparent !important;
    backdrop-filter: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10000 !important;
    /* CRITICAL: Isolate from scroll context */
    transform: translateZ(0) !important;
  }
  
  /* Match EXACT "correct" modal sizing */
  body:has(.tab-btn[data-tab="teacher-setup"].active) #modal-overlay.active .modal-content {
    position: relative !important;
    margin: 0 !important;
    max-width: 500px !important;
    width: 90% !important;
    max-height: 80vh !important;
    padding: 35px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(30px) !important;
    border-radius: 24px !important;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3) !important;
    border: 2px solid rgba(255, 255, 255, 0.6) !important;
    animation: slideUp 0.4s ease !important;
  }
}

/* ===================================
   MOBILE: Perfect modal centering (Desktop/Tablet unaffected)
   =================================== */
@media (max-width: 768px) {
  .modal-overlay.active {
    align-items: center !important;        /* ← Center vertically */
    padding: 20px !important;              /* ← Safe padding */
    padding-top: 40px !important;          /* ← Minimal top offset */
    overflow-y: auto !important;
  }
  
  .modal-content {
    margin: 0 auto !important;             /* ← Perfect horizontal center */
    max-height: 85vh !important;
  }
}

#reset-custom-btn {
  margin-right: 10px;
}

/* Mobile: Full width like other buttons */
@media (max-width: 768px) {
  #reset-custom-btn {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
  }
}

/* ========================================
   USAGE GUIDE SCROLLBAR FIX - TRANSLUCENT
   ======================================== */

/* Webkit browsers */
#usage-guide-container .guide-section-body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#usage-guide-container .guide-section-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

#usage-guide-container .guide-section-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#usage-guide-container .guide-section-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.6);
}

/* Firefox */
#usage-guide-container .guide-section-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.4) rgba(255, 255, 255, 0.1);
}

/* Override global scroll class */
#usage-guide-container .guide-section-body.scrolling::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.4) !important;
}

/* ========================================
   STORAGE INDICATOR - FLAT TRANSLUCENT DESIGN
   ======================================== */

.template-controls-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.template-controls-wrapper .flex-row {
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
}

.template-controls-wrapper .flex-row button {
  flex: 1;
  min-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.storage-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #5a4a9f; /* Dark purple text */
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  
  /* Slightly more visible translucent background */
  background: rgba(102, 126, 234, 0.18);
  
  /* Light blue-purple border */
  border: 2px solid rgba(200, 220, 255, 0.65);
  box-shadow: 
    0 0 20px rgba(200, 220, 255, 0.4),
    0 0 35px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  
  transition: all 0.3s ease;
  overflow: hidden;
}

/* Animated blue-purple border glow */
.storage-indicator::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 22px;
  background: linear-gradient(45deg, 
    rgba(200, 220, 255, 0.8),
    rgba(150, 180, 255, 0.5),
    rgba(200, 220, 255, 0.8));
  background-size: 300% 300%;
  animation: gradientShift 4s ease infinite;
  z-index: -1;
  opacity: 0.9;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Subtle flat hover */
.storage-indicator:hover {
  background: rgba(102, 126, 234, 0.25);
  border-color: rgba(200, 220, 255, 0.8);
  box-shadow: 
    0 0 25px rgba(200, 220, 255, 0.6),
    0 0 45px rgba(255, 255, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Circle progress indicator */
.storage-progress-circle {
  flex-shrink: 0;
}

.progress-bg {
  stroke: rgba(90, 74, 159, 0.3); /* Dark purple background ring */
}

.progress-fill {
  transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
  stroke: #5a4a9f; /* Dark purple fill */
  stroke-width: 3; /* Thicker for visibility */
}

.storage-text {
  letter-spacing: 0.3px;
  white-space: nowrap;
}

#storage-percent {
  font-weight: 700;
  font-size: 1.05em;
}

/* Warning state (80%+) */
.storage-indicator.warning {
  color: #8b5fbf;
  background: rgba(240, 147, 251, 0.22);
  border-color: rgba(255, 200, 255, 0.7);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
}

.storage-indicator.warning::before {
  background: linear-gradient(45deg, 
    rgba(255, 200, 255, 0.8),
    rgba(255, 147, 251, 0.5));
}

.storage-indicator.warning .progress-bg {
  stroke: rgba(139, 95, 191, 0.4);
}

.storage-indicator.warning .progress-fill {
  stroke: #ffeb3b;
}

/* Critical state (95%+) */
.storage-indicator.critical {
  color: #c8518f;
  background: rgba(250, 112, 154, 0.25);
  border-color: rgba(255, 180, 120, 0.75);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
  animation: criticalPulse 1.5s ease-in-out infinite;
}

.storage-indicator.critical::before {
  background: linear-gradient(45deg, 
    rgba(255, 180, 120, 0.8),
    rgba(254, 225, 64, 0.5));
}

.storage-indicator.critical .progress-bg {
  stroke: rgba(200, 81, 143, 0.4);
}

.storage-indicator.critical .progress-fill {
  stroke: #ff9800;
}

@keyframes criticalPulse {
  0%, 100% { 
    box-shadow: 
      0 0 20px rgba(200, 220, 255, 0.4),
      0 0 35px rgba(255, 255, 255, 0.2); 
  }
  50% { 
    box-shadow: 
      0 0 30px rgba(200, 220, 255, 0.7),
      0 0 55px rgba(255, 255, 255, 0.4); 
  }
}

/* Responsive: Mobile layout */
@media (max-width: 768px) {
  .template-controls-wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  
  .flex-row {
    flex-direction: column;
  }
  
  .storage-indicator {
    justify-content: center;
    width: 100%;
    margin-top: 10px;
  }
}

.modal-content {
  max-height: 80svh;  /* Small viewport - safer for keyboard */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#modal-overlay.active {
  height: 100lvh !important;  /* Large viewport = TALLER than dvh */
  padding-top: env(safe-area-inset-top) !important;
  padding-bottom: env(safe-area-inset-bottom) !important;
  box-sizing: border-box !important;
}

#modal-overlay.active::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100lvh;  /* Matches overlay - covers scroll */
  background: rgba(0, 0, 0, 0.4) !important;  /* Less dark (0.4 vs 0.6) */
  z-index: -1;
}
