/* ==================== Google Fonts ==================== */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

/* ==================== CSS Variables ==================== */
:root {
  --gold-primary: #d4a847;
  --gold-light: #f0d77a;
  --gold-dark: #b8860b;
  --bg-dark: #1a1a2e;
  --bg-darker: #0f0f1a;
  --bg-card: #252540;
  --text-light: #f0ebe4;
  --text-muted: #a0a0a0;
  
  /* House Colors */
  --gryffindor-primary: #740001;
  --gryffindor-secondary: #ae0001;
  --gryffindor-accent: #d3a625;
  
  --hufflepuff-primary: #ecb939;
  --hufflepuff-secondary: #f0c75e;
  --hufflepuff-accent: #372e29;
  
  --ravenclaw-primary: #0e1a40;
  --ravenclaw-secondary: #222f5b;
  --ravenclaw-accent: #946b2d;
  
  --slytherin-primary: #1a472a;
  --slytherin-secondary: #2a623d;
  --slytherin-accent: #aaaaaa;
}

/* ==================== Animated Background ==================== */
@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(212, 168, 71, 0.3); }
  50% { box-shadow: 0 0 40px rgba(212, 168, 71, 0.6); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

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

/* ==================== General Styles ==================== */
body {
  font-family: 'Crimson Text', 'Garamond', serif;
  background: linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-dark) 50%, #16213e 100%);
  color: var(--text-light);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Starfield effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #fff, transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 90px 40px, #fff, transparent),
    radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 230px 80px, #fff, transparent),
    radial-gradient(2px 2px at 300px 150px, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 370px 60px, #fff, transparent),
    radial-gradient(2px 2px at 450px 200px, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 520px 90px, #fff, transparent),
    radial-gradient(2px 2px at 600px 170px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 680px 40px, #fff, transparent),
    radial-gradient(2px 2px at 750px 130px, rgba(255,255,255,0.6), transparent);
  background-repeat: repeat;
  background-size: 800px 250px;
  animation: twinkle 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  padding: 50px 20px;
  position: relative;
  z-index: 1;
}

h1 {
  font-family: 'Cinzel', serif;
  color: var(--gold-primary);
  margin-top: 20px;
  font-size: 2.2em;
  text-shadow: 0 0 30px rgba(212, 168, 71, 0.5), 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 2px;
}

h2 {
  font-family: 'Cinzel', serif;
  letter-spacing: 1px;
}

label {
  display: block;
  margin: 15px 0 5px;
  color: var(--text-light);
  font-weight: 600;
}

input,
select {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px;
  font-family: 'Crimson Text', serif;
  background-color: rgba(37, 37, 64, 0.8);
  color: var(--text-light);
  border: 2px solid rgba(212, 168, 71, 0.3);
  border-radius: 8px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 15px rgba(212, 168, 71, 0.3);
  background-color: rgba(37, 37, 64, 1);
}

button {
  margin-top: 20px;
  padding: 12px 30px;
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
  color: var(--bg-darker);
  font-size: 18px;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

button:hover::before {
  left: 100%;
}

button:hover {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(212, 168, 71, 0.4);
}

button:active {
  transform: translateY(0);
}

/* Sorting Hat Image */
.sorting-hat-image {
  width: 200px;
  height: auto;
  margin-bottom: 15px;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
  transition: transform 0.3s ease;
}

.sorting-hat-image:hover {
  transform: scale(1.05);
}

/* House Crest Image */
.house-crest {
  width: 200px;
  height: auto;
  margin-top: 20px;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: fadeInUp 0.8s ease-out;
}

/* Sorting Result */
#sorting-result {
  margin-top: 30px;
  font-size: 1.3em;
  color: var(--gold-primary);
  animation: fadeInUp 0.6s ease-out;
}

/* Thinking message and response text */
#sorting-result p {
  font-size: 1.3em;
  line-height: 1.6;
  margin-top: 20px;
}

.sorting-message {
  margin: 25px auto;
  font-size: 1.8em;
  line-height: 2;
  text-align: center;
  max-width: 700px;
  font-style: italic;
  padding: 20px 30px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border-left: 4px solid var(--gold-primary);
  border-right: 4px solid var(--gold-primary);
}

.sorting-message p {
  margin: 10px 0;
  padding: 0 20px;
  white-space: pre-line;
}

/* Decorative Divider */
.divider {
  width: 200px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
  margin: 30px auto;
}

/* Mobile Responsiveness */
@media (max-width: 800px) {
  .container {
    padding: 20px 15px;
    max-width: 95%;
  }

  h1 {
    font-size: 1.6em;
  }

  .house-crest {
    width: 180px;
  }

  .sorting-hat-image {
    width: 150px;
  }

  #sorting-result,
  #sorting-result p {
    font-size: 1.1em;
  }

  .sorting-message {
    max-width: 95%;
    font-size: 1.2em;
    padding: 15px 20px;
  }
}

/* ==================== Login & Auth Styles ==================== */

.subtitle {
  color: var(--text-muted);
  margin-bottom: 30px;
  font-size: 1.1em;
}

.auth-form {
  max-width: 400px;
  margin: 0 auto;
  text-align: left;
  background: rgba(37, 37, 64, 0.6);
  padding: 30px;
  border-radius: 16px;
  border: 1px solid rgba(212, 168, 71, 0.2);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--gold-primary);
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.95em;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  background-color: rgba(15, 15, 26, 0.8);
  color: var(--text-light);
  border: 2px solid rgba(212, 168, 71, 0.2);
  border-radius: 8px;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

.form-group input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 20px rgba(212, 168, 71, 0.2);
  outline: none;
}

.form-group .hint {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.85em;
}

.error-message {
  background: linear-gradient(135deg, rgba(92, 42, 42, 0.9) 0%, rgba(120, 50, 50, 0.9) 100%);
  color: #ff9999;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  border: 1px solid rgba(255, 100, 100, 0.3);
}

.success-message {
  background: linear-gradient(135deg, rgba(42, 92, 42, 0.9) 0%, rgba(50, 120, 50, 0.9) 100%);
  color: #99ff99;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  border: 1px solid rgba(100, 255, 100, 0.3);
}

.info-message {
  background: linear-gradient(135deg, rgba(42, 74, 92, 0.9) 0%, rgba(50, 90, 120, 0.9) 100%);
  color: #99ccff;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  border: 1px solid rgba(100, 180, 255, 0.3);
}

.forgot-password-link,
.back-to-login {
  text-align: center;
  margin-top: 20px;
}

.forgot-password-link a,
.back-to-login a {
  color: var(--gold-primary);
  text-decoration: none;
  transition: all 0.3s ease;
}

.forgot-password-link a:hover,
.back-to-login a:hover {
  color: var(--gold-light);
  text-shadow: 0 0 10px rgba(212, 168, 71, 0.5);
}

.auth-form button {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  margin-top: 15px;
}

.auth-form button:disabled {
  background: linear-gradient(135deg, #666 0%, #555 100%);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==================== Navigation & Header ==================== */

.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 25px;
  background: linear-gradient(180deg, rgba(15, 15, 26, 0.98) 0%, rgba(26, 26, 46, 0.95) 100%);
  border-bottom: 3px solid var(--gold-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 100;
}

.nav-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-light), var(--gold-primary), var(--gold-light), transparent);
}

.nav-header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-header .logo img {
  height: 45px;
  filter: drop-shadow(0 2px 8px rgba(212, 168, 71, 0.3));
}

.nav-header .logo span {
  color: var(--gold-primary);
  font-family: 'Cinzel', serif;
  font-size: 1.3em;
  font-weight: 600;
  text-shadow: 0 0 20px rgba(212, 168, 71, 0.3);
}

.nav-header .user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-header .user-email {
  color: var(--text-muted);
  font-size: 0.9em;
}

.nav-header .logout-btn {
  background: transparent;
  border: 2px solid var(--gold-primary);
  color: var(--gold-primary);
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 0;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.nav-header .logout-btn:hover {
  background: var(--gold-primary);
  color: var(--bg-darker);
  box-shadow: 0 0 15px rgba(212, 168, 71, 0.4);
}

/* ==================== View Toggle ==================== */

.view-toggle {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 30px;
  background: rgba(37, 37, 64, 0.6);
  border-radius: 12px;
  padding: 5px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid rgba(212, 168, 71, 0.2);
}

.view-toggle button {
  padding: 12px 30px;
  font-size: 15px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 0;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.view-toggle button.active {
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
  color: var(--bg-darker);
  box-shadow: 0 4px 15px rgba(212, 168, 71, 0.3);
}

.view-toggle button:hover:not(.active) {
  color: var(--gold-primary);
  background: rgba(212, 168, 71, 0.1);
}

/* ==================== Admin Dashboard ==================== */

.admin-section {
  margin-top: 35px;
  text-align: left;
  background: rgba(37, 37, 64, 0.5);
  padding: 25px;
  border-radius: 16px;
  border: 1px solid rgba(212, 168, 71, 0.15);
  backdrop-filter: blur(5px);
}

.admin-section h2 {
  font-family: 'Cinzel', serif;
  color: var(--gold-primary);
  border-bottom: 2px solid rgba(212, 168, 71, 0.3);
  padding-bottom: 12px;
  margin-bottom: 20px;
  margin-top: 0;
  font-size: 1.3em;
  text-shadow: 0 0 20px rgba(212, 168, 71, 0.2);
}

.student-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid rgba(212, 168, 71, 0.2);
  border-radius: 12px;
  background: rgba(15, 15, 26, 0.5);
}

.student-list::-webkit-scrollbar {
  width: 8px;
}

.student-list::-webkit-scrollbar-track {
  background: rgba(15, 15, 26, 0.5);
  border-radius: 4px;
}

.student-list::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 4px;
}

.student-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 18px;
  border-bottom: 1px solid rgba(212, 168, 71, 0.1);
  transition: all 0.3s ease;
}

.student-item:last-child {
  border-bottom: none;
}

.student-item:hover {
  background: rgba(212, 168, 71, 0.08);
}

.student-item .name {
  font-size: 1.1em;
  font-weight: 600;
}

.student-item .house {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.student-item .house.gryffindor { 
  background: linear-gradient(135deg, var(--gryffindor-primary) 0%, var(--gryffindor-secondary) 100%); 
  color: var(--gryffindor-accent);
  box-shadow: 0 2px 10px rgba(116, 0, 1, 0.4);
}
.student-item .house.hufflepuff { 
  background: linear-gradient(135deg, var(--hufflepuff-primary) 0%, var(--hufflepuff-secondary) 100%); 
  color: var(--hufflepuff-accent);
  box-shadow: 0 2px 10px rgba(236, 185, 57, 0.4);
}
.student-item .house.ravenclaw { 
  background: linear-gradient(135deg, var(--ravenclaw-primary) 0%, var(--ravenclaw-secondary) 100%); 
  color: var(--ravenclaw-accent);
  box-shadow: 0 2px 10px rgba(14, 26, 64, 0.4);
}
.student-item .house.slytherin { 
  background: linear-gradient(135deg, var(--slytherin-primary) 0%, var(--slytherin-secondary) 100%); 
  color: var(--slytherin-accent);
  box-shadow: 0 2px 10px rgba(26, 71, 42, 0.4);
}

.student-item .actions {
  display: flex;
  gap: 10px;
}

.student-item .actions button {
  padding: 8px 14px;
  font-size: 12px;
  margin-top: 0;
  border-radius: 6px;
}

.btn-edit {
  background: linear-gradient(135deg, #4a6fa5 0%, #3a5f95 100%);
}

.btn-delete {
  background: linear-gradient(135deg, #8b3a3a 0%, #7b2a2a 100%);
}

.btn-sort {
  background: linear-gradient(135deg, #4a8b4a 0%, #3a7b3a 100%);
}

/* CSV Upload Section */
.csv-instructions {
  color: #b0b0b0;
  margin-bottom: 10px;
  font-size: 0.95em;
  line-height: 1.6;
}

.csv-hint {
  color: #888;
  font-size: 0.85em;
  font-style: italic;
  margin-bottom: 15px;
}

.template-link {
  color: var(--gold-primary);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-block;
  margin-top: 6px;
}

.template-link:hover {
  color: var(--gold-light);
  text-shadow: 0 0 10px rgba(212, 168, 71, 0.4);
}

/* ==================== Ceremony View ==================== */

.ceremony-view {
  padding: 40px 20px;
}

.ceremony-view .student-select {
  margin-bottom: 30px;
}

.ceremony-view .student-select label {
  font-size: 1.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.ceremony-view select {
  width: 100%;
  max-width: 400px;
  padding: 16px 20px;
  font-size: 18px;
  font-family: 'Crimson Text', serif;
  background: rgba(37, 37, 64, 0.8);
  color: var(--text-light);
  border: 2px solid var(--gold-primary);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23d4a847' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 50px;
}

.ceremony-view select:hover {
  box-shadow: 0 0 20px rgba(212, 168, 71, 0.3);
}

.ceremony-view select:focus {
  outline: none;
  box-shadow: 0 0 25px rgba(212, 168, 71, 0.4);
}

.ceremony-view .sort-btn {
  padding: 18px 60px;
  font-size: 22px;
  animation: pulse-glow 3s ease-in-out infinite;
}

.ceremony-view .sort-btn:disabled {
  animation: none;
  background: linear-gradient(135deg, #555 0%, #444 100%);
  box-shadow: none;
}

/* ==================== Empty State ==================== */

.empty-state {
  text-align: center;
  padding: 50px;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 20px;
  font-size: 1.1em;
}

/* ==================== Student Cards ==================== */

.student-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid rgba(212, 168, 71, 0.1);
  transition: all 0.3s ease;
}

.student-card:hover {
  background: rgba(212, 168, 71, 0.08);
}

.student-card:last-child {
  border-bottom: none;
}

.student-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.student-name {
  font-size: 1.5em;
  font-weight: bold;
  color: var(--text-light);
}

.student-house {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 1em;
  font-weight: bold;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.student-house.house-gryffindor { 
  background: linear-gradient(135deg, var(--gryffindor-primary) 0%, var(--gryffindor-secondary) 100%); 
  color: var(--gryffindor-accent);
}
.student-house.house-hufflepuff { 
  background: linear-gradient(135deg, var(--hufflepuff-primary) 0%, var(--hufflepuff-secondary) 100%); 
  color: var(--hufflepuff-accent);
}
.student-house.house-ravenclaw { 
  background: linear-gradient(135deg, var(--ravenclaw-primary) 0%, var(--ravenclaw-secondary) 100%); 
  color: var(--ravenclaw-accent);
}
.student-house.house-slytherin { 
  background: linear-gradient(135deg, var(--slytherin-primary) 0%, var(--slytherin-secondary) 100%); 
  color: var(--slytherin-accent);
}

.student-actions {
  display: flex;
  gap: 10px;
}

.student-actions button {
  padding: 8px 16px;
  font-size: 13px;
  margin-top: 0;
  border-radius: 6px;
}

.edit-btn {
  background: linear-gradient(135deg, #4a6fa5 0%, #3a5f95 100%);
  color: white;
}

.edit-btn:hover {
  background: linear-gradient(135deg, #5a7fb5 0%, #4a6fa5 100%);
}

.delete-btn {
  background: linear-gradient(135deg, #8b3a3a 0%, #7b2a2a 100%);
  color: white;
}

.delete-btn:hover {
  background: linear-gradient(135deg, #9b4a4a 0%, #8b3a3a 100%);
}

/* ==================== Modal ==================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
  animation: fadeInUp 0.3s ease-out;
}

.modal-content {
  background: linear-gradient(180deg, rgba(37, 37, 64, 0.98) 0%, rgba(26, 26, 46, 0.98) 100%);
  padding: 35px;
  border-radius: 16px;
  border: 2px solid var(--gold-primary);
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(212, 168, 71, 0.15);
}

.modal-content h2 {
  font-family: 'Cinzel', serif;
  color: var(--gold-primary);
  margin-top: 0;
  margin-bottom: 25px;
  text-shadow: 0 0 20px rgba(212, 168, 71, 0.3);
}

.modal-content .auth-form {
  background: transparent;
  padding: 0;
  border: none;
  box-shadow: none;
}

/* ==================== House Result Display ==================== */

.house-result {
  padding: 40px;
  border-radius: 16px;
  margin-top: 25px;
  animation: fadeInUp 0.8s ease-out;
  position: relative;
  overflow: hidden;
}

.house-result::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  animation: shimmer 3s linear infinite;
  pointer-events: none;
}

.house-result.house-gryffindor {
  background: linear-gradient(135deg, var(--gryffindor-primary) 0%, var(--gryffindor-secondary) 50%, #5c0000 100%);
  border: 4px solid var(--gryffindor-accent);
  box-shadow: 0 10px 40px rgba(116, 0, 1, 0.5), inset 0 0 60px rgba(211, 166, 37, 0.1);
}

.house-result.house-hufflepuff {
  background: linear-gradient(135deg, var(--hufflepuff-primary) 0%, var(--hufflepuff-secondary) 50%, #d4a82a 100%);
  border: 4px solid var(--hufflepuff-accent);
  box-shadow: 0 10px 40px rgba(236, 185, 57, 0.4), inset 0 0 60px rgba(55, 46, 41, 0.1);
}

.house-result.house-hufflepuff h2,
.house-result.house-hufflepuff .sorting-message {
  color: var(--hufflepuff-accent);
}

.house-result.house-ravenclaw {
  background: linear-gradient(135deg, var(--ravenclaw-primary) 0%, var(--ravenclaw-secondary) 50%, #0a1330 100%);
  border: 4px solid var(--ravenclaw-accent);
  box-shadow: 0 10px 40px rgba(14, 26, 64, 0.5), inset 0 0 60px rgba(148, 107, 45, 0.1);
}

.house-result.house-slytherin {
  background: linear-gradient(135deg, var(--slytherin-primary) 0%, var(--slytherin-secondary) 50%, #0f2a18 100%);
  border: 4px solid var(--slytherin-accent);
  box-shadow: 0 10px 40px rgba(26, 71, 42, 0.5), inset 0 0 60px rgba(170, 170, 170, 0.05);
}

.house-result h2 {
  font-family: 'Cinzel', serif;
  font-size: 2.8em;
  margin: 20px 0;
  text-shadow: 0 0 30px currentColor, 0 4px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 4px;
  animation: pulse-glow 2s ease-in-out infinite;
}

.house-result .house-crest {
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  border: 3px solid rgba(255, 255, 255, 0.2);
}

/* ==================== CSV Status ==================== */

#csv-status.success {
  color: #4ade80;
  font-weight: 600;
}

#csv-status.error {
  color: #f87171;
  font-weight: 600;
}

/* ==================== Loading/Thinking Animation ==================== */

.thinking {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 30px;
  font-size: 1.2em;
  color: var(--gold-primary);
  font-style: italic;
}

.thinking::after {
  content: '...';
  animation: ellipsis 1.5s infinite;
}

@keyframes ellipsis {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Sorting hat thinking animation */
.sorting-hat-thinking {
  animation: float 1s ease-in-out infinite, pulse-glow 1s ease-in-out infinite;
}

/* ==================== Responsive Adjustments ==================== */

@media (max-width: 600px) {
  .nav-header {
    flex-direction: column;
    gap: 12px;
    padding: 15px;
  }

  .nav-header .logo span {
    font-size: 1.1em;
  }

  .view-toggle {
    flex-direction: column;
    width: 100%;
  }

  .view-toggle button {
    width: 100%;
  }

  .student-card {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  .student-actions {
    width: 100%;
  }

  .student-actions button {
    flex: 1;
  }

  .modal-content {
    padding: 25px;
    margin: 15px;
  }

  .admin-section {
    padding: 20px;
  }

  .auth-form {
    padding: 25px;
  }

  .house-result {
    padding: 25px;
  }

  .house-result h2 {
    font-size: 2em;
    letter-spacing: 2px;
  }

  .ceremony-view .sort-btn {
    padding: 15px 40px;
    font-size: 18px;
  }
}

/* ==================== Additional Polish ==================== */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection styling */
::selection {
  background: var(--gold-primary);
  color: var(--bg-darker);
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
}

/* Disabled state improvements */
button:disabled,
input:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==================== Club Selector ==================== */
.club-selector-wrapper {
  display: flex;
  align-items: center;
}

.club-name-static {
  color: var(--gold-primary);
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid var(--gold-dark);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.club-selector {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--gold-dark);
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 4px;
  font-family: 'Cinzel', serif;
  font-size: 14px;
  cursor: pointer;
  min-width: 150px;
  max-width: 250px;
}

.club-selector:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--gold-primary);
}

.club-selector option {
  background: var(--bg-dark);
  color: var(--text-light);
}

/* ==================== Coming Soon Message ==================== */
.coming-soon-message {
  background: rgba(37, 37, 64, 0.8);
  border: 2px solid var(--gold-dark);
  border-radius: 16px;
  padding: 50px 60px;
  margin: 50px auto;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.coming-soon-message .coming-soon-icon {
  font-size: 4em;
  margin-bottom: 20px;
}

.coming-soon-message h2 {
  color: var(--gold-primary);
  font-family: 'Cinzel', serif;
  font-size: 2em;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(212, 168, 71, 0.4);
}

.coming-soon-message p {
  margin: 10px 0;
  font-size: 1.1em;
  color: var(--text-muted);
}

/* ==================== User Role Badge ==================== */
.user-role-badge {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  color: var(--bg-darker);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 10px;
}

.user-role-badge.super-admin {
  background: linear-gradient(135deg, #8b0000, #dc143c);
  color: white;
}

.user-role-badge.school-admin {
  background: linear-gradient(135deg, #1a472a, #2a623d);
  color: white;
}

.user-role-badge.club-leader {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  color: var(--bg-darker);
}

/* ==================== Super Admin Panel ==================== */
#super-admin-view h1 {
  font-family: 'Cinzel', serif;
  color: var(--gold-primary);
  text-align: center;
  margin-bottom: 30px;
}

.admin-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.admin-tab {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--gold-dark);
  color: var(--text-light);
  font-family: 'Cinzel', serif;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 4px;
}

.admin-tab:hover {
  background: rgba(212, 168, 71, 0.1);
  border-color: var(--gold-primary);
}

.admin-tab.active {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  color: var(--bg-darker);
  font-weight: 600;
}

.admin-panel {
  animation: fadeInUp 0.3s ease-out;
}

/* ==================== Form Rows ==================== */
.form-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 150px;
}

.form-row .form-group.full-width {
  flex: 100%;
}

.form-group small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 5px;
}

/* ==================== Entity List (Schools, Clubs, Users) ==================== */
.entity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entity-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 168, 71, 0.3);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.entity-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gold-primary);
}

.entity-info {
  flex: 1;
}

.entity-name {
  font-family: 'Cinzel', serif;
  font-size: 1.1em;
  color: var(--gold-light);
  margin-bottom: 4px;
}

.entity-meta {
  color: var(--text-muted);
  font-size: 0.9em;
}

.entity-meta span {
  margin-right: 15px;
}

.entity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 10px;
}

.entity-badge.role-super_admin {
  background: rgba(139, 0, 0, 0.3);
  color: #ff6b6b;
  border: 1px solid #8b0000;
}

.entity-badge.role-school_admin {
  background: rgba(26, 71, 42, 0.3);
  color: #6bcf6b;
  border: 1px solid #1a472a;
}

.entity-badge.role-club_leader {
  background: rgba(212, 168, 71, 0.2);
  color: var(--gold-light);
  border: 1px solid var(--gold-dark);
}

.entity-badge.type-harry-potter {
  background: rgba(116, 0, 1, 0.3);
  color: #ff9999;
  border: 1px solid var(--gryffindor-primary);
}

.entity-badge.type-dnd {
  background: rgba(139, 69, 19, 0.3);
  color: #daa520;
  border: 1px solid #8b4513;
}

.entity-badge.type-chess {
  background: rgba(100, 100, 100, 0.3);
  color: #ccc;
  border: 1px solid #666;
}

.entity-actions {
  display: flex;
  gap: 8px;
}

.entity-actions button {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 4px;
}

/* ==================== Stats Cards ==================== */
.stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 120px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 168, 71, 0.3);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-family: 'Cinzel', serif;
  font-size: 2em;
  color: var(--gold-primary);
  margin-bottom: 5px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.9em;
}

/* ==================== Multi-select styling ==================== */
select[multiple] {
  min-height: 100px;
  padding: 8px;
}

select[multiple] option {
  padding: 6px 10px;
  margin: 2px 0;
  border-radius: 4px;
}

select[multiple] option:checked {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  color: var(--bg-darker);
}

/* ==================== Responsive Super Admin ==================== */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
  }
  
  .form-row .form-group {
    min-width: 100%;
  }
  
  .entity-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .entity-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .admin-tabs {
    flex-direction: column;
    align-items: stretch;
  }
  
  .admin-tab {
    text-align: center;
  }
  
  .nav-center {
    display: none;
  }
}