/* Base Styles */
:root {
  --primary-color: #3328bf;
  --primary-light: #4d3fd4;
  --secondary-color: #f3f4f6;
  --text-color: #333;
  --light-text: #6b7280;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --white: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-color);
  background-color: #f9fafb;
  line-height: 1.6;
}

/* Header Styles */
.profile-header {
  background-color: var(--white);
  box-shadow: var(--shadow);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.back-button a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.back-button a:hover {
  text-decoration: underline;
}

.profile-actions {
  display: flex;
  gap: 1rem;
}

.edit-btn, .print-btn {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
}

.edit-btn {
  background-color: var(--primary-color);
  color: var(--white);
}

.print-btn {
  background-color: var(--secondary-color);
  color: var(--text-color);
}

/* Profile Container */
.profile-container {
  display: flex;
  max-width: 1200px;
  margin: 2rem auto;
  gap: 2rem;
  padding: 0 1rem;
}

.profile-sidebar {
  flex: 0 0 300px;
}

.profile-content {
  flex: 1;
}

/* Profile Card */
.profile-card {
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-picture {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  position: relative;
  overflow: hidden;
  border: 3px solid var(--primary-color);
}

.profile-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edit-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  text-align: center;
  padding: 0.5rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s;
}

.profile-picture:hover .edit-overlay {
  opacity: 1;
}

.profile-info {
  text-align: center;
}

.profile-info h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.profile-grade, .profile-school {
  color: var(--light-text);
  margin-bottom: 0.5rem;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1rem;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  display: block;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--light-text);
}

/* Quick Links */
.quick-links {
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.quick-links h3 {
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.quick-links ul {
  list-style: none;
}

.quick-links li {
  margin-bottom: 0.75rem;
}

.quick-links a {
  color: var(--text-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.quick-links a:hover {
  background-color: var(--secondary-color);
  color: var(--primary-color);
}

/* Profile Sections */
.profile-section {
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
}

.edit-section-btn, .add-subject-btn, .add-university-btn {
  background-color: transparent;
  border: none;
  color: var(--primary-color);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

.edit-section-btn:hover, .add-subject-btn:hover, .add-university-btn:hover {
  background-color: var(--secondary-color);
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.info-item {
  margin-bottom: 1rem;
}

.info-item label {
  display: block;
  font-size: 0.875rem;
  color: var(--light-text);
  margin-bottom: 0.25rem;
}

.info-item p {
  font-weight: 500;
}

.edit-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: none;
}

.edit-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.save-btn, .cancel-btn {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  border: none;
}

.save-btn {
  background-color: var(--primary-color);
  color: var(--white);
}

.cancel-btn {
  background-color: var(--secondary-color);
  color: var(--text-color);
}

/* Subjects Section */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.subject-card {
  background-color: var(--secondary-color);
  border-radius: 8px;
  padding: 1rem;
  position: relative;
}

.subject-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.subject-name {
  font-weight: 600;
  font-size: 1.125rem;
}

.subject-level {
  background-color: var(--primary-color);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.subject-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.mark-item {
  text-align: center;
}

.mark-label {
  font-size: 0.75rem;
  color: var(--light-text);
}

.mark-value {
  font-weight: 600;
}

.subject-average {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
}

.subject-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.5rem;
}

.edit-subject, .delete-subject {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--light-text);
  font-size: 0.875rem;
}

.edit-subject:hover {
  color: var(--primary-color);
}

.delete-subject:hover {
  color: var(--danger-color);
}

/* University Section */
.university-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.university-card {
  background-color: var(--white);
  border-radius: 8px;
  padding: 1rem;
  border-left: 4px solid var(--primary-color);
  box-shadow: var(--shadow);
  position: relative;
}

.university-name {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.university-program {
  color: var(--light-text);
  margin-bottom: 0.5rem;
}

.university-requirements {
  margin-top: 0.5rem;
}

.requirement-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

.requirement-label {
  color: var(--light-text);
}

.requirement-value {
  font-weight: 500;
}

.aps-status {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.aps-value {
  font-weight: 600;
  color: var(--primary-color);
}

.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-meets {
  background-color: #d1fae5;
  color: #065f46;
}

.status-fails {
  background-color: #fee2e2;
  color: #b91c1c;
}

.university-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.5rem;
}

.edit-university, .delete-university {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--light-text);
  font-size: 0.875rem;
}

.edit-university:hover {
  color: var(--primary-color);
}

.delete-university:hover {
  color: var(--danger-color);
}

/* APS Calculator */
.aps-calculator {
  background-color: var(--secondary-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.aps-info {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
}

.aps-universities, .aps-breakdown {
  flex: 1;
}

.aps-universities h4, .aps-breakdown h4 {
  margin-bottom: 1rem;
}

.aps-universities ul {
  list-style: none;
}

.aps-universities li {
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.aps-breakdown table {
  width: 100%;
  border-collapse: collapse;
}

.aps-breakdown th, .aps-breakdown td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.aps-breakdown th {
  font-weight: 500;
  color: var(--light-text);
}

.aps-breakdown tfoot th {
  font-weight: 600;
  color: var(--text-color);
}

/* Performance Section */
.performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1.5rem;
}

.performance-card {
  background-color: var(--white);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.performance-card h3 {
  margin-bottom: 1rem;
}

.chart-container {
  position: relative;
  height: 250px;
  width: 100%;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: var(--white);
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  padding: 2rem;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--light-text);
}

.modal h2 {
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: inherit;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.submit-btn {
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 1rem;
  width: 100%;
}

/* Image Upload Modal */
.image-upload-container {
  text-align: center;
}

.image-preview {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  overflow: hidden;
  border: 3px solid var(--primary-color);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-btn {
  display: inline-block;
  background-color: var(--secondary-color);
  color: var(--text-color);
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 1rem;
}

.upload-btn:hover {
  background-color: #e5e7eb;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .profile-container {
    flex-direction: column;
  }
  
  .profile-sidebar {
    flex: 0 0 auto;
  }
  
  .aps-info {
    flex-direction: column;
    gap: 1rem;
  }
  
  .performance-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .profile-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
}