/* =========================
   Reset and Base Styles
   ========================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Keep scrollbar space reserved to prevent card “jump” */
html { scrollbar-gutter: stable; }
/* Fallback for browsers without scrollbar-gutter */
body { overflow-y: scroll; }

body {
  font-family: 'Poppins', sans-serif;
  background: url('EZONE-UWA.jpg') no-repeat center center fixed;
  background-size: cover;
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; position: relative;
}

body::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(0,0,0,0.4); z-index: -1;
}

/* =========================
   Login Wrapper (Card)
   ========================= */
.wrapper {
  width: 420px;
  background: rgb(255, 255, 255); /* Reduced opacity for transparency */
  border: 2px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(10px); /* Added blur effect */
  -webkit-backdrop-filter: blur(10px); /* Safari support */
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
  color: #333; border-radius: 10px;
  padding: 30px 40px; position: relative;

  /* Lock vertical space and prevent content overflow */
  min-height: 550px;
  max-height: 550px; /* Adjusted for better spacing */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevent content from spilling out and affecting border */
  padding-bottom: 40px; /* Added extra padding at bottom */
}

/* =========================
   Role Toggle (3-segment)
   ========================= */
.role-toggle {
  display: flex; justify-content: center;
  margin-bottom: 30px;
}

.toggle-container {
  display: flex; align-items: center;
  gap: 0;                     /* clean segments, no gaps */
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.8);
  width: 100%;
  min-height: 60px;           /* Increased height to accommodate stacked icon and text */
}

/* Hide native radios; make labels the interactive target */
.toggle-label input[type="radio"] {
  position: absolute; opacity: 0; pointer-events: none;
}

.toggle-label {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
  cursor: pointer; user-select: none;
  padding: 5px 12px; /* Reduced vertical padding to fit icon and text */
  border-radius: 999px;
  font-size: 12px; /* Reduced font size to fit within height */
  color: #666; white-space: nowrap; line-height: 1;
  text-align: center;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.toggle-label i {
  margin-bottom: 2px; /* Space between icon and text */
  font-size: 18px; /* Adjust icon size */
}

.toggle-label.active {
  background: #162938; color: #fff; font-weight: 600;
}

/* =========================
   Form Styles
   ========================= */
.wrapper h1 {
  font-size: 36px;
  text-align: center;
  margin-bottom: 5px;
  color: #162938;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal; /* Allow wrapping */
}

.wrapper h1 .title-line {
  display: block;
  text-align: center;
  line-height: 1.2; /* Adjust line spacing */
}

#login-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px; /* Increased to accommodate two lines and subtitle */
  max-height: 140px; /* Increased to prevent cutoff */
}

.role-subtitle {
  font-size: 16px; color: #666; text-align: center; margin-top: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.input-box {
  position: relative; width: 100%; height: 50px; margin: 30px 0;
}

.input-box input {
  width: 100%; height: 100%; background: transparent; border: none; outline: none;
  border: 2px solid rgba(255,255,255,0.2); border-radius: 40px;
  font-size: 16px; color: #333; padding: 20px 45px 20px 45px;
  transition: border-color 0.3s ease;
}

.input-box input::placeholder { color: #666; }

.input-box input:focus { border-color: #162938; }

.input-box i {
  position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
  font-size: 20px; color: #666;
}

.password-toggle {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: 20px; color: #666; transition: color 0.3s ease;
  z-index: 10;
}

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

.password-toggle i {
  position: static; transform: none;
}

.remember-forgot {
  display: flex; justify-content: space-between;
  font-size: 14.5px; margin: -15px 0 15px;
}

.remember-forgot label input { accent-color: #162938; margin-right: 3px; }

.remember-forgot a {
  color: #162938; text-decoration: none;
}
.remember-forgot a:hover { text-decoration: underline; }

.btn {
  width: 100%; height: 45px; background: #162938; border: none; outline: none;
  border-radius: 40px; box-shadow: 0 0 10px rgba(0,0,0,0.1);
  cursor: pointer; font-size: 16px; color: #fff; font-weight: 600;
  transition: background-color 0.3s ease;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.btn:hover { background: #0f1f2b; }

/* =========================
   OAuth Section
   ========================= */
.oauth-section { margin-top: 30px; }

.divider { text-align: center; margin: 20px 0; position: relative; }
.divider::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px;
  background: rgba(0,0,0,0.08);
}
.divider span {
  background: rgba(255,255,255,0.95); padding: 0 15px;
  color: #666; font-size: 14px; position: relative; z-index: 1;
}

.oauth-buttons { display: flex; flex-direction: column; gap: 10px; }

.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 20px; border: 2px solid rgba(255,255,255,0.2);
  border-radius: 40px; text-decoration: none; color: #333; font-weight: 500;
  transition: all 0.3s ease; background: rgba(255,255,255,0.1);
}
.oauth-btn:hover { background: rgba(255,255,255,0.2); border-color: #162938; }
.google-btn { color: #4285f4; }
.google-btn:hover { background: rgba(66,133,244,0.1); }

/* =========================
   Register & Flash Messages
   ========================= */
.register-link { font-size: 14.5px; text-align: center; margin: 10px 0 15px; } /* Changed margin-top from 20px to 10px */
.register-link p a { color: #162938; text-decoration: none; font-weight: 600; }
.register-link p a:hover { text-decoration: underline; }

.flash-messages { margin-bottom: 20px; }
.flash-messages p {
  padding: 10px 15px;
  border-radius: 5px; 
  border-left: 4px solid #dc3545; 
  margin-bottom: 10px;
  font-size: 14px;
}

/* Default error styling */
.flash-messages p {
  background: rgba(220,53,69,0.1); 
  color: #721c24; 
  border-left: 4px solid #dc3545;
}

/* Success message styling */
.flash-messages p.flash-success {
  background: rgba(40,167,69,0.1); 
  color: #155724; 
  border-left: 4px solid #28a745;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 768px) {
  .wrapper { width: 90%; padding: 20px 30px; }
}

@media (max-width: 480px) {
  .wrapper { padding: 15px 20px; min-height: 580px; max-height: 580px; }
  .wrapper h1 { font-size: 28px; }
  #login-title { min-height: 100px; max-height: 120px; }
  .role-subtitle { font-size: 14px; }
  .toggle-label { font-size: 10px; padding: 5px 10px; } /* Further reduced for small screens */
  .toggle-label i { font-size: 16px; }
}