/* ========================================
   ✨ MODERN EDIT PROFILE MODAL - 2025
   Ultra-modern design with glassmorphism
   ======================================== */

/* Modal Overlay & Container */
.modern-profile-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  animation: modernFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-profile-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modern-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modern-modal-container {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
  width: 90%;
  max-width: 680px;
  max-height: 90vh;
  overflow: hidden;
  animation: modernSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Closing animation (reverse animation for modal close) */
@keyframes modernSlideDown {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
}

@keyframes modernFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Apply closing animation when closing class is present */
.modern-profile-modal.closing .modern-modal-overlay {
  animation: modernFadeOut 0.28s ease-in-out forwards;
}

.modern-profile-modal.closing .modern-modal-container {
  animation: modernSlideDown 0.28s ease-in-out forwards;
}

/* Animations */
@keyframes modernFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modernSlideUp {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Close Button */
.modern-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 59, 48, 0.1);
  border: 2px solid rgba(255, 59, 48, 0.2);
  color: #ff3b30;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.modern-modal-close:hover {
  background: #ff3b30;
  color: #fff;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 8px 24px rgba(255, 59, 48, 0.4);
  border-color: transparent;
}

.modern-modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

/* Modal Header */
.modern-modal-header {
  padding: 24px 24px 16px;
  border-bottom: 2px solid rgba(0, 113, 227, 0.1);
  background: rgba(0, 113, 227, 0.03);
}

.modern-modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a202c;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0 10px;
}

.modern-modal-title i {
  font-size: 28px;
  color: #0071e3;
}

/* Modern Tabs */
.modern-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 2px solid rgba(0, 113, 227, 0.1);
}

.modern-tab {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.modern-tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 113, 227, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modern-tab:hover:not(.active)::before {
  opacity: 1;
}

.modern-tab:hover:not(.active) {
  color: #475569;
  border-color: rgba(0, 113, 227, 0.2);
}

.modern-tab.active {
  background: #0071e3;
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.modern-tab i {
  font-size: 16px;
}

/* Modal Content */
.modern-modal-content {
  padding: 24px;
  max-height: calc(90vh - 200px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 113, 227, 0.3) rgba(0, 0, 0, 0.05);
}

.modern-modal-content::-webkit-scrollbar {
  width: 8px;
}

.modern-modal-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

.modern-modal-content::-webkit-scrollbar-thumb {
  background: rgba(0, 113, 227, 0.3);
  border-radius: 8px;
  transition: background 0.3s ease;
}

.modern-modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 113, 227, 0.5);
}

/* Tab Panes */
.modern-tab-pane {
  display: none;
  animation: tabFadeIn 0.4s ease;
}

.modern-tab-pane.active {
  display: block;
  margin-bottom: 54px;
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modern-footer {
  display: flex;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  background: #ffffff00;
  border-bottom: 2px solid rgba(0, 113, 227, 0.1);
  position: sticky;
  bottom: -20px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.modern-footer.profile-active {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(0, 113, 227, 0.1);
  padding: 16px 24px;
}

.modern-footer.password-active {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom: none;
  padding: 0;
}

/* Avatar Upload Section */
.modern-avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding: 24px;
  background: rgba(0, 113, 227, 0.05);
  border-radius: 16px;
  border: 2px dashed rgba(0, 113, 227, 0.2);
}

.avatar-preview-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-preview-wrapper:hover {
  transform: scale(1.05);
}

.avatar-preview {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #0071e3;
  box-shadow: 0 8px 24px rgba(0, 113, 227, 0.3);
  transition: all 0.3s ease;
}

.avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.avatar-preview-wrapper:hover .avatar-overlay {
  opacity: 1;
}

.avatar-overlay i {
  font-size: 24px;
}

.avatar-upload-btn {
  padding: 10px 24px;
  background: #0071e3;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.avatar-upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.4);
}

.avatar-upload-btn:active {
  transform: translateY(0);
}

/* Form Grid */
.modern-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.modern-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

/* Labels */
.modern-label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.3s ease;
}

.modern-label i {
  font-size: 14px;
  color: #0071e3;
}

.modern-form-group:focus-within .modern-label {
  color: #0071e3;
}

.required-star {
  color: #ff3b30;
  font-size: 14px;
  font-weight: 700;
}

/* Inputs */
.modern-input,
.modern-select {
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: #1a202c;
  background: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.modern-input:hover,
.modern-select:hover {
  border-color: #c7c7cc;
}

.modern-input:focus,
.modern-select:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
  transform: translateY(-1px);
}

.modern-input::placeholder {
  color: #94a3b8;
}

/* Password Wrapper */
.modern-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.modern-password-wrapper .modern-input {
  flex: 1;
  padding-right: 48px;
  margin-bottom: 10px;
}

.modern-password-toggle {
  top: 9px;
  position: absolute;
  right: 12px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.modern-password-toggle:hover {
  background: rgba(0, 113, 227, 0.1);
  color: #0071e3;
}

.modern-password-toggle i {
  font-size: 16px;
}

/* CCCD Section */
.cccd-section {
  padding: 20px;
  margin-bottom: 50px;
  background: rgba(52, 199, 89, 0.05);
  border-radius: 12px;
  border: 2px solid rgba(52, 199, 89, 0.15);
}

.cccd-label {
  font-size: 14px !important;
  font-weight: 700 !important;
  margin-bottom: 12px;
}

.cccd-verified {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(52, 199, 89, 0.15);
  border: 2px solid rgba(52, 199, 89, 0.3);
  border-radius: 20px;
  color: #2aa14a;
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
}

.cccd-verified i {
  font-size: 14px;
}

.cccd-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.cccd-upload-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cccd-upload-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cccd-file-btn {
  padding: 10px 16px;
  background: #34c759;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

.cccd-file-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.cccd-file-btn:active {
  transform: translateY(0);
}

/* CCCD Image Preview */
.cccd-preview-container {
  margin-top: 8px;
  display: none; /* Hidden by default, shown by JS when file selected */
}

.cccd-preview-container.has-image {
  display: block;
}

.cccd-preview-image {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  border: 2px solid rgba(0, 113, 227, 0.2);
  background: rgba(248, 250, 252, 0.5);
  padding: 8px;
}

/* Password Info Box */
.password-info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(0, 113, 227, 0.08);
  border-left: 4px solid #0071e3;
  border-radius: 8px;
  margin-bottom: 24px;
}

.password-info-box i {
  font-size: 20px;
  color: #0071e3;
  flex-shrink: 0;
}

.password-info-box p {
  margin: 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

/* Submit Button - Now Sticky at Bottom */
.modern-submit-btn {
  width: calc(100% - 48px);
  padding: 14px 24px;
  background: #0071e3;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.3);
  margin: auto;
  margin-bottom: 20px;
}

.modern-submit-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.modern-submit-btn:hover::before {
  width: 300px;
  height: 300px;
}

.modern-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 113, 227, 0.4);
}

.modern-submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.modern-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.modern-submit-btn i,
.modern-submit-btn span {
  position: relative;
  z-index: 1;
}

/* Loading State */
.modern-submit-btn.loading {
  pointer-events: none;
}

.modern-submit-btn.loading:hover {
  transform: none;
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.3);
}

.modern-submit-btn.loading::before {
  display: none;
}

.modern-submit-btn.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   📱 RESPONSIVE DESIGN
   ======================================== */

/* Tablet */
@media (max-width: 768px) {
  .modern-modal-container {
    width: 95%;
    max-height: 95vh;
  }

  .modern-modal-header {
    padding: 20px 20px 12px;
  }

  .modern-modal-title {
    font-size: 20px;
  }

  .modern-modal-title i {
    font-size: 24px;
  }

  .modern-tabs {
    padding: 12px 20px;
  }

  .modern-tab {
    padding: 10px 16px;
    font-size: 13px;
  }

  .modern-modal-content {
    padding: 20px;
  }

  .modern-form-grid {
    gap: 16px;
  }

  .cccd-upload-grid {
    gap: 12px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .modern-modal-container {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .modern-modal-header {
    padding: 16px;
  }

  .modern-modal-title {
    font-size: 18px;
  }

  .modern-modal-title span {
    display: none;
  }

  .modern-tabs {
    padding: 12px 16px;
    gap: 6px;
  }

  .modern-tab {
    padding: 10px 12px;
    font-size: 12px;
  }

  .modern-tab span {
    display: none;
  }

  .modern-tab i {
    font-size: 18px;
  }

  .modern-modal-content {
    padding: 20px;
    max-height: calc(100vh - 170px);
  }

  .modern-avatar-upload {
    padding: 16px;
  }

  .avatar-preview-wrapper {
    width: 100px;
    height: 100px;
  }

  .modern-form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .modern-form-group {
    gap: 6px;
  }

  .modern-input,
  .modern-select {
    padding: 10px 14px;
  }

  .cccd-section {
    padding: 16px;
  }

  .cccd-upload-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .password-info-box {
    padding: 12px;
  }

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

  .modern-modal-close {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

/* ========================================
   🎨 ACCESSIBILITY & DARK MODE PREP
   ======================================== */

/* Focus states for keyboard navigation */
.modern-tab:focus,
.modern-input:focus,
.modern-select:focus,
.modern-submit-btn:focus {
  outline: 2px solid #0071e3;
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .modern-profile-modal,
  .modern-modal-container,
  .modern-tab-pane,
  .modern-tab,
  .modern-input,
  .modern-select,
  .modern-submit-btn,
  .avatar-preview-wrapper {
    animation: none;
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .modern-modal-container {
    border: 3px solid #000;
  }

  .modern-tab.active {
    border: 2px solid #000;
  }

  .modern-input:focus,
  .modern-select:focus {
    border-width: 3px;
  }
}
