/* ========================================
   PROFILE PAGE
======================================== */

/* ========================================
   PROFILE PAGE - DESIGN 1: CARDS MODERNES EMPILÉES
======================================== */

/* === Profile Page === */
#profile {
  padding: 1rem;
  padding-top: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  font-family: var(--main-font);
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Profile container for centering cards */
.profile-container {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  flex-shrink: 0;
}

/* Header principal de la page Profile */
.profile-header {
  padding: 0;
  margin: 0 0 20px 0;
  text-align: center;
}

.profile-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  font-family: var(--main-font);
  color: var(--primary-color);
  letter-spacing: -0.02em;
  text-align: center;
}

/* Profile Cards - Clean minimal style */
.profile-card {
  background: white;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

/* Profile Card Header - Minimal */
.profile-card-header {
  margin-bottom: 1.25rem;
}

.profile-card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  font-family: var(--main-font);
}

/* Remove icons from profile headers */
.profile-card-header h2::before {
  display: none;
}

/* Profile Card Content */
.profile-card-content {
  padding: 0;
  background: transparent;
}

/* Labels modernes */
label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #4b5563;
  font-size: 0.875rem;
  letter-spacing: 0;
}

/* Profile form labels */
.profile-card label {
  color: #374151;
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

/* Inputs modernes */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  margin-bottom: 0;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  background-color: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  color: #1f2937;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(39, 76, 119, 0.1);
  background-color: #fff;
}

/* Selects stylisés */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23274c77' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Boutons modernes */
button[type="submit"] {
  background: var(--gradient-primary);
  color: #ffffff;
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
  margin-top: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Profile form buttons - clean style */
.profile-card button[type="submit"] {
  width: auto;
  padding: 0.625rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  align-self: flex-start;
  background: var(--primary-color);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
  margin-top: 0.5rem;
}

.profile-card button[type="submit"]:hover {
  background: #1e3a5f;
  transform: none;
  box-shadow: none;
}

button[type="submit"]:hover {
  background: var(--gradient-secondary);
  transform: translateY(-1px);
  box-shadow: 0 6px 10px rgba(39, 76, 119, 0.3);
}

button[type="submit"]:active {
  transform: translateY(0);
}

/* Profile Form Grid */
.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.profile-form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

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

.profile-form-group.profile-form-full {
  grid-column: 1 / -1;
}

.profile-form-group label {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary-color);
  font-size: 14px;
  letter-spacing: 0.3px;
}

.profile-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 14px;
  background-color: #ffffff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--main-font);
}

.profile-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(39, 76, 119, 0.1);
  background-color: #fff;
}

.profile-input:disabled {
  background-color: #f5f7fa;
  color: #9ca3af;
  cursor: not-allowed;
}

.profile-input[type="number"]::-webkit-inner-spin-button,
.profile-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Profile select styling */
select.profile-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23274c77' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Profile buttons */
.profile-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
  font-family: var(--main-font);
  width: auto;
  position: relative;
  overflow: hidden;
}

.profile-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.profile-btn:hover::before {
  opacity: 1;
}

.profile-btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: none;
}

.profile-btn-primary:hover {
  background: var(--primary-dark, #1e3a5f);
  opacity: 0.9;
}

.profile-btn-primary:active {
  opacity: 1;
}

/* Password toggle styling */
.profile-form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
}

#showNewPasswordToggle {
  margin: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

/* Profile form buttons - smaller, not full width */
#profileForm .profile-btn,
#passwordChangeForm .profile-btn,
.profile-card button[type="submit"].profile-btn {
  width: auto !important;
  padding: 10px 28px;
  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: 0.02em;
  display: inline-block;
}

.profile-card .profile-form-group:last-of-type {
  margin-top: 1rem;
  text-align: left;
}

/* === Responsive Design === */
/* Tablet and mobile */
@media (max-width: 768px) {
  /* Remove sidebar margin on tablet/mobile */
  #profile {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .profile-form-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }

  .profile-form-group.profile-form-full {
    grid-column: 1;
  }

  .profile-header h1 {
    font-size: 24px;
  }
}

/* Mobile */
@media (max-width: 640px) {
  #profile {
    margin-left: 0 !important;
    width: 100% !important;
    padding: var(--spacing-md);
  }

  .profile-header {
    margin-bottom: 24px;
  }

  .profile-card {
    padding: 1rem;
  }

  .profile-btn {
    padding: 12px 20px;
    font-size: 14px;
  }
}

/* ========================================
   PROFILE TABS NAVIGATION
======================================== */

.profile-subtitle {
  color: var(--gray-color);
  font-size: 0.95rem;
  margin-top: 0.25rem;
  font-weight: 400;
}

.profile-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: none;
  padding-bottom: 0;
  background: transparent;
}

/* Hide redundant section header in Account tab */
#profileTabAccount > .billing-section-header {
  display: none;
}

.profile-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: white;
  border: 1px solid #e1e8ed;
  border-radius: 6px;
  color: var(--gray-color);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.profile-tab:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.profile-tab.active {
  color: var(--primary-color);
  background: white;
  border-color: var(--primary-color);
  font-weight: 600;
}

.profile-tab svg {
  flex-shrink: 0;
}

.profile-tab-content {
  display: none;
  padding-top: 1.5rem;
}

.profile-tab-content.active {
  display: block;
}

/* ========================================
   BILLING TAB STYLES
======================================== */

.billing-section-header {
  margin-bottom: 1.5rem;
}

.billing-section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0 0 0.25rem 0;
}

.billing-section-header p {
  color: var(--gray-color);
  font-size: 0.9rem;
  margin: 0;
}

/* Billing Cards */
.billing-card {
  background: white;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.billing-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.billing-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-color);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Status Badge */
.billing-status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.billing-status-active {
  background: #dcfce7;
  color: #166534;
}

.billing-status-cancelled {
  background: #fef3c7;
  color: #92400e;
}

.billing-status-past_due {
  background: #fee2e2;
  color: #dc2626;
}

/* Plan Name */
.billing-plan-name {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.billing-plan-desc {
  color: var(--gray-color);
  font-size: 0.9rem;
  margin: 0 0 1rem 0;
}

/* Billing Details */
.billing-details {
  border-top: 1px solid #e1e8ed;
  padding-top: 1rem;
  margin-bottom: 1rem;
}

.billing-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.billing-detail-label {
  color: var(--gray-color);
  font-size: 0.9rem;
}

.billing-detail-value {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.9rem;
}

/* Card Footer with Link Button */
.billing-card-footer {
  border-top: 1px solid #e1e8ed;
  padding-top: 1rem;
  margin-top: 0.5rem;
}

/* Billing buttons - extends unified system */
.billing-link-btn {
  /* Extends .btn .btn-ghost */
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--success-color);
  font-size: var(--btn-font-size-sm);
  font-weight: var(--btn-font-weight);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: var(--btn-transition);
}

.billing-link-btn:hover {
  opacity: 0.8;
}

.billing-link-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Payment Method Card */
.billing-payment-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.billing-card-icon {
  width: 48px;
  height: 32px;
  background: #f1f5f9;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-color);
}

.billing-payment-details {
  display: flex;
  flex-direction: column;
}

.billing-payment-label {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.9rem;
}

.billing-payment-sublabel {
  color: var(--gray-color);
  font-size: 0.8rem;
}

/* Billing History */
.billing-history-desc {
  color: var(--gray-color);
  font-size: 0.9rem;
  margin: 0 0 1rem 0;
}

/* Cancel Warning Banner */
.billing-cancel-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  margin-bottom: 1rem;
  color: #92400e;
  font-size: 0.875rem;
}

.billing-cancel-warning svg {
  flex-shrink: 0;
  color: #d97706;
  margin-top: 2px;
}

.billing-cancel-warning strong {
  display: block;
  margin-top: 0.25rem;
}

/* Danger Zone (Cancel Subscription) */
.billing-danger-zone {
  background: #fef2f2;
  border-color: #fecaca;
}

.billing-danger-title {
  color: #dc2626 !important;
}

.billing-danger-desc {
  color: #991b1b;
  font-size: 0.875rem;
  margin: 0 0 1rem 0;
}

.billing-danger-btn {
  /* Extends .btn .btn-sm - danger outline variant */
  padding: var(--btn-padding-sm);
  background: white;
  border: 1px solid #fecaca;
  border-radius: var(--btn-radius-sm);
  color: #dc2626;
  font-size: var(--btn-font-size-sm);
  font-weight: var(--btn-font-weight);
  cursor: pointer;
  transition: var(--btn-transition);
  font-family: inherit;
}

.billing-danger-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.billing-danger-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Confirmation State */
.billing-confirm-state {
  animation: fadeIn 0.2s ease;
}

.billing-confirm-text {
  color: #991b1b;
  font-size: 0.875rem;
  margin: 0 0 1rem 0;
  font-weight: 500;
}

.billing-confirm-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.billing-secondary-btn {
  /* Extends .btn .btn-sm .btn-outline */
  padding: var(--btn-padding-sm);
  background: white;
  border: 1px solid #d1d5db;
  border-radius: var(--btn-radius-sm);
  color: #374151;
  font-size: var(--btn-font-size-sm);
  font-weight: var(--btn-font-weight);
  cursor: pointer;
  transition: var(--btn-transition);
  font-family: inherit;
}

.billing-secondary-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Resume Zone */
.billing-resume-zone {
  background: #f0fdf4;
  border-color: #86efac;
}

.billing-resume-title {
  color: #166534 !important;
}

.billing-resume-desc {
  color: #166534;
  font-size: 0.875rem;
  margin: 0 0 1rem 0;
}

.billing-resume-btn {
  /* Extends .btn .btn-sm .btn-success */
  padding: var(--btn-padding-sm);
  background: var(--success-color);
  border: none;
  border-radius: var(--btn-radius-sm);
  color: white;
  font-size: var(--btn-font-size-sm);
  font-weight: var(--btn-font-weight);
  cursor: pointer;
  transition: var(--btn-transition);
  font-family: inherit;
}

.billing-resume-btn:hover {
  background: #059669;
  transform: var(--btn-hover-lift);
}

.billing-resume-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading State */
.billing-loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-color);
}

.subscription-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e1e8ed;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: subscriptionSpin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes subscriptionSpin {
  to { transform: rotate(360deg); }
}

/* Error State */
.billing-error {
  text-align: center;
  padding: 2rem 1rem;
}

.billing-error-icon {
  color: var(--error-color);
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 640px) {
  .profile-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .profile-tab {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  .billing-plan-name {
    font-size: 1.5rem;
  }

  .billing-cancel-warning {
    flex-direction: column;
  }
}

/* === Styles pour le modal OAuth de complétion de profil === */
.oauth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.oauth-modal {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.oauth-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.oauth-modal-header h3 {
  margin: 0;
  color: #333;
}

.oauth-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.oauth-modal-close:hover {
  color: #333;
}

.oauth-modal-body {
  padding: 20px;
}

.oauth-modal .form-grid {
  display: grid;
  gap: 15px;
}

.oauth-modal .form-group {
  display: flex;
  flex-direction: column;
}

.oauth-modal .form-group input,
.oauth-modal .form-group select {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.oauth-modal .form-group input:focus,
.oauth-modal .form-group select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.oauth-modal .btn {
  width: 100%;
  padding: 12px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 20px;
}

.oauth-modal .btn:hover {
  background-color: #0056b3;
}

/* Styles pour la liste des pays dans le modal */
.oauth-modal #oauth-country-list {
  position: absolute;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10001;
  width: calc(100% - 2px);
  display: none;
}

.oauth-modal .country-item {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.oauth-modal .country-item:hover {
  background-color: #f5f5f5;
}

.oauth-modal .country-item:last-child {
  border-bottom: none;
}

@media (max-width: 480px) {
  /* Profile Page Mobile - Design 1 Responsive */
  #profile {
    padding: 8px;
    margin-left: 0;
    min-height: 100vh;
  }

  #profile.page {
    padding: 8px;
  }

  /* Header mobile */
  .profile-header {
    margin-bottom: 16px;
  }

  .profile-header h1 {
    font-size: 22px;
  }

  /* Cards mobile optimisées */
  #profileForm,
  #passwordChangeForm {
    margin-bottom: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(39, 76, 119, 0.1);
    transform: none;
  }

  #profileForm:hover,
  #passwordChangeForm:hover {
    transform: none;
  }

  /* Headers des cards mobile */
  #profile h2 {
    font-size: 16px;
    padding: 12px 16px;
  }

  #profile h2::before {
    width: 18px;
    height: 18px;
    margin-right: 8px;
  }

  /* Formulaires mobile */
  #profileForm form,
  #passwordChangeForm form {
    padding: 16px;
    gap: 8px;
  }

  /* Labels compacts */
  label {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
  }

  /* Inputs compacts */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  select {
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 14px;
    border-radius: 6px;
    border-width: 1px;
  }

  /* Selects mobile */
  select {
    background-position: right 12px center;
    padding-right: 36px;
  }

  /* Boutons mobile */
  button[type="submit"] {
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 6px;
    margin-top: 8px;
    text-transform: none;
    letter-spacing: 0.3px;
  }

  /* Layout Personal Information - Mobile optimisé */
  #profileForm form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    row-gap: 6px;
  }

  /* Username et Email en pleine largeur */
  #profileForm form label[for="username"],
  #profileForm form input[name="username"],
  #profileForm form label[for="email"],
  #profileForm form input[name="email"],
  #profileForm form button {
    grid-column: span 2;
  }

  /* Last Name et First Name côte à côte */
  #profileForm form label[for="lastName"],
  #profileForm form input[name="lastName"],
  #profileForm form label[for="firstName"],
  #profileForm form input[name="firstName"] {
    grid-column: span 1;
  }

  /* Age et Gender côte à côte */
  #profileForm form label[for="age"],
  #profileForm form input[name="age"],
  #profileForm form label[for="gender"],
  #profileForm form select[name="gender"] {
    grid-column: span 1;
  }

  /* Country en pleine largeur */
  #profileForm form label[for="country"],
  #profileForm form select[name="country"] {
    grid-column: span 2;
  }

  /* Password form mobile */
  #passwordChangeForm form {
    gap: 6px;
  }

  /* Toggle password mobile */
  #showNewPasswordToggle {
    margin-right: 6px;
    transform: scale(0.9);
  }

  /* Réduction des espaces */
  #profileForm form label,
  #passwordChangeForm form label {
    margin-bottom: 2px;
  }

  #profileForm form input,
  #profileForm form select,
  #passwordChangeForm form input {
    margin-bottom: 6px;
  }
}

