/* =================================
   USER PROFILE PAGE STYLES
   ================================= */

/* Page Header */
.profile-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.profile-page-title h1 {
  font-size: 1.6em;
  color: #202124;
  margin-bottom: 6px;
}

.profile-page-title p {
  color: #5f6368;
  font-size: 0.92em;
  margin: 0;
}

/* Profile Container */
.profile-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

/* Profile Card */
.profile-card {
  background: white;
  border: 1px solid #dadce0;
  border-radius: 12px;
  overflow: hidden;
}

.profile-card-header {
  background: linear-gradient(135deg, #1a73e8 0%, #4285f4 50%, #669df6 100%);
  padding: 28px 30px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
}

.profile-card-header::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.profile-avatar-large {
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.8em;
  flex-shrink: 0;
  overflow: hidden;
  object-fit: cover;
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0 0 50% 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: pointer;
}

.profile-avatar-wrap:hover .profile-avatar-overlay {
  opacity: 1;
}

/* Avatar Lightbox */
.avatar-lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: lbFadeIn 0.25s ease;
}

.avatar-lightbox.active {
  display: flex;
}

.avatar-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  object-fit: contain;
  animation: lbZoomIn 0.3s ease;
}

@keyframes lbFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lbZoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==================== AVATAR CROP MODAL ==================== */
.crop-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  animation: lbFadeIn 0.2s ease;
}
.crop-modal.active {
  display: flex;
}
.crop-modal-content {
  background: var(--card-bg, #1e2235);
  border-radius: 16px;
  padding: 24px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: lbZoomIn 0.25s ease;
}
.crop-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.crop-modal-header h3 {
  margin: 0;
  font-size: 1.1em;
  color: var(--text-primary, #e4e6f0);
}
.crop-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary, #8a8ea8);
  font-size: 1.5em;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}
.crop-modal-close:hover {
  color: var(--text-primary, #e4e6f0);
}

/* Crop area */
.crop-area {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto 20px;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.crop-area:active {
  cursor: grabbing;
}
.crop-area canvas {
  position: absolute;
  top: 0; left: 0;
}

/* Circle overlay guide */
.crop-container {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto 20px;
}
.crop-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Zoom controls */
.crop-zoom-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  margin-bottom: 20px;
}
.crop-zoom-controls svg {
  flex-shrink: 0;
  color: var(--text-secondary, #8a8ea8);
}
.crop-zoom-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color, #2d3154);
  outline: none;
}
.crop-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient, linear-gradient(135deg, #667eea, #764ba2));
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.crop-zoom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.crop-zoom-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient, linear-gradient(135deg, #667eea, #764ba2));
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Actions */
.crop-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.crop-actions .btn-secondary,
.crop-actions .btn-primary {
  padding: 10px 24px;
  font-size: 0.9em;
  border-radius: 8px;
}

.profile-header-info {
  position: relative;
  z-index: 1;
}

.profile-header-info h2 {
  color: white;
  margin: 0 0 6px 0;
  font-size: 1.3em;
}

.profile-role {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 14px;
  border-radius: 100px;
  font-size: 0.82em;
  font-weight: 500;
}

.profile-card-body {
  padding: 0;
}

/* Profile Section */
.profile-section {
  border-bottom: 2px solid #f1f3f4;
}

.profile-section:last-child {
  border-bottom: none;
}

.profile-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px 10px;
  gap: 12px;
}

.profile-section-header h3 {
  font-size: 0.92em;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin: 0;
}

.btn-section-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: 1.5px solid #dadce0;
  background: white;
  border-radius: 100px;
  font-size: 0.82em;
  font-weight: 600;
  color: #1a73e8;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-section-edit:hover {
  background: #f0f7ff;
  border-color: #1a73e8;
}

.btn-section-edit.active {
  background: #1a73e8;
  border-color: #1a73e8;
  color: white;
}

.edit-icon {
  font-size: 1em;
}

.change-limit-badge {
  font-size: 0.78em;
  color: #5f6368;
  background: #f1f3f4;
  padding: 4px 12px;
  border-radius: 100px;
  font-weight: 500;
}

/* Profile Field */
.profile-field {
  display: flex;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid #f1f3f4;
  transition: background 0.2s ease;
}

.profile-field:last-child {
  border-bottom: none;
}

.profile-field:hover {
  background: #f8f9fa;
}

/* Dashboard banner-dən gəldikdə 2 saniyə vurğulama animasiyası */
.profile-field-highlight {
  animation: profileFieldFlash 2s ease-out;
  position: relative;
  z-index: 1;
}

@keyframes profileFieldFlash {
  0%   { background: #fef3c7; box-shadow: 0 0 0 3px #fbbf24, 0 6px 18px rgba(251,191,36,0.35); }
  60%  { background: #fef3c7; box-shadow: 0 0 0 3px #fbbf24, 0 6px 18px rgba(251,191,36,0.35); }
  100% { background: transparent; box-shadow: 0 0 0 0 rgba(251,191,36,0); }
}

.profile-field-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #5f6368;
  font-size: 0.9em;
  font-weight: 500;
  min-width: 170px;
  flex-shrink: 0;
}

.field-icon {
  font-size: 1.05em;
}

.profile-field-value {
  color: #202124;
  font-weight: 600;
  font-size: 0.92em;
  margin-left: auto;
  text-align: right;
}

/* Edit Mode Input */
.profile-field-input {
  margin-left: auto;
  padding: 8px 14px;
  border: 2px solid #dadce0;
  border-radius: 8px;
  font-size: 0.9em;
  color: #202124;
  width: 260px;
  max-width: 100%;
  outline: none;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.profile-field-input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

select.profile-field-input {
  cursor: pointer;
  appearance: auto;
}

/* Contact Change Button */
.btn-change-contact {
  margin-left: 12px;
  padding: 5px 14px;
  border: 1.5px solid #dadce0;
  background: white;
  border-radius: 6px;
  font-size: 0.8em;
  font-weight: 600;
  color: #1a73e8;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-change-contact:hover {
  background: #f0f7ff;
  border-color: #1a73e8;
}

.btn-change-contact:disabled {
  color: #9aa0a6;
  border-color: #e8eaed;
  cursor: not-allowed;
  background: #f8f9fa;
}

/* Physical Request Button (inline with contract) */
.btn-physical-request {
  padding: 4px 14px;
  border: 1.5px solid #dadce0;
  background: white;
  border-radius: 6px;
  font-size: 0.8em;
  font-weight: 600;
  color: #1a73e8;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 10px;
  vertical-align: middle;
}

.btn-physical-request:hover {
  background: #f0f7ff;
  border-color: #1a73e8;
}

/* Profile Section Actions (inline in header) */
.profile-section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Save / Cancel Actions */
.btn-save-profile {
  padding: 7px 20px;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 100px;
  font-size: 0.82em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

/* Mobil: edit rejimində Yadda saxla + Ləğv et sticky floating bar */
@media (max-width: 768px) {
  .profile-section-actions:has(.btn-save-profile) {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 60px);
    z-index: 9999;
    background: #fff;
    padding: 10px 14px;
    border-radius: 14px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(0, 0, 0, 0.08);
    justify-content: space-between;
    display: flex !important;
    gap: 10px;
  }
  .profile-section-actions:has(.btn-save-profile) .btn-save-profile,
  .profile-section-actions:has(.btn-save-profile) .btn-cancel-edit {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.95em;
    min-height: 44px;
  }
}

.btn-save-profile:hover {
  background: #1557b0;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.btn-cancel-edit {
  padding: 7px 20px;
  background: white;
  border: 1.5px solid #dadce0;
  border-radius: 100px;
  font-size: 0.82em;
  font-weight: 600;
  color: #5f6368;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-cancel-edit:hover {
  background: #f1f3f4;
  border-color: #80868b;
}

/* Profile Sidebar */
.profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Balance Quick Card */
.balance-quick-card {
  background: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
  border-radius: 12px;
  padding: 24px;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.balance-quick-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.balance-quick-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.balance-quick-header h3 {
  color: white;
  margin: 0;
  font-size: 1em;
}

.balance-quick-icon {
  font-size: 1.2em;
}

.balance-quick-amount {
  font-size: 2.6em;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.balance-unit {
  font-size: 0.33em;
  font-weight: 400;
  opacity: 0.8;
  display: block;
  margin-top: 4px;
}

.balance-quick-note {
  font-size: 0.82em;
  opacity: 0.75;
  margin: 8px 0 18px;
  position: relative;
  z-index: 1;
}

.btn-topup {
  display: inline-block;
  background: white;
  color: #1a73e8;
  padding: 10px 26px;
  border-radius: 100px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88em;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
}

.btn-topup:hover {
  background: #f0f7ff;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Quick Links */
.profile-quick-links {
  background: white;
  border: 1px solid #dadce0;
  border-radius: 12px;
  padding: 18px;
}

.profile-quick-links h3 {
  margin: 0 0 14px 0;
  font-size: 0.95em;
  color: #202124;
}

.quick-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #3c4043;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  font-size: 0.9em;
}

.quick-link-item:last-child {
  margin-bottom: 0;
}

.quick-link-item:hover {
  background: #f0f7ff;
  text-decoration: none;
  transform: translateX(3px);
}

.quick-link-icon {
  font-size: 1.1em;
}

.quick-link-arrow {
  margin-left: auto;
  color: #1a73e8;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.quick-link-item:hover .quick-link-arrow {
  opacity: 1;
}

/* ============ Contact Change Modal ============ */

.modal-contact-change {
  max-width: 460px !important;
}

.contact-change-desc {
  color: #5f6368;
  font-size: 0.92em;
  margin-bottom: 20px;
  line-height: 1.5;
}

.contact-change-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff3cd;
  border-left: 3px solid #ffc107;
  border-radius: 6px;
  font-size: 0.82em;
  color: #856404;
  margin-bottom: 20px;
}

.contact-change-error {
  margin-top: 4px;
  margin-bottom: 16px;
  padding: 11px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 3px solid #dc2626;
  border-radius: 8px;
  font-size: 0.86em;
  color: #b91c1c;
  font-weight: 500;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.contact-change-error svg { flex: 0 0 auto; margin-top: 1px; }

.otp-input {
  text-align: center;
  font-size: 1.4em !important;
  letter-spacing: 8px;
  font-weight: 700;
}

.otp-timer {
  text-align: center;
  margin: 12px 0 20px;
  font-size: 0.9em;
  color: #1a73e8;
  font-weight: 600;
}

/* ============ Password Change Form ============ */

.password-toggle-header {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.password-toggle-header:hover {
  background: #f8f9fa;
}

.password-change-form {
  padding: 8px 28px 24px;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
  max-height: 500px;
  opacity: 1;
}

.password-change-form.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.password-change-form .form-group {
  margin-bottom: 16px;
}

.password-change-form .form-group label {
  display: block;
  font-size: 0.88em;
  color: #5f6368;
  font-weight: 500;
  margin-bottom: 6px;
}

.password-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 400px;
  width: 100%;
}

.password-input-wrapper .form-control {
  width: 100%;
  padding-right: 42px;
}

.toggle-password-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: #9aa0a6;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.toggle-password-btn:hover {
  color: #5f6368;
}

.password-change-form .action-buttons {
  margin-top: 20px;
}

.password-change-form .btn-primary {
  padding: 10px 28px;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.password-change-form .btn-primary:hover {
  background: #1557b0;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.password-change-form .btn-primary:disabled {
  background: #9aa0a6;
  cursor: not-allowed;
  box-shadow: none;
}

/* Responsive */
@media (max-width: 900px) {
  .profile-container {
    grid-template-columns: 1fr;
  }

  .profile-page-header {
    flex-direction: column;
    gap: 14px;
  }

  .profile-card-header {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }

  .profile-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 20px;
  }

  .profile-field-value {
    margin-left: 0;
    text-align: left;
  }

  .profile-field-input {
    margin-left: 0;
    width: 100%;
  }

  .profile-field-label {
    min-width: auto;
  }

  .profile-section-header {
    padding: 14px 20px 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .profile-section-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-change-contact {
    margin-left: 0;
    margin-top: 4px;
  }
}

@media (max-width: 600px) {
  .profile-card-header { padding: 20px 16px; }
  .profile-avatar-wrap { width: 90px; height: 90px; }
  .profile-name { font-size: 1.15em; }
  .profile-field { padding: 12px 16px; }
  .profile-field-input { font-size: 16px; padding: 10px 12px; }
  .profile-field-label { font-size: 0.85em; }
  .profile-section-header { padding: 12px 16px 6px; }
  .profile-section-actions button { min-height: 38px; }
}

@media (max-width: 480px) {
  .profile-card-header { padding: 18px 14px; }
  .profile-name { font-size: 1.05em; }
  .profile-email { font-size: 0.85em; }
  .profile-field { padding: 10px 14px; }
  .btn-edit, .btn-save, .btn-cancel { min-height: 42px; font-size: 0.85em; }
  .profile-section-actions { width: 100%; }
  .profile-section-actions button { flex: 1; }
}

@media (max-width: 360px) {
  .profile-card-header { padding: 14px 12px; }
  .profile-avatar-wrap { width: 78px; height: 78px; }
  .profile-name { font-size: 0.95em; }
  .profile-field { padding: 10px 12px; }
  .profile-field-label { font-size: 0.78em; }
}
