/* Modern Profile Page Styles */

.modern-profile-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  background: var(--bg-off-white);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Profile Header */
.profile-header {
  margin-bottom: 30px;
}

.profile-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* User Info Card */
.user-info-card {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-avatar {
  flex-shrink: 0;
}

.avatar-circle {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.verified-badge {
  color: var(--primary);
  font-size: 16px;
}

.user-email {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

/* API Key Inline Display */
.api-key-inline {
  margin-top: 8px;
}

.api-key-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.api-key-inline .link-input-group {
  align-items: center;
}

.api-key-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.3px;
}

/* Profile Sections */
.profile-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 16px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Menu Items */
.menu-items {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border-color);
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:hover {
  background-color: var(--bg-off-white);
}

.menu-item:active {
  background-color: var(--bg-off-white);
}

.menu-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-off-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  color: var(--text-secondary);
  font-size: 16px;
}

.menu-text {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.menu-arrow {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Toggle Items */
.toggle-item {
  cursor: default;
}

.toggle-item:hover {
  background-color: var(--bg-light);
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 28px;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-label {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 28px;
  transition: 0.3s;
}

.toggle-label:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-input:checked + .toggle-label {
  background-color: #007bff;
}

.toggle-input:checked + .toggle-label:before {
  transform: translateX(22px);
}

/* Modal Styles - Slide up from bottom like add funds */
.profile-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.profile-modal.active {
  visibility: visible;
  opacity: 1;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 19, 24, 0.8);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 500px;
  height: 50vh;
  min-height: 400px;
  max-height: 80vh;
  background: var(--bg-light);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.profile-modal.active .modal-content {
  transform: translateX(-50%) translateY(0);
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-color);
  background: var(--primary-gradient);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white !important;
}

.modal-header h3 i {
  font-size: 1.1rem;
  color: white !important;
}

.close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background: var(--bg-off-white);
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.loading-spinner i {
  font-size: 32px;
  margin-bottom: 16px;
  color: var(--primary);
}

.loading-spinner p {
  margin: 0;
  font-size: 16px;
}

/* Form Styles */
.profile-form {
  max-width: 100%;
  padding: 25px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 16px 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: var(--bg-light);
  color: var(--text-primary);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.15);
  background: var(--bg-light);
}

/* Select dropdown specific styles */
.form-control select,
select.form-control {
  background: var(--bg-light);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  cursor: pointer;
  min-height: 50px;
  line-height: 1.5;
}

.form-control select:focus,
select.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.15);
  background: var(--bg-light);
}

/* Select option styles */
.form-control select option,
select.form-control option {
  background: var(--bg-light);
  color: var(--text-primary);
  padding: 8px 12px;
}

.form-control select option:hover,
select.form-control option:hover {
  background: var(--bg-off-white);
  color: var(--text-primary);
}

.form-control select option:checked,
select.form-control option:checked {
  background: var(--primary);
  color: white;
}

/* Dark theme specific dropdown arrow */
[data-theme="dark"] .form-control select,
[data-theme="dark"] select.form-control {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ccc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Ensure dropdown shows selected value */
.form-control select:invalid,
select.form-control:invalid {
  color: var(--text-secondary);
}

.form-control select:valid,
select.form-control:valid {
  color: var(--text-primary);
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: #007bff;
  border: 2px solid #007bff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: #007bff;
  color: white;
}

/* Refer Content */
.refer-content {
  text-align: center;
  padding: 25px;
}

.refer-header {
  margin-bottom: 32px;
}

.refer-icon {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 16px;
}

.refer-header h4 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.refer-header p {
  color: var(--text-secondary);
  margin: 0;
}

.referral-link-section {
  margin-bottom: 32px;
  text-align: left;
}

.referral-link-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-primary);
}

.link-input-group {
  display: flex;
  gap: 8px;
}

.referral-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-light);
  color: var(--text-primary);
  font-size: 14px;
}

.copy-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.copy-btn:hover {
  background: var(--primary-dark);
}

/* API Key Modal Content */
.api-key-section {
  padding: 25px;
}

.api-key-section .api-actions {
  display: flex;
  gap: 10px;
}

.refer-stats {
  display: flex;
  gap: 16px;
}

.stat-item {
  flex: 1;
  text-align: center;
  padding: 20px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Help & Support Content */
.help-support-content {
  padding: 25px;
}

.help-section, .support-section {
  margin-bottom: 32px;
}

.help-section h4, .support-section h4 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.faq-item {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.faq-question {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.faq-answer {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.support-section p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Badges Content */
.badges-content {
  text-align: center;
}

.badges-header {
  margin-bottom: 32px;
}

.badges-icon {
  font-size: 48px;
  color: #ffc107;
  margin-bottom: 16px;
}

.badges-header h4 {
  font-size: 24px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 8px 0;
}

.badges-header p {
  color: #6c757d;
  margin: 0;
}

.badges-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.badge-item {
  display: flex;
  align-items: center;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  text-align: left;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.badge-item.earned {
  opacity: 1;
  background: linear-gradient(135deg, #ffc107 0%, #ff8c00 100%);
  color: white;
}

.badge-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.2);
}

.badge-item:not(.earned) .badge-icon {
  background: #e9ecef;
  color: #6c757d;
}

.badge-info h5 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
}

.badge-info p {
  margin: 0;
  font-size: 14px;
  opacity: 0.8;
}

/* Legal Content */
.legal-content {
  padding: 25px;
}

.legal-section {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.legal-section h4 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-section p {
  color: var(--text-secondary);
  margin: 0 0 16px 0;
  line-height: 1.5;
}

/* Error Message */
.error-message {
  text-align: center;
  padding: 40px 20px;
  color: var(--danger);
  font-size: 16px;
}

/* Body Modal Open */
body.modal-open {
  overflow: hidden;
}

/* Responsive Design */
@media (max-width: 480px) {
  .modern-profile-container {
    padding: 16px;
  }
  
  .user-info-card {
    padding: 20px;
  }
  
  .modal-content {
    width: 95%;
    max-width: 95%;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
  }
  
  .profile-modal.active .modal-content {
    transform: translateX(-50%) translateY(0);
  }
  
  .modal-header, .modal-body {
    padding: 20px;
  }
  
  .profile-form {
    padding: 20px;
  }
  
  .form-control {
    padding: 18px 22px;
  }
  
  .refer-stats {
    flex-direction: column;
  }
  
  .badges-grid {
    grid-template-columns: 1fr;
  }
  
  .api-key-inline .link-input-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .api-key-inline .copy-btn,
  .api-key-inline .btn-outline {
    width: 100%;
  }
  
  .api-key-section .api-actions {
    flex-direction: column;
  }
}

@media (max-width: 768px) and (min-width: 481px) {
  .modal-content {
    width: 90%;
    max-width: 450px;
  }
  
  .form-control {
    padding: 17px 21px;
  }
}

@media (min-width: 768px) {
  .modern-profile-container {
    max-width: 500px;
  }
  
  .modal-content {
    max-width: 500px;
  }
  
  .badges-grid {
    grid-template-columns: 1fr 1fr;
  }
}