/**
 * 3DArtDesk - User Profile Styles
 * Stiluri complete pentru pagina de profil
 * 
 * @version 2.0.0
 * @date 2026-02-01
 */

/* =============================================================================
   PROFILE CONTAINER
   ============================================================================= */
.profile-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

#profileContainer {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* =============================================================================
   PROFILE HEADER
   ============================================================================= */
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 24px;
  background: var(--bg-card, #fff);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand, #667eea) 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.profile-avatar.online::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: #4caf50;
  border: 3px solid var(--bg-card, #fff);
  border-radius: 50%;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-letter {
  font-size: 48px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
}

.btn-avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card, #fff);
  border: 2px solid var(--border, #e2e8f0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-avatar-edit:hover {
  transform: scale(1.1);
  border-color: var(--brand, #667eea);
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--text, #1a202c);
  margin: 0 0 8px 0;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.profile-username {
  color: var(--muted, #718096);
  font-size: 15px;
}

.profile-role.badge {
  background: linear-gradient(135deg, var(--brand, #667eea) 0%, #764ba2 100%);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-job {
  color: var(--text, #1a202c);
  font-size: 14px;
}

.profile-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted, #718096);
}

.profile-status .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e0;
}

.profile-status.online .status-dot {
  background: #4caf50;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(76, 175, 80, 0); }
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* =============================================================================
   QUICK STATS
   ============================================================================= */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.profile-stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card, #fff);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.profile-stat-card .stat-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-radius: 12px;
}

.profile-stat-card .stat-content {
  flex: 1;
}

.profile-stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text, #1a202c);
  line-height: 1.2;
}

.profile-stat-card .stat-label {
  font-size: 13px;
  color: var(--muted, #718096);
  margin-top: 2px;
}

/* =============================================================================
   SECTIONS
   ============================================================================= */
.profile-section {
  background: var(--bg-card, #fff);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text, #1a202c);
  margin: 0;
}

.chart-period-selector,
.timeline-filters {
  display: flex;
  gap: 8px;
}

/* =============================================================================
   ACTIVITY CHART
   ============================================================================= */
.chart-container {
  position: relative;
  height: 250px;
  width: 100%;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* =============================================================================
   HEATMAP
   ============================================================================= */
.heatmap-container {
  overflow-x: auto;
}

.heatmap-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 500px;
}

.heatmap-row {
  display: flex;
  gap: 2px;
  align-items: center;
}

.heatmap-row.heatmap-header {
  margin-bottom: 4px;
}

.heatmap-label {
  width: 40px;
  font-size: 12px;
  color: var(--muted, #718096);
  text-align: right;
  padding-right: 8px;
  flex-shrink: 0;
}

.heatmap-hour-label {
  width: 30px;
  font-size: 10px;
  color: var(--muted, #718096);
  text-align: center;
}

.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--bg-alt, #f7fafc);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.heatmap-cell:hover {
  transform: scale(1.3);
  z-index: 1;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted, #718096);
}

.legend-scale {
  display: flex;
  gap: 2px;
}

.legend-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* =============================================================================
   TIMELINE
   ============================================================================= */
.timeline-container {
  max-height: 500px;
  overflow-y: auto;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt, #f7fafc);
  border-radius: 50%;
  font-size: 16px;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-text {
  font-size: 14px;
  color: var(--text, #1a202c);
  line-height: 1.4;
}

.timeline-text strong {
  font-weight: 600;
}

.timeline-entity {
  color: var(--brand, #667eea);
  font-weight: 500;
}

.timeline-time {
  font-size: 12px;
  color: var(--muted, #718096);
  margin-top: 4px;
}

.timeline-load-more {
  text-align: center;
  padding: 16px 0;
}

/* =============================================================================
   EDIT PROFILE MODAL
   ============================================================================= */
.profile-edit-form,
.password-change-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #1a202c);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card, #fff);
  color: var(--text, #1a202c);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand, #667eea);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group small {
  font-size: 12px;
  color: var(--muted, #718096);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 400 !important;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #e2e8f0);
}

/* =============================================================================
   PROFILE MODALS
   ============================================================================= */
#modalProfileEdit .box,
#modalPasswordChange .box {
  max-width: 600px;
  width: 95%;
}

/* =============================================================================
   LOADING & EMPTY STATES
   ============================================================================= */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted, #718096);
  font-size: 14px;
}

.error {
  text-align: center;
  padding: 40px;
  color: #e53e3e;
  font-size: 14px;
}

.empty {
  text-align: center;
  padding: 40px;
  color: var(--muted, #718096);
  font-size: 14px;
}

/* =============================================================================
   DARK MODE
   ============================================================================= */
[data-theme="dark"] .profile-header,
[data-theme="dark"] .profile-stat-card,
[data-theme="dark"] .profile-section {
  background: var(--bg-card, #1e293b);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

[data-theme="dark"] .profile-name,
[data-theme="dark"] .profile-stat-card .stat-value,
[data-theme="dark"] .section-header h3,
[data-theme="dark"] .timeline-text {
  color: var(--text, #f1f5f9);
}

[data-theme="dark"] .btn-avatar-edit {
  background: var(--bg-card, #1e293b);
  border-color: var(--border, #334155);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background: var(--bg-alt, #0f172a);
  border-color: var(--border, #334155);
  color: var(--text, #f1f5f9);
}

[data-theme="dark"] .heatmap-cell {
  background: var(--bg-alt, #0f172a);
}

[data-theme="dark"] .timeline-icon {
  background: var(--bg-alt, #0f172a);
}

[data-theme="dark"] .timeline-item {
  border-color: var(--border, #334155);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 768px) {
  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-meta {
    justify-content: center;
  }

  .profile-actions {
    width: 100%;
  }

  .profile-actions .btn {
    width: 100%;
  }

  .profile-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-period-selector,
  .timeline-filters {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .heatmap-container {
    margin: 0 -20px;
    padding: 0 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .profile-avatar {
    width: 100px;
    height: 100px;
  }

  .profile-avatar-letter {
    font-size: 40px;
  }

  .profile-name {
    font-size: 24px;
  }

  .profile-stats-grid {
    grid-template-columns: 1fr;
  }

  .profile-stat-card {
    padding: 16px;
  }

  .profile-stat-card .stat-value {
    font-size: 20px;
  }
}

/* =============================================================================
   ADMIN USER LIST ENHANCEMENTS
   ============================================================================= */
.user-activity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.user-activity-badge.online {
  background: rgba(76, 175, 80, 0.1);
  color: #4caf50;
}

.user-activity-badge.recent {
  background: rgba(255, 152, 0, 0.1);
  color: #ff9800;
}

.user-activity-badge.inactive {
  background: rgba(158, 158, 158, 0.1);
  color: #9e9e9e;
}

/* User card in admin view */
.user-card-activity {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted, #718096);
}

.user-card-activity .activity-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* =============================================================================
   PROFILE LINK IN USER TABLE
   ============================================================================= */
.user-profile-link {
  color: var(--brand, #667eea);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.user-profile-link:hover {
  color: #764ba2;
  text-decoration: underline;
}

/* =============================================================================
   ONLINE USERS WIDGET (Admin Dashboard)
   ============================================================================= */
.online-users-widget {
  background: var(--bg-card, #fff);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.online-users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.online-users-count {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.online-users-count .dot {
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  animation: pulse-green 2s infinite;
}

.online-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.online-user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-alt, #f7fafc);
}

.online-user-item .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand, #667eea) 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.online-user-item .user-info {
  flex: 1;
  min-width: 0;
}

.online-user-item .user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #1a202c);
}

.online-user-item .user-page {
  font-size: 12px;
  color: var(--muted, #718096);
}