/* Button Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  min-height: 44px;
  min-width: 44px;
}

.btn:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--secondary-dark));
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--bg-secondary);
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: var(--font-size-lg);
}

/* CTA Button */
.cta-button {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: var(--space-lg) var(--space-2xl);
  text-decoration: none;
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-semibold);
  font-size: 1.125rem;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  box-shadow: var(--shadow-lg);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.cta-button::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 var(--transition-base);
}

.cta-button:hover::before {
  left: 100%;
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

/* Button Press Effect */
.button-press:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}

/* Card Components */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-sm);
}

.card-body {
  margin-bottom: var(--space-lg);
}

.card-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

/* Form Components */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.form-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
  appearance: none;
}

.form-error {
  color: var(--error-color);
  font-size: var(--font-size-sm);
  margin-top: var(--space-xs);
}

.form-help {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin-top: var(--space-xs);
}

/* Badge Components */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-primary {
  background: var(--primary-color);
  color: white;
}

.badge-secondary {
  background: var(--secondary-color);
  color: white;
}

.badge-success {
  background: var(--success-color);
  color: white;
}

.badge-warning {
  background: var(--warning-color);
  color: var(--text-primary);
}

.badge-error {
  background: var(--error-color);
  color: white;
}

.badge-info {
  background: var(--info-color);
  color: white;
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Alert Components */
.alert {
  padding: var(--space-md) var(--space-lg);
  border: 1px solid;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.alert-success {
  background: rgba(40, 167, 69, 0.1);
  border-color: var(--success-color);
  color: var(--success-color);
}

.alert-warning {
  background: rgba(255, 193, 7, 0.1);
  border-color: var(--warning-color);
  color: var(--warning-color);
}

.alert-error {
  background: rgba(220, 53, 69, 0.1);
  border-color: var(--error-color);
  color: var(--error-color);
}

.alert-info {
  background: rgba(23, 162, 184, 0.1);
  border-color: var(--info-color);
  color: var(--info-color);
}

/* Notification System */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.notification {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border-color);
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease-out;
}

.notification-success { border-color: var(--success-color); }
.notification-error { border-color: var(--error-color); }
.notification-warning { border-color: var(--warning-color); }
.notification-info { border-color: var(--info-color); }

.notification-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
}

.notification-content i {
  flex-shrink: 0;
}

.notification-success .notification-content i { color: var(--success-color); }
.notification-error .notification-content i { color: var(--error-color); }
.notification-warning .notification-content i { color: var(--warning-color); }
.notification-info .notification-content i { color: var(--info-color); }

.notification-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  margin-left: auto;
  flex-shrink: 0;
}

.notification-close:hover {
  color: var(--text-primary);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading Components */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-color);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

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

/* Divider */
.divider {
  height: 1px;
  background: var(--divider-color);
  margin: var(--space-lg) 0;
}

.divider-vertical {
  width: 1px;
  height: 100%;
  background: var(--divider-color);
  margin: 0 var(--space-lg);
}

/* Profile Settings Components */
.profile-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-light, #e9ecef);
}

.profile-settings-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--primary-color, #ff6b6b);
}

.profile-settings-content {
  display: grid !important;
  grid-template-columns: 2fr 1fr !important;
  gap: 2rem;
  align-items: start;
}

/* Force grid layout on all screen sizes above 640px */
@media (min-width: 641px) {
  #profile-settings-section .profile-settings-content {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
  }
  
  /* Prevent responsive.css from affecting profile settings layout */
  #profile-settings-section .container {
    padding: 0 var(--space-lg, 2rem) !important;
  }
}

/* Override responsive.css for profile settings at problematic breakpoint */
@media (max-width: 767px) and (min-width: 641px) {
  #profile-settings-section .profile-settings-content {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
  }
  
  #profile-settings-section .container {
    padding: 0 var(--space-lg, 2rem) !important;
  }
}

.settings-card,
.profile-preview-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-light, #e9ecef);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-sm, 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075));
}

.profile-preview-card {
  position: sticky;
  top: 2rem;
}

.profile-preview-card h3 {
  margin: 0 0 1.5rem 0;
  color: var(--text-primary, #212529);
  font-size: 1.2rem;
}

.form-section {
  margin-bottom: 2.5rem;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.form-section h3 {
  margin: 0 0 1.5rem 0;
  color: var(--text-primary, #212529);
  font-size: 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light, #e9ecef);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.preview-content {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.preview-avatar img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-light, #e9ecef);
}

.preview-info h4 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary, #212529);
  font-size: 1.1rem;
}

.preview-location {
  margin: 0 0 0.75rem 0;
  color: var(--text-secondary, #6c757d);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.preview-bio {
  margin: 0 0 1rem 0;
  color: var(--text-primary, #212529);
  font-size: 0.9rem;
  line-height: 1.4;
  max-height: 4.2em;
  overflow: hidden;
}

.user-role {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.user-role.admin {
  background: #dc3545;
  color: white;
}

.user-role.moderator {
  background: #17a2b8;
  color: white;
}

.user-role.community-admin {
  background: #28a745;
  color: white;
}

.user-role.member {
  background: #6c757d;
  color: white;
}

.auth-required {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-card, #ffffff);
  border: 2px solid var(--border-light, #e9ecef);
  border-radius: 12px;
  margin: 2rem 0;
}

.auth-required h2 {
  margin: 0 0 1rem 0;
  color: var(--text-primary, #212529);
}

.auth-required p {
  margin: 0 0 2rem 0;
  color: var(--text-secondary, #6c757d);
}

/* Responsive design - only for very small screens */
@media (max-width: 640px) {
  .profile-settings-header {
    flex-direction: column !important;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .profile-settings-content {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .profile-preview-card {
    order: -1;
    position: static;
  }
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
}

.strength-weak {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.strength-medium {
    background-color: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}

.strength-strong {
    background-color: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* Password Requirements */
.password-requirements {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
}

.password-requirements ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
    list-style: none;
}

.password-requirements li {
    margin: 0.25rem 0;
    padding-left: 1.25rem;
    position: relative;
}

.password-requirements li::before {
    content: "×";
    position: absolute;
    left: 0;
    color: #dc2626;
    font-weight: bold;
}

.password-requirements li.requirement-met::before {
    content: "✓";
    color: #16a34a;
}

.password-requirements li.requirement-unmet::before {
    content: "×";
    color: #dc2626;
}

/* MFA Setup Styles */
.mfa-options {
    margin: 1.5rem 0;
}

.mfa-option {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-align: center;
}

.mfa-option button {
    margin-bottom: 0.5rem;
    min-width: 200px;
}

.mfa-option i {
    margin-right: 0.5rem;
}

.mfa-warning {
    background-color: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1.5rem;
    color: #92400e;
}

.mfa-warning i {
    margin-right: 0.5rem;
    color: #d97706;
}

/* Dark mode styles for password and MFA components */
body.dark-mode .password-requirements {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .strength-weak {
    background-color: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: #fca5a5;
}

body.dark-mode .strength-medium {
    background-color: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.3);
    color: #fbbf24;
}

body.dark-mode .strength-strong {
    background-color: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
    color: #86efac;
}

body.dark-mode .mfa-option {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .mfa-warning {
    background-color: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.3);
    color: var(--text-muted);
}

/* Email Verification Prompt */
.email-verification-prompt {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.email-verification-prompt .verification-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.email-verification-prompt i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.email-verification-prompt h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.email-verification-prompt p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
    line-height: 1.4;
}

.verification-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.verification-actions .btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.verification-actions .btn-primary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.verification-actions .btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.verification-actions .btn-secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.verification-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Email Verification Status Indicators */
[data-email-verified].verified::after {
    content: "✓ Verified";
    color: var(--success-color);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

[data-email-verified].unverified::after {
    content: "⚠ Unverified";
    color: var(--warning-color);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* Authentication State UI Elements */
[data-auth-required] {
    display: none;
}

[data-guest-only] {
    display: block;
}

/* When user is authenticated */
body.authenticated [data-auth-required] {
    display: block;
}

body.authenticated [data-guest-only] {
    display: none;
}