/**
 * Biometric Authentication Styles - Customer PWA
 * Adapted for SitiJY Beauty pink theme
 * 
 * @version 1.0.0
 */

/* ===========================================
   Login Screen - Biometric Section
   =========================================== */

.biometric-login-section {
  margin-top: 1.5rem;
  padding-top: 0;
}

.divider-with-text {
  display: flex;
  align-items: center;
  text-align: center;
  margin-bottom: 1rem;
}

.divider-with-text::before,
.divider-with-text::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e1e8ed;
}

.divider-with-text span {
  padding: 0 1rem;
  color: #666;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Biometric Login Button - Pink theme */
.btn-biometric {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  background: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
  border: none;
  color: white;
  font-weight: 600;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(196, 69, 105, 0.3);
  cursor: pointer;
}

.btn-biometric:hover {
  background: linear-gradient(135deg, #c44569 0%, #ff6b9d 100%);
  box-shadow: 0 4px 12px rgba(196, 69, 105, 0.4);
  transform: translateY(-1px);
}

.btn-biometric:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(196, 69, 105, 0.3);
}

.btn-biometric:disabled {
  background: #f0f0f0;
  color: #999;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-biometric .fingerprint-icon {
  flex-shrink: 0;
}

.biometric-hint {
  text-align: center;
  color: #666;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
}

/* ===========================================
   Profile Screen - Security Section
   =========================================== */

.security-section {
  margin-top: 1.5rem;
}

/* Security Setting Item - Flexbox Row Layout */
.security-setting-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8f9fa;
  border: 1px solid #e1e8ed;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 0.75rem;
}

.security-setting-item .setting-info {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.security-setting-item .setting-info svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #c44569;
}

.security-setting-item .setting-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.security-setting-item .setting-text h4 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #333;
}

.security-setting-item .setting-text p {
  margin: 0;
  font-size: 0.8125rem;
  color: #666;
  line-height: 1.4;
}

.security-setting-item .setting-action {
  flex-shrink: 0;
}

.security-setting-item .setting-action button {
  white-space: nowrap;
}

/* Error message styling */
.text-danger {
  color: #e74c3c;
}

.small {
  font-size: 0.8125rem;
}

.mt-1 {
  margin-top: 0.25rem;
}

/* Not supported status styling */
.security-status.not-supported {
  color: #999;
  font-style: italic;
}

.security-section h4 {
  display: flex;
  align-items: center;
  color: #333;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.security-section h4 svg {
  color: #c44569;
}

.security-card {
  background: #f8f9fa;
  border: 1px solid #e1e8ed;
  border-radius: 12px;
  padding: 1rem;
}

.security-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.security-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.fingerprint-icon-small {
  color: #c44569;
  flex-shrink: 0;
}

.security-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.security-label {
  font-weight: 500;
  color: #333;
  font-size: 0.9375rem;
}

.security-status {
  font-size: 0.8125rem;
  color: #999;
}

.security-status.enabled {
  color: #27ae60;
}

.security-hint {
  margin-top: 0.75rem;
  color: #666;
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* Android Notice - Pink theme */
.android-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(196, 69, 105, 0.1);
  border-radius: 6px;
  font-size: 0.8125rem;
  color: #c44569;
}

.android-notice svg {
  flex-shrink: 0;
  color: #c44569;
}

/* Remove Biometric Row */
.remove-biometric-row {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e1e8ed;
}

.btn-danger-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e74c3c;
  font-size: 0.875rem;
  padding: 0.25rem 0;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-danger-text:hover {
  opacity: 0.8;
}

.btn-danger-text svg {
  flex-shrink: 0;
}

/* ===========================================
   Small Button Variant
   =========================================== */

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: 6px;
}

.btn-small .btn-text {
  white-space: nowrap;
}

/* Spinner for small buttons */
.spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: biometric-spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes biometric-spin {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 360px) {
  .security-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .security-row .btn {
    width: 100%;
    justify-content: center;
  }
  
  .security-info {
    width: 100%;
  }
}

/* ===========================================
   Dark Mode Support
   =========================================== */

[data-theme="dark"] .biometric-login-section .divider-with-text::before,
[data-theme="dark"] .biometric-login-section .divider-with-text::after {
  border-color: #30363d;
}

[data-theme="dark"] .biometric-login-section .divider-with-text span {
  color: #8b949e;
}

[data-theme="dark"] .security-card,
[data-theme="dark"] .security-setting-item {
  background: #161b22;
  border-color: #30363d;
}

[data-theme="dark"] .security-label,
[data-theme="dark"] .security-setting-item .setting-text h4 {
  color: #e6edf3;
}

[data-theme="dark"] .security-status,
[data-theme="dark"] .security-setting-item .setting-text p {
  color: #8b949e;
}

[data-theme="dark"] .security-hint,
[data-theme="dark"] .biometric-hint {
  color: #8b949e;
}

[data-theme="dark"] .btn-biometric:disabled {
  background: #21262d;
  color: #8b949e;
}

/* ===========================================
   Animations
   =========================================== */

.biometric-login-section {
  animation: fadeIn 0.3s ease-out;
}

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

/* Fingerprint pulse animation (when active) */
@keyframes fingerprint-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.btn-biometric:active .fingerprint-icon {
  animation: fingerprint-pulse 0.5s ease-in-out infinite;
}

/* Success state animation */
.security-status.enabled::before {
  content: '✓ ';
}

/* ===========================================
   Android Badge Styling
   =========================================== */

.android-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #3ddc84 0%, #2ecc71 100%);
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  /* Mobile: Force to new line */
  width: 100%;
  margin-top: 5px;
  order: 3;
  text-align: left;
}

.android-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* On larger screens, let badge sit inline */
@media (min-width: 480px) {
  .android-badge {
    width: auto;
    margin-top: 0;
    order: 0;
  }
}

/* ===========================================
   Biometric Error Message (Inline)
   =========================================== */

#biometric-error-msg {
  width: 100%;
  flex-basis: 100%;
  white-space: normal;
  word-wrap: break-word;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #e74c3c;
  line-height: 1.4;
}

#biometric-error-msg.hidden {
  display: none;
}

/* ===========================================
   Biometric Toast (Fixed Position - for global toasts)
   =========================================== */

.biometric-error-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 20px;
  width: 90%;
  max-width: 400px;
  background: #e74c3c;
  color: white;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(231, 76, 60, 0.3);
  animation: toast-slide-up 0.3s ease-out;
}

.biometric-error-toast.success {
  background: #27ae60;
  box-shadow: 0 4px 16px rgba(39, 174, 96, 0.3);
}

.biometric-error-toast.hidden {
  display: none;
}

@keyframes toast-slide-up {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ===========================================
   Mobile-Specific Adjustments
   =========================================== */

@media (max-width: 480px) {
  .security-setting-item {
    padding: 0.875rem;
    gap: 0.75rem;
  }
  
  .security-setting-item .setting-text h4 {
    font-size: 0.875rem;
  }
  
  .security-setting-item .setting-text p {
    font-size: 0.75rem;
  }
  
  .btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }
  
  .biometric-login-section {
    margin-top: 1rem;
  }
  
  .btn-biometric {
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
  }
}

/* ===========================================
   Override/Force Toast Style (Android Fix)
   Forces error toast to center-screen with text wrapping
   =========================================== */

.toast-error, #biometric-error-msg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 350px;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    white-space: normal; /* Force wrapping */
    word-wrap: break-word; /* Break long error codes */
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
