/**
 * UM-CyberSafe - Profile Page Styles
 * Contains styles for the member profile page
 */

@import url('variables.css');

/* Profile Container — fluid gutters & padding (scales with viewport) */
.profile-container {
  --profile-gutter-x: clamp(0.625rem, 3.5vw, 1.75rem);
  --profile-pad-y: clamp(1.25rem, 3.5vw, 2rem);
  --profile-pad-inline-start: clamp(1rem, 4vw, 1.75rem);
  --profile-pad-inline-end: clamp(1.125rem, 5.5vw, 2.75rem);
  --profile-gap: clamp(1rem, 3vw, 1.5rem);
  --profile-col-gap: clamp(1.25rem, 4vw, 2rem);

  max-width: min(900px, calc(100% - 2 * var(--profile-gutter-x)));
  margin: clamp(0.625rem, 2.5vw, 2rem) auto;
  width: 100%;
  background-color: var(--white);
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  box-sizing: border-box;
}

.profile-header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: var(--white);
  padding-block: clamp(1.25rem, 4vw, 2rem);
  padding-inline-start: max(var(--profile-pad-inline-start), env(safe-area-inset-left, 0px));
  padding-inline-end: max(var(--profile-pad-inline-end), env(safe-area-inset-right, 0px));
  position: relative;
  box-sizing: border-box;
}

.profile-header h1 {
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.profile-header p {
  opacity: 0.9;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  color: #ffffff;
}

.profile-avatar {
  width: clamp(72px, 20vw, 100px);
  height: clamp(72px, 20vw, 100px);
  border-radius: 50%;
  background-color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: var(--primary-color);
  position: absolute;
  right: var(--profile-pad-inline-end);
  top: clamp(1rem, 3.5vw, 2rem);
  border: 4px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  box-sizing: border-box;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-content {
  padding-block-start: var(--profile-pad-y);
  padding-block-end: max(var(--profile-pad-y), env(safe-area-inset-bottom, 0px));
  padding-inline-start: max(var(--profile-pad-inline-start), env(safe-area-inset-left, 0px));
  padding-inline-end: max(var(--profile-pad-inline-end), env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

/* Profile Sections */
.profile-section {
  margin-bottom: 2rem;
}

.profile-section:last-child {
  margin-bottom: 0;
}

.profile-section h2 {
  color: var(--primary-color);
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

/* Account Information */
.profile-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--profile-gap);
  column-gap: var(--profile-col-gap);
}

.info-item {
  margin-bottom: 1rem;
}

.info-item label {
  display: block;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.3rem;
  font-size: clamp(0.8rem, 2.2vw, 0.9rem);
}

.info-item p {
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  color: var(--text-color);
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

/* Progress Sections */
.progress-section {
  margin-top: 2rem;
}

.progress-item {
  margin-bottom: 1.5rem;
}

.progress-item h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background-color: var(--light-bg);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 5px;
  animation: progressAnimation 1s ease-out forwards;
  --progress-width: 0%;
}

/* Progress Circles */
.progress-circles {
  margin: 1rem 0;
}

.progress-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.progress-step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  background-color: var(--white);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  transition: all 0.3s ease;
  font-size: 0.9rem;
  position: relative;
  cursor: pointer;
}

/* Progress step colors based on completion level */
.progress-step.beginner-completed {
  background-color: #ffc107;
  border: 2px solid #ffc107;
  color: #333;
}

.progress-step.intermediate-completed {
  background-color: #fd7e14;
  border: 2px solid #fd7e14;
  color: var(--white);
}

.progress-step.all-completed {
  background-color: #28a745;
  border: 2px solid #28a745;
  color: var(--white);
}

.progress-step.completed {
  background-color: var(--primary-color);
  border: 2px solid var(--primary-color);
  color: var(--white);
}

/* Tooltip styles */
.progress-step .tooltip {
  visibility: hidden;
  width: 180px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -90px;
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
  font-weight: normal;
  font-size: 0.8rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* Tooltip arrow */
.progress-step .tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

/* Show tooltip on hover */
.progress-step:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

/* Progress level indicator inside tooltip */
.progress-level {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
  font-size: 0.75rem;
}

.progress-level-name {
  text-align: left;
}

.progress-level-status {
  text-align: right;
  font-weight: bold;
}

.progress-level-status.completed {
  color: #28a745;
}

.progress-level-status.not-completed {
  color: #dc3545;
}

/* Mini progress bar inside tooltip */
.mini-progress-bar-container {
  width: 100%;
  height: 4px;
  background-color: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin-top: 6px;
}

.mini-progress-bar {
  height: 100%;
  background-color: #28a745;
  border-radius: 2px;
  transition: width 0.5s ease-in-out;
}

/* Hover effect for progress steps */
.progress-step:hover {
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

/* Progress Legend */
.progress-legend {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-right: 1rem;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 5px;
}

.legend-color.not-started {
  background-color: #fff;
  border: 2px solid var(--primary-color);
}

.legend-color.beginner {
  background-color: #ffc107;
  border: 2px solid #ffc107;
}

.legend-color.intermediate {
  background-color: #fd7e14;
  border: 2px solid #fd7e14;
}

.legend-color.completed {
  background-color: #28a745;
  border: 2px solid #28a745;
}

.legend-text {
  font-size: 0.85rem;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn {
  padding: 0.9rem 2.5rem;
  border-radius: 50px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-size: 1.1rem;
  text-align: center;
}

.btn i {
  font-size: 1.2rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 86, 179, 0.2);
}

.btn-primary:hover {
  background-color: #0046a1;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 86, 179, 0.3);
}

.btn-primary:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 86, 179, 0.2);
}

.btn-outline {
  background-color: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-outline:hover {
  background-color: rgba(0, 86, 179, 0.05);
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.btn-outline:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-success {
  background-color: var(--success-color);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
}

.btn-success:hover {
  background-color: #218838;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.btn-success:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(40, 167, 69, 0.2);
}

.btn-danger {
  background-color: var(--accent-color);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
}

.btn-danger:hover {
  background-color: #e74c3c;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.btn-danger:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(255, 107, 107, 0.2);
}

/* Disabled button styles */
.btn.disabled, .btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background-color: #6c757d;
  border-color: #6c757d;
  color: white;
  box-shadow: none;
  transform: none;
}

.module-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 15px;
}

/* Certificate Styles */
.certificates-section {
  margin-top: 2rem;
}

.certificate-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  margin-bottom: 1rem;
}

.certificate-icon {
  font-size: 2rem;
  color: var(--primary-color);
  margin-right: 1rem;
}

.certificate-info {
  flex: 1;
}

.certificate-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.certificate-info p {
  font-size: 0.9rem;
  color: #666;
}

.certificate-actions {
  display: flex;
  gap: 0.5rem;
}

.certificate-actions a {
  color: var(--primary-color);
  font-size: 1.2rem;
  padding: 0.3rem;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.certificate-actions a:hover {
  background-color: rgba(0, 86, 179, 0.1);
}

/* Loading and Error States */
.loading-spinner {
  display: none;
  text-align: center;
  padding: clamp(1.25rem, 4vw, 2rem);
}

.loading-spinner i {
  font-size: 2rem;
  color: var(--primary-color);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-message {
  display: none;
  background-color: #f8d7da;
  color: #721c24;
  padding: clamp(0.75rem, 2.5vw, 1rem);
  border-radius: 5px;
  margin-bottom: 1rem;
}

/* Animation for progress bars */
@keyframes progressAnimation {
  0% { width: 0; }
  100% { width: var(--progress-width); }
}

/* Assessment Results Styles */
.assessment-info {
  background-color: var(--white);
  border-radius: 8px;
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.assessment-summary {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1rem, 4vw, 2rem);
  margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

.assessment-score {
  flex: 1;
  min-width: min(100%, 200px);
}

.assessment-details {
  flex: 2;
  min-width: min(100%, 280px);
}

.rating-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: bold;
  margin: 0.5rem 0;
  color: white;
}

.rating-badge.beginner {
  background-color: #dc3545;
}

.rating-badge.intermediate {
  background-color: #ffc107;
  color: #333;
}

.rating-badge.expert {
  background-color: #28a745;
}

.assessment-note {
  background-color: #f8f9fa;
  border-left: 4px solid var(--primary-color);
  padding: 1rem;
  border-radius: 4px;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.assessment-note i {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-top: 0.2rem;
}

.assessment-note p {
  margin: 0;
  font-size: 0.95rem;
}

.assessment-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: clamp(1rem, 3vw, 1.5rem);
  gap: clamp(0.5rem, 2vw, 1rem);
}

/* Responsive Styles */
@media (max-width: 768px) {
  .profile-container {
    border-radius: clamp(6px, 2vw, 10px);
  }

  .profile-header {
    text-align: center;
  }

  .profile-avatar {
    position: static;
    margin: 0 auto clamp(0.75rem, 2vw, 1rem);
    right: auto;
    top: auto;
  }

  .progress-steps {
    gap: 0.3rem;
  }

  .progress-step {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    min-width: 0;
  }

  .assessment-summary {
    flex-direction: column;
    gap: 1rem;
  }

  .assessment-score, .assessment-details {
    width: 100%;
  }
}
