/**
 * Common Extensions CSS
 * Header navigation styles for authentication system
 * Add to your existing common.css or include separately
 * 
 * @author Alan Axford
 * @version 1.0
 */

/* ==========================================
   HEADER NAVIGATION
   ========================================== */

.top-header {
  background: #1f2937;
  color: white;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-logo {
  font-size: 1.25rem;
  font-weight: bold;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.2s;
}

.header-logo:hover {
  opacity: 0.9;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.9375rem;
}

.nav-link:hover {
  color: #93c5fd;
  background: rgba(255, 255, 255, 0.1);
}

.login-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-block;
  border: none;
  cursor: pointer;
  font-size: 0.9375rem;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.login-btn:active {
  transform: translateY(0);
}

.user-menu {
  display: none;
  align-items: center;
  gap: 1rem;
}

.user-menu.show {
  display: flex;
}

.user-name {
  font-size: 0.875rem;
  opacity: 0.9;
  font-weight: 500;
}

.logout-btn {
  background: #ef4444;
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  font-size: 0.875rem;
}

.logout-btn:hover {
  background: #dc2626;
}

.logout-btn:active {
  background: #b91c1c;
}

/* ==========================================
   RESPONSIVE HEADER
   ========================================== */

@media (max-width: 768px) {
  .top-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    position: relative;
  }

  .header-nav {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .nav-link {
    width: 100%;
    text-align: center;
  }

  .user-menu {
    flex-direction: column;
    width: 100%;
  }

  .user-menu .nav-link {
    margin: 0;
  }
}

/* ==========================================
   LOGIN/REGISTER PAGE STYLES
   ========================================== */

/* Universal box-sizing for login page */
.login-page-body,
.login-page-body * {
  box-sizing: border-box;
}

.login-page-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  margin: 0;
}

.login-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}

.tabs {
  display: flex;
  border-bottom: 2px solid #f3f4f6;
}

.tab {
  flex: 1;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  color: #6b7280;
  transition: all 0.3s;
  border-bottom: 3px solid transparent;
}

.tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: #f9fafb;
}

.form-container {
  padding: 2rem;
}

.form {
  display: none;
  width: 100%;
  box-sizing: border-box;
}

.form.active {
  display: block;
}

.form-group {
  margin-bottom: 1.5rem;
}

.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 1.25rem;
  user-select: none;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.password-toggle:hover {
  opacity: 1;
}

.login-page-body label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #374151;
}

.required {
  color: #ef4444;
  margin-left: 4px;
  font-weight: bold;
}

@keyframes flash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

.flash-required {
  animation: flash 0.5s ease-in-out 3;
}

.login-page-body input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

/* Hide browser autofill icons (key icons) */
.login-page-body input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.login-page-body input::-ms-reveal,
.login-page-body input::-ms-clear {
  display: none;
}

/* Remove autofill background */
.login-page-body input:-webkit-autofill,
.login-page-body input:-webkit-autofill:hover,
.login-page-body input:-webkit-autofill:focus,
.login-page-body input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px white inset !important;
  box-shadow: 0 0 0 30px white inset !important;
}

.login-page-body input:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: none;
}

.alert.show {
  display: block;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.verify-section {
  display: none;
  margin-top: 1.5rem;
  padding: 1rem;
  background: #fef3c7;
  border: 2px solid #fbbf24;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.verify-section.show {
  display: block;
}

.verify-section p {
  margin-bottom: 1rem;
  color: #92400e;
  word-wrap: break-word;
}

.code-input {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.code-digit {
  width: 50px;
  height: 50px;
  max-width: calc((100% - 2.5rem) / 6);
  min-width: 40px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: bold;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0;
  line-height: 46px;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.code-digit:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

@media (max-width: 480px) {
  .code-digit {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    max-width: calc((100% - 2.5rem) / 6);
    line-height: 36px;
  }

  .code-input {
    gap: 0.375rem;
  }
}

@media (max-width: 360px) {
  .code-digit {
    width: 35px;
    height: 35px;
    font-size: 1rem;
    line-height: 31px;
  }

  .code-input {
    gap: 0.25rem;
  }
}

.password-requirements {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.password-requirements ul {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
}

.required-indicator {
  color: #ef4444;
  font-weight: bold;
  margin-left: 0.25rem;
  display: inline;
}

.field-error {
  border-color: #ef4444 !important;
  animation: shake 0.3s;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}
