/**
 * User Profile Component Styles
 * Comprehensive styling for the user profile management modal
 * Compatible with both light and dark themes
 */

/* ========== Profile Modal Overlay ========== */
.profile-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: profileOverlayFadeIn 0.3s ease;
}

.profile-modal-overlay.closing {
  animation: profileOverlayFadeOut 0.3s ease;
}

/* ========== Profile Modal ========== */
.profile-modal {
  background: var(--surface-color, #ffffff);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  animation: profileModalSlideIn 0.3s ease;
  border: 1px solid var(--border-color, #e5e7eb);
}

.profile-modal.closing {
  animation: profileModalSlideOut 0.3s ease;
}

/* ========== Modal Header ========== */
.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  background: var(--background-color, #f9fafb);
}

.profile-modal-header h2 {
  color: var(--text-primary, #111827);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-modal-header h2 i {
  color: var(--primary-color, #3b82f6);
}

.profile-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.profile-close-btn:hover {
  background: var(--hover-color, #f3f4f6);
  color: var(--text-primary, #111827);
}

/* ========== Modal Content ========== */
.profile-modal-content {
  display: flex;
  height: calc(90vh - 120px);
  min-height: 500px;
}

/* ========== Profile Tabs ========== */
.profile-tabs {
  width: 220px;
  background: var(--background-color, #f9fafb);
  border-right: 1px solid var(--border-color, #e5e7eb);
  padding: 1rem 0;
  overflow-y: auto;
}

.profile-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  border: none;
  background: none;
  color: var(--text-secondary, #6b7280);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.profile-tab:hover {
  background: var(--hover-color, #f3f4f6);
  color: var(--text-primary, #111827);
}

.profile-tab.active {
  background: var(--primary-color, #3b82f6);
  color: white;
  position: relative;
}

.profile-tab.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: white;
  border-radius: 2px 0 0 2px;
}

.profile-tab i {
  width: 16px;
  text-align: center;
}

/* ========== Tab Content ========== */
.profile-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.profile-tab-pane {
  display: none;
}

.profile-tab-pane.active {
  display: block;
}

/* ========== Profile Sections ========== */
.profile-section {
  margin-bottom: 2rem;
}

.profile-section:last-child {
  margin-bottom: 0;
}

.profile-section h3 {
  color: var(--text-primary, #111827);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1.5rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.profile-section h4 {
  color: var(--text-primary, #111827);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
}

/* ========== Form Styling ========== */
.profile-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.profile-form-group {
  margin-bottom: 1rem;
}

.profile-form-group label {
  display: block;
  color: var(--text-primary, #111827);
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.profile-form-group input,
.profile-form-group select,
.profile-form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 8px;
  background: var(--surface-color, #ffffff);
  color: var(--text-primary, #111827);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.profile-form-group input:focus,
.profile-form-group select:focus,
.profile-form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.profile-form-group input:invalid {
  border-color: #ef4444;
}

.profile-form-group input:invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ========== Form Actions ========== */
.profile-form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
  justify-content: center;
}

.btn-primary {
  background: var(--primary-color, #3b82f6);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover, #2563eb);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-color, #ffffff);
  color: var(--text-primary, #111827);
  border: 1px solid var(--border-color, #d1d5db);
}

.btn-secondary:hover {
  background: var(--hover-color, #f3f4f6);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-color, #3b82f6);
  padding: 0;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--primary-hover, #2563eb);
}

/* ========== Account Information ========== */
.account-info {
  background: var(--background-color, #f9fafb);
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid var(--border-color, #e5e7eb);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.info-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-item label {
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
  margin: 0;
}

.info-value {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-primary, #111827);
}

/* ========== Theme Options ========== */
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 0.5rem;
}

.theme-option {
  cursor: pointer;
}

.theme-option input[type="radio"] {
  display: none;
}

.theme-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  transition: all 0.2s ease;
  background: var(--surface-color, #ffffff);
}

.theme-preview.light {
  background: #ffffff;
  color: #111827;
}

.theme-preview.dark {
  background: #1f2937;
  color: #ffffff;
}

.theme-preview.auto {
  background: linear-gradient(90deg, #ffffff 50%, #1f2937 50%);
  color: #111827;
}

.theme-option input[type="radio"]:checked + .theme-preview {
  border-color: var(--primary-color, #3b82f6);
  background-color: rgba(59, 130, 246, 0.05);
}

.theme-preview i {
  font-size: 1.5rem;
}

/* ========== Notification Options ========== */
.notification-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.checkbox-option:hover {
  background: var(--hover-color, #f3f4f6);
}

.checkbox-option input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color, #d1d5db);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: var(--surface-color, #ffffff);
}

.checkbox-option input[type="checkbox"]:checked + .checkmark {
  background: var(--primary-color, #3b82f6);
  border-color: var(--primary-color, #3b82f6);
  color: white;
}

.checkbox-option input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  font-size: 0.75rem;
  font-weight: bold;
}

/* ========== Password Strength ========== */
.password-strength {
  margin-top: 0.5rem;
}

.strength-meter {
  width: 100%;
  height: 4px;
  background: var(--border-color, #e5e7eb);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.strength-bar {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 2px;
}

.strength-bar.weak {
  background: #ef4444;
}

.strength-bar.fair {
  background: #f59e0b;
}

.strength-bar.good {
  background: #10b981;
}

.strength-bar.strong {
  background: #059669;
}

.strength-text {
  font-size: 0.75rem;
  font-weight: 500;
}

.strength-text.weak {
  color: #ef4444;
}

.strength-text.fair {
  color: #f59e0b;
}

.strength-text.good {
  color: #10b981;
}

.strength-text.strong {
  color: #059669;
}

/* ========== Security Information ========== */
.security-info {
  background: var(--background-color, #f9fafb);
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid var(--border-color, #e5e7eb);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.status-badge.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.status-badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* ========== Activity List ========== */
.activity-list {
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  transition: background 0.2s ease;
}

.activity-item:hover {
  background: var(--hover-color, #f9fafb);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color, #3b82f6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 500;
  color: var(--text-primary, #111827);
  margin-bottom: 0.25rem;
}

.activity-meta {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
}

.activity-empty,
.activity-loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary, #6b7280);
}

.activity-empty i,
.activity-loading i {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

/* ========== Loading Overlay ========== */
.profile-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-loading {
  background: var(--surface-color, #ffffff);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  min-width: 200px;
}

.profile-loading i {
  font-size: 2rem;
  color: var(--primary-color, #3b82f6);
  animation: spin 1s linear infinite;
}

.profile-loading span {
  color: var(--text-primary, #111827);
  font-weight: 500;
}

/* ========== Notifications ========== */
.profile-notification {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 10002;
  max-width: 400px;
  background: var(--surface-color, #ffffff);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color, #e5e7eb);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  animation: notificationSlideIn 0.3s ease;
}

.profile-notification.success {
  border-left: 4px solid #10b981;
}

.profile-notification.error {
  border-left: 4px solid #ef4444;
}

.profile-notification.warning {
  border-left: 4px solid #f59e0b;
}

.profile-notification.info {
  border-left: 4px solid #3b82f6;
}

.notification-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.notification-content i {
  font-size: 1.25rem;
}

.notification-content span {
  color: var(--text-primary, #111827);
  font-size: 0.875rem;
  line-height: 1.4;
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.notification-close:hover {
  background: var(--hover-color, #f3f4f6);
  color: var(--text-primary, #111827);
}

.profile-notification.success .notification-content i {
  color: #10b981;
}

.profile-notification.error .notification-content i {
  color: #ef4444;
}

.profile-notification.warning .notification-content i {
  color: #f59e0b;
}

.profile-notification.info .notification-content i {
  color: #3b82f6;
}

/* ========== Animations ========== */
@keyframes profileOverlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes profileOverlayFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes profileModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes profileModalSlideOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-50px) scale(0.95);
  }
}

@keyframes notificationSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ========== Dark Theme Overrides ========== */
.theme-dark .profile-modal {
  --surface-color: #1f2937;
  --background-color: #111827;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --border-color: #374151;
  --hover-color: #374151;
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
}

.theme-dark .profile-modal-header {
  background: var(--background-color);
  border-bottom-color: var(--border-color);
}

.theme-dark .profile-tabs {
  background: var(--background-color);
  border-right-color: var(--border-color);
}

.theme-dark .profile-form-group input,
.theme-dark .profile-form-group select,
.theme-dark .profile-form-group textarea {
  background: var(--background-color);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.theme-dark .account-info,
.theme-dark .security-info {
  background: var(--background-color);
  border-color: var(--border-color);
}

.theme-dark .checkmark {
  background: var(--background-color);
  border-color: var(--border-color);
}

.theme-dark .theme-preview {
  background: var(--background-color);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.theme-dark .strength-meter {
  background: var(--border-color);
}

.theme-dark .profile-notification {
  background: var(--surface-color);
  border-color: var(--border-color);
}

.theme-dark .profile-loading {
  background: var(--surface-color);
}

/* ========== Mobile Responsive ========== */
@media (max-width: 768px) {
  .profile-modal {
    margin: 0;
    border-radius: 0;
    height: 100vh;
    max-height: 100vh;
  }

  .profile-modal-content {
    flex-direction: column;
    height: calc(100vh - 80px);
  }

  .profile-tabs {
    width: 100%;
    display: flex;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    padding: 0;
  }

  .profile-tab {
    white-space: nowrap;
    padding: 1rem;
    border-bottom: 3px solid transparent;
  }

  .profile-tab.active {
    background: none;
    border-bottom-color: var(--primary-color, #3b82f6);
    color: var(--primary-color, #3b82f6);
  }

  .profile-tab.active::after {
    display: none;
  }

  .profile-tab-content {
    padding: 1rem;
  }

  .profile-form-row {
    grid-template-columns: 1fr;
  }

  .theme-options {
    grid-template-columns: 1fr;
  }

  .profile-form-actions {
    flex-direction: column;
  }

  .profile-notification {
    top: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .profile-modal-overlay {
    padding: 0;
  }

  .profile-modal-header {
    padding: 1rem;
  }

  .profile-modal-header h2 {
    font-size: 1.25rem;
  }

  .profile-tab-content {
    padding: 0.75rem;
  }

  .profile-section h3 {
    font-size: 1.125rem;
  }

  .btn {
    padding: 0.875rem 1.25rem;
  }
}

/* ========== High Contrast Mode ========== */
@media (prefers-contrast: high) {
  .profile-modal {
    border: 2px solid var(--text-primary, #111827);
  }

  .profile-tab.active {
    background: var(--text-primary, #111827);
    color: var(--surface-color, #ffffff);
  }

  .btn-primary {
    border: 2px solid var(--primary-color, #3b82f6);
  }

  .profile-form-group input:focus,
  .profile-form-group select:focus,
  .profile-form-group textarea:focus {
    border-width: 2px;
  }
}

/* ========== Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {
  .profile-modal-overlay,
  .profile-modal,
  .profile-notification,
  .profile-loading i,
  .btn,
  .profile-tab,
  .activity-item {
    animation: none;
    transition: none;
  }
}

/* ========== Print Styles ========== */
@media print {
  .profile-modal-overlay,
  .profile-loading-overlay,
  .profile-notification {
    display: none !important;
  }
}