/* ===========================
   MODALS - BASE STYLES
   =========================== */
.modern-modal,
.modern-profile-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: 1rem;
}

.modern-modal.active,
.modern-profile-modal.active {
  display: flex;
}

/* Modal Backdrop */
.modern-modal::before,
.modern-profile-modal::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: -1;
}

/* Modal Content */
.modal-content {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal Header */
.modal-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
}

.close-modal {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  border: none;
  color: var(--gray-600);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal:hover {
  background: var(--gray-200);
  color: var(--gray-900);
  transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-icon {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-icon svg {
  width: 64px;
  height: 64px;
}

.modal-body p {
  text-align: center;
  margin-bottom: 0.75rem;
  color: var(--gray-700);
}

.modal-body .secondary-text {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 1rem;
}

/* Modal Footer */
.modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 1rem;
}

.modal-footer button {
  flex: 1;
}

/* ===========================
   PROFILE PICTURE MODAL SPECIFIC
   =========================== */
.modern-profile-modal .modal-content {
  max-width: 400px;
}

.image-preview-container {
  text-align: center;
  margin-bottom: 1.5rem;
}

#image-preview {
  width: 150px;
  height: 150px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 4px solid var(--gray-200);
  margin: 0 auto;
}

.upload-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-btn {
  padding: 1rem 1.5rem;
  background: var(--gray-100);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-lg);
  color: var(--gray-700);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.option-btn:hover {
  background: var(--gray-200);
  border-color: var(--primary);
  color: var(--primary);
}

.option-btn i {
  font-size: 1.125rem;
}

/* ===========================
   BOTTOM SHEET (ACCOUNT SETTINGS)
   =========================== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.overlay.active {
  display: block;
  opacity: 1;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-2xl);
  z-index: var(--z-modal);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.bottom-sheet.active {
  transform: translateY(0);
}

.bottom-sheet-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}

.bottom-sheet-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0;
}

.close-sheet {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  border: none;
  color: var(--gray-600);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-sheet:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

/* ===========================
   RESPONSIVE MODAL ADJUSTMENTS
   =========================== */

/* Tablet and up */
@media (min-width: 640px) {
  .modern-modal,
  .modern-profile-modal {
    padding: 2rem;
  }
  
  .modal-content {
    max-width: 500px;
  }
  
  .bottom-sheet {
    border-radius: var(--radius-xl);
    max-width: 500px;
    margin: 2rem auto;
    transform: translateY(100vh);
  }
  
  .bottom-sheet.active {
    transform: translateY(0);
  }
}

/* Desktop */
@media (min-width: 768px) {
  .modal-header {
    padding: 1.75rem 2rem 1.25rem;
  }
  
  .modal-header h3 {
    font-size: 1.5rem;
  }
  
  .modal-body {
    padding: 2rem;
  }
  
  .modal-footer {
    padding: 1.25rem 2rem 2rem;
  }
  
  .bottom-sheet-header {
    padding: 1.75rem 2rem 1.25rem;
  }
  
  .bottom-sheet-header h3 {
    font-size: 1.5rem;
  }
}

/* ===========================
   MOBILE BOTTOM NAVIGATION
   =========================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  box-shadow: var(--shadow-lg);
  z-index: 90;
  padding: 0.5rem 0;
  transition: transform 0.3s ease;
}

.bottom-nav.nav-hidden {
  transform: translateY(100%);
}

.bottom-nav ul {
  display: flex;
  justify-content: space-around;
  list-style: none;
  padding: 0;
  margin: 0;
}

.bottom-nav li {
  flex: 1;
  text-align: center;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  color: var(--gray-600);
  text-decoration: none;
  transition: var(--transition);
  border-radius: var(--radius-md);
}

.bottom-nav a:hover,
.bottom-nav a.active {
  color: var(--primary);
}

.bottom-nav i {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.bottom-nav span {
  font-size: 0.75rem;
  font-weight: 500;
}

/* Hide bottom nav on desktop */
@media (min-width: 900px) {
  .bottom-nav {
    display: none;
  }
}

/* Hide scroll effect on desktop */
@media (min-width: 900px) {
  .bottom-nav.nav-hidden {
    transform: none;
  }
}

/* Notification Badge */
.icon-with-badge {
  position: relative;
  display: inline-block;
}

.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--red);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ===========================
   BOTTOM SHEET (ACCOUNT SETTINGS)
   =========================== */
@media (max-width: 639px) {
  .bottom-sheet {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-height: 90vh;
  }
  
  .bottom-sheet-header {
    padding: 1.25rem 1.5rem 1rem;
  }
  
  #profile-completion-form {
    padding: 0.5rem 1rem 1rem;
  }
}

@media (min-width: 640px) {
  .bottom-sheet {
    border-radius: var(--radius-xl);
    max-width: 500px;
    margin: 2rem auto;
  }
}

/* ===========================
   DARK MODE SUPPORT
   =========================== */
@media (prefers-color-scheme: dark) {
  .modern-modal::before,
  .modern-profile-modal::before {
    background: rgba(0, 0, 0, 0.7);
  }

  .modal-content {
    background: #1a1a1a;
    color: #d4d4d4;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  }

  .modal-header {
    background: #252525;
    border-bottom-color: #2d2d2d;
  }

  .modal-header h2 {
    color: #d4d4d4;
  }

  .close-btn {
    color: #b3b3b3;
  }

  .close-btn:hover {
    background: #2d2d2d;
    color: #d4d4d4;
  }

  .form-group label {
    color: #d4d4d4;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    background: #252525;
    color: #d4d4d4;
    border-color: #2d2d2d;
  }

  .form-group input:focus,
  .form-group textarea:focus,
  .form-group select:focus {
    background: #2d2d2d;
    border-color: #28a745;
  }

  .form-group input::placeholder,
  .form-group textarea::placeholder {
    color: #999999;
  }

  .modal-footer {
    background: #252525;
    border-top-color: #2d2d2d;
  }

  .btn-primary {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
  }

  .btn-primary:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #0f5e20 100%);
  }

  .btn-secondary {
    background: #2d2d2d;
    color: #d4d4d4;
    border-color: #3d3d3d;
  }

  .btn-secondary:hover {
    background: #3d3d3d;
    border-color: #4d4d4d;
  }

  .bottom-sheet {
    background: #1a1a1a;
    border-color: #2d2d2d;
  }

  .bottom-sheet-header {
    background: #252525;
    border-bottom-color: #2d2d2d;
  }

  .bottom-sheet-header h2 {
    color: #d4d4d4;
  }
}