:root {
  --bg: #0f111a;
  --card-bg: #151821;
  --text-main: #ffffff;
  --text-sub: rgba(255, 255, 255, 0.6);
  --input-bg: rgba(255, 255, 255, 0.03);
  --input-border: rgba(255, 255, 255, 0.1);
  
  --student-color: #2563eb;
  --admin-color: #7c3aed;
  --current-color: var(--student-color);
}

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

body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.auth-container {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header h1 {
  font-family: 'Syne', sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-sub);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* Role Toggle */
.role-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin-bottom: 24px;
  padding: 4px;
  gap: 4px;
}

.role-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-sub);
  padding: 10px;
  border-radius: 8px;
  font-weight: 600;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 42px;
}

.role-btn.active[data-role="student"] {
  background: rgba(37, 99, 235, 0.2);
  color: #fff;
}

.role-btn.active[data-role="admin"] {
  background: rgba(124, 58, 237, 0.2);
  color: #fff;
}

/* Action Tabs */
.action-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 24px;
}

.action-tab {
  flex: 1;
  text-align: center;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  min-height: 44px;
}

.action-tab.active {
  color: #fff;
  border-bottom-color: var(--current-color);
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-sub);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: 'IBM Plex Sans', sans-serif;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--current-color);
}

.phone-input-group {
  display: flex;
  gap: 10px;
}

.phone-input-group select {
  flex: 0 0 130px;
}

.phone-input-group input {
  flex: 1;
  min-width: 0;
}

.forgot-link {
  display: block;
  text-align: right;
  color: var(--current-color);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--current-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  transition: opacity 0.2s;
  font-family: 'IBM Plex Sans', sans-serif;
  min-height: 46px;
}

.submit-btn:hover {
  opacity: 0.9;
}

.helper-text {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-bottom: 18px;
  line-height: 1.5;
}

/* Dynamic UI sections */
.ui-section {
  display: none;
}
.ui-section.active {
  display: block;
}

#errorMessage {
  color: #ef4444;
  text-align: center;
  font-size: 0.88rem;
  margin-top: 14px;
  font-weight: 500;
}

#successMessage {
  color: #10b981;
  text-align: center;
  font-size: 0.88rem;
  margin-top: 14px;
  font-weight: 500;
}

.password-wrapper {
  position: relative;
}

.password-wrapper .form-control {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.4);
  user-select: none;
  font-size: 1.1rem;
  transition: color 0.2s;
}

.password-toggle:hover {
  color: #fff;
}

.modal-bg.open {
  display: flex !important;
}

/* Responsive Media Queries */
@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .auth-container {
    padding: 24px 18px;
    border-radius: 14px;
  }

  .auth-header h1 {
    font-size: 1.7rem;
  }

  .phone-input-group {
    flex-direction: column;
    gap: 8px;
  }

  .phone-input-group select {
    width: 100%;
    flex: none;
  }
}
