/* ========================================
   ADMIN PORTAL - LOGIN STYLESHEET
   ======================================== */

/* CSS Variables */
:root {
  --admin-primary-color: #0056D2;
  --admin-primary-dark: #0041a3;
  --admin-primary-light: #0066ff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --bg-light: #f8fafc;
  --error-color: #ef4444;
  --success-color: #10b981;
}

/* Global Styles */
* {
  margin: 0;
  padding: 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body.admin-auth {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: #0056D2;
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.admin-auth::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 15% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

body.admin-auth::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Login Box Container */
.login-box {
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Card Styles */
.card {
  border: none;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow-x: hidden;
  overflow-y: visible;
  background: #ffffff;
  backdrop-filter: blur(20px);
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.card-body {
  padding: 1rem 2.5rem;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Admin Portal Badge */
.admin-badge {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--admin-primary-color) 0%, var(--admin-primary-dark) 100%);
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0, 86, 210, 0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
  text-transform: uppercase;
  max-width: calc(100% - 2rem);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.admin-badge i {
  font-size: 1.125rem;
}

/* Logo Styles */
.login-logo {
  margin-bottom: 2rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.login-logo a {
  display: inline-block;
  text-decoration: none;
  transition: transform 0.2s ease;
  max-width: 100%;
}

.login-logo a:hover {
  transform: scale(1.02);
}

.login-logo a:active {
  transform: scale(0.98);
}

.login-logo img {
  max-height: 70px;
  max-width: 100%;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.login-logo a:not(:has(img)) {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--admin-primary-color) 0%, var(--admin-primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Page Titles */
.welcome-title,
.page-title {
  text-align: center;
  margin-bottom: 0.5rem;
  margin-top: 1rem;
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.025em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.welcome-subtitle,
.page-subtitle {
  text-align: center;
  margin-bottom: 2.5rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.page-subtitle {
  padding: 0 1rem;
  line-height: 1.6;
}

.welcome-subtitle i {
  color: var(--admin-primary-color);
  margin-right: 0.25rem;
}

/* Alert Messages */
.alert {
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideDown 0.3s ease;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
}

.alert-success i {
  color: var(--success-color);
  font-size: 1.25rem;
}

/* Form Labels */
.form-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.625rem;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  display: block;
}

/* Input Groups */
.input-group {
  position: relative;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.input-group-text {
  background: var(--bg-light);
  border: 1.5px solid var(--border-color);
  border-left: none;
  border-radius: 0 10px 10px 0;
  color: var(--admin-primary-color);
  padding: 0.8125rem 1rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
}

.input-group-text i {
  font-size: 1.125rem;
}

.input-group:focus-within .input-group-text {
  background: linear-gradient(135deg, var(--admin-primary-color) 0%, var(--admin-primary-dark) 100%);
  color: white;
  border-color: var(--admin-primary-color);
}

/* Form Controls */
.form-control {
  border: 1.5px solid var(--border-color);
  border-right: none;
  border-radius: 10px 0 0 10px;
  padding: 0.8125rem 1rem;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
  background: #ffffff;
  color: var(--text-primary);
  line-height: 1.5;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.form-control::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.form-control:focus {
  box-shadow: 0 0 0 3px rgba(0, 86, 210, 0.15);
  border-color: var(--admin-primary-color);
  background: #ffffff;
  outline: none;
}

.form-control.is-invalid {
  border-color: var(--error-color);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
  border-color: var(--error-color);
}

/* Password Toggle */
.password-toggle {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.password-toggle:hover {
  color: var(--admin-primary-color);
}

.password-toggle:active {
  transform: scale(0.95);
}

.password-toggle i {
  font-size: 1.125rem;
  transition: transform 0.2s ease;
}

.password-toggle:hover i {
  transform: scale(1.1);
}

/* Error Messages */
.invalid-feedback,
.text-danger {
  font-size: 0.8125rem;
  margin-top: 0.375rem;
  color: var(--error-color);
  font-weight: 500;
}

/* Form Options (Remember Me & Forgot Password) */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Checkboxes */
.form-check {
  display: flex;
  align-items: center;
  margin: 0;
}

.form-check-input {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0;
  margin-right: 0.625rem;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.form-check-input:checked {
  background-color: var(--admin-primary-color);
  border-color: var(--admin-primary-color);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(0, 86, 210, 0.15);
  outline: none;
}

.form-check-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

/* Links */
.forgot-password-link {
  color: var(--admin-primary-color);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.forgot-password-link:hover {
  color: var(--admin-primary-dark);
  text-decoration: underline;
}

/* Buttons */
.btn-primary {
  background: #0056D2;
  border: none;
  border-radius: 10px;
  padding: 0.9375rem 1.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.025em;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 86, 210, 0.25);
  margin-top: 0.5rem;
  color: white;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 86, 210, 0.35);
  background: linear-gradient(135deg, #0041a3 0%, #0056D2 50%, #0066ff 100%);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 86, 210, 0.2);
}

.btn-primary:focus {
  box-shadow: 0 0 0 3px rgba(0, 86, 210, 0.25);
  outline: none;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Mobile Optimizations (≤640px) */
@media (max-width: 640px) {
  body.admin-auth {
    padding: 0.75rem;
    align-items: flex-start;
    padding-top: 2.5rem;
    overflow-x: hidden;
  }

  .login-box {
    max-width: 100%;
    width: 100%;
  }

  .card {
    border-radius: 20px;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
  }

  .admin-badge {
    top: -12px;
    padding: 0.4rem 1.25rem;
    font-size: 0.8125rem;
  }

  .admin-badge i {
    font-size: 1rem;
  }

  .card-body {
    padding: 1rem 1.5rem;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .login-logo {
    margin-bottom: 1.5rem;
  }

  .login-logo img {
    max-height: 60px;
  }

  .login-logo a:not(:has(img)) {
    font-size: 1.875rem;
  }

  .welcome-title,
  .page-title {
    font-size: 1.5rem;
    margin-bottom: 0.375rem;
    margin-top: 0.75rem;
  }

  .welcome-subtitle,
  .page-subtitle {
    font-size: 0.875rem;
    margin-bottom: 2rem;
  }

  .form-label {
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
  }

  .form-control {
    padding: 0.75rem 0.875rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .input-group-text {
    padding: 0.75rem 0.875rem;
    min-width: 44px; /* Better touch target */
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .forgot-password-link {
    width: 100%;
    text-align: left;
  }

  .btn-primary {
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    min-height: 48px; /* Better touch target */
  }
}

/* Small Mobile (≤375px) */
@media (max-width: 375px) {
  .admin-badge {
    padding: 0.375rem 1rem;
    font-size: 0.75rem;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-body {
    padding: 1rem 1rem;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .welcome-title,
  .page-title {
    font-size: 1.25rem;
  }

  .welcome-subtitle,
  .page-subtitle {
    font-size: 0.8125rem;
  }

  .form-control {
    padding: 0.6875rem 0.75rem;
  }

  .input-group-text {
    padding: 0.6875rem 0.75rem;
  }
}

/* Tablet Optimizations (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .login-box {
    max-width: 420px;
  }

  .card-body {
    padding: 2.5rem 2rem;
  }
}

/* Large Screen Optimizations (≥1440px) */
@media (min-width: 1440px) {
  .login-box {
    max-width: 480px;
  }

  .card-body {
    padding: 1rem 3rem;
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .form-control {
    border-width: 2px;
  }

  .btn-primary {
    border: 2px solid var(--admin-primary-dark);
  }
}

