/* ===================================
   JROM Dashboard, Login, Settings CSS
   =================================== */

/* ============ AUTH PAGES ============ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--green-mist) 0%, var(--cream-pale) 60%);
  padding: 6rem 1.5rem 3rem;
}

.auth-card {
  background: var(--cream-white);
  border: 1.5px solid var(--cream-mid);
  border-radius: var(--radius-xl);
  padding: 3rem;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-xl);
}

.auth-logo { font-size: 2rem; font-weight: 900; color: var(--green-primary); margin-bottom: 0.25rem; }
.auth-tagline { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 2rem; }

.auth-title { font-size: 1.5rem; margin-bottom: 0.35rem; }
.auth-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 2rem; }

.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  color: var(--text-light);
  font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cream-mid);
}

.auth-switch {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}
.auth-switch a {
  color: var(--green-primary);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-base);
}
.auth-switch a:hover { color: var(--green-deep); }

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--cream-mid);
  margin-bottom: 2rem;
}
.auth-tab {
  flex: 1;
  padding: 0.75rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-base);
}
.auth-tab.active { color: var(--green-primary); border-bottom-color: var(--green-primary); }
.auth-tab-panel { display: none; }
.auth-tab-panel.active { display: flex; flex-direction: column; gap: 1.1rem; }

/* ============ DASHBOARD LAYOUT ============ */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 72px;
}

.dashboard-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--green-deep);
  color: var(--cream-light);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 2rem 1.5rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--green-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--cream-white);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-name { font-size: 1rem; font-weight: 700; color: var(--cream-white); }
.sidebar-user-loc { font-size: 0.8rem; color: var(--green-pale); margin-top: 0.15rem; }

.sidebar-nav {
  padding: 1.25rem 1rem;
  flex: 1;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--green-pale);
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all var(--transition-base);
  margin-bottom: 0.2rem;
  border: none;
  background: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.sidebar-nav-item:hover { background: rgba(255,255,255,0.07); color: var(--cream-white); }
.sidebar-nav-item.active { background: rgba(255,255,255,0.12); color: var(--cream-white); }
.sidebar-nav-item .nav-icon { font-size: 1.1rem; flex-shrink: 0; }

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-signout {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255,255,255,0.4);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-base);
  background: none;
  border: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0;
}
.sidebar-signout:hover { color: var(--cream-white); }

/* Dashboard Main Content */
.dashboard-main {
  flex: 1;
  padding: 2.5rem;
  background: var(--cream-pale);
  min-height: 100%;
}

.dashboard-panel { display: none; }
.dashboard-panel.active { display: block; }

.dashboard-greeting {
  margin-bottom: 2.5rem;
}
.dashboard-greeting h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}
.dashboard-greeting p { color: var(--text-muted); }

/* Stats Overview Cards */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.overview-card {
  background: var(--cream-white);
  border: 1.5px solid var(--cream-mid);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all var(--transition-slow);
}
.overview-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.overview-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--green-mist);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.overview-text {}
.overview-value {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text-dark);
  line-height: 1;
}
.overview-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.2rem;
}

/* Job Form */
.job-form-card {
  background: var(--cream-white);
  border: 1.5px solid var(--cream-mid);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.5rem;
}
.job-form-card h2 { margin-bottom: 0.4rem; }
.job-form-card > p { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.95rem; }

.job-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.job-form .form-group.full-width { grid-column: 1 / -1; }
.form-submit-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Past Jobs */
.past-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.past-job-card {
  background: var(--cream-white);
  border: 1.5px solid var(--cream-mid);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}
.past-job-card:hover { box-shadow: var(--shadow-md); }
.past-job-icon {
  font-size: 2rem;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  background: var(--green-mist);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.past-job-info { flex: 1; }
.past-job-title { font-weight: 700; color: var(--text-dark); font-size: 0.95rem; }
.past-job-meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }
.past-job-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.past-job-cost {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--green-primary);
}
/* Update the existing .past-job-tip-btn to a more generic class name */
.past-job-action-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-warm);
  background: rgba(196, 135, 74, 0.1);
  border: 1px solid rgba(196, 135, 74, 0.25);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
}
.past-job-action-btn:hover {
  background: var(--accent-warm);
  color: white;
}
.past-job-action-btn.tipped,
.past-job-action-btn.paid {
  background: var(--green-mist);
  color: var(--green-primary);
  border-color: var(--green-pale);
  cursor: default;
}
/* You can also style .pay-action-btn specifically if you want it to look different from the tip button */
.pay-action-btn {
    color: var(--green-primary);
    background: var(--green-mist);
    border: 1px solid var(--green-pale);
}
.pay-action-btn:hover {
    background: var(--green-primary);
    color: white;
}

/* ============ MODAL STYLES & FIXES ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 32, 22, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-card {
  box-sizing: border-box;
  background: var(--cream-white);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: calc(100% - 2rem);
  max-width: 440px;
  box-shadow: var(--shadow-xl);
  transform: scale(0.94) translateY(20px);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.open .modal-card { transform: scale(1) translateY(0); }
.modal-card h3 { margin-bottom: 0.35rem; }
.modal-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

.tip-presets {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tip-preset {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--cream-deep);
  background: var(--cream-white);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-base);
}
.tip-preset:hover, .tip-preset.active {
  border-color: var(--accent-warm);
  background: rgba(196, 135, 74, 0.08);
  color: var(--accent-warm);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  width: 100%;
}

.modal-actions .btn {
  padding: 0.7rem 1.25rem;
  font-size: 0.9rem;
  white-space: normal;
  text-align: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 130px;
}

/* Red Danger Button */
.btn-danger {
  background: #dc2626;
  color: var(--cream-white);
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.35);
}

.btn-danger:hover {
  background: #b91c1c;
  box-shadow: 0 8px 32px rgba(220, 38, 38, 0.45);
  transform: translateY(-2px) scale(1.02);
}

.btn-danger:active {
  transform: translateY(0) scale(0.99);
}

/* Custom Delete Account Modal Badge */
.delete-modal-card {
  text-align: center;
}

.delete-icon-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1.25rem;
  border: 4px solid #fef2f2;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.18);
  animation: pulseWarning 2s infinite ease-in-out;
}

@keyframes pulseWarning {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.18);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 6px 22px rgba(220, 38, 38, 0.32);
  }
}

/* Mobile toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--green-primary);
  color: var(--cream-white);
  font-size: 1.3rem;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 200;
  border: none;
}

/* Responsive */
@media (max-width: 900px) {
  .dashboard-layout { flex-direction: column; }
  .dashboard-sidebar {
    position: fixed;
    left: -280px;
    top: 72px;
    height: calc(100vh - 72px);
    z-index: 200;
    box-shadow: var(--shadow-xl);
  }
  .dashboard-sidebar.open { left: 0; }
  .sidebar-toggle { display: flex; }
  .dashboard-main { padding: 1.5rem; }
  .overview-grid { grid-template-columns: 1fr; }
  .job-form { grid-template-columns: 1fr; }
  .job-form .form-group.full-width { grid-column: 1; }
  .form-submit-row { grid-column: 1; }
  .past-job-card { flex-wrap: wrap; gap: 1rem; }
}

/* Placeholder Security Buttons Row */
.account-actions-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .account-actions-group {
    flex-direction: column;
  }
  .account-actions-group .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Vertical Security Actions */
.account-actions-vertical {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem; /* 0.75rem distance between Change Email and Reset Password */
}

.account-actions-vertical .btn {
  width: auto;
}

/* Bottom Submit Row */
.form-submit-row.between {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: -0.5rem; /* Counteracts .job-form's 1.25rem grid gap to achieve an exact 0.75rem spacing */
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .account-actions-vertical {
    align-items: stretch;
  }
  .account-actions-vertical .btn {
    width: 100%;
    justify-content: center;
  }

  /* 1. Stack the avatar and the button container vertically */
  #settingsForm .form-group.full-width:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem !important;
  }

  /* 2. Override the JS 'inline-block' and the inline 'margin-left' */
  #deletePhotoBtn {
    margin-left: 0 !important;
    margin-top: 0.5rem;
    display: block !important; 
    width: 100%;
  }

  /* 3. Make the Upload button full-width as well so they match neatly */
  #settingsForm button[onclick*="profilePicInput"] {
    display: block;
    width: 100%;
  }

  /* 1. Reduce padding on mobile to give elements more breathing room */
  .past-job-card {
    padding: 1.25rem;
    gap: 1rem;
  }

  /* 2. CRITICAL: Prevent long text from blowing out the flex layout */
  .past-job-info {
    min-width: 0; 
  }

  /* 3. Force the price & button down to a new row and space them out */
  .past-job-right {
    flex-basis: 100%; /* Forces it to take the full width of the new line */
    flex-direction: row; /* Places price and button side-by-side */
    justify-content: space-between; /* Price on the left, button on the right */
    align-items: center;
    margin-top: 0.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--cream-mid); /* Adds a clean divider line */
  }
}

/* ---- FORM VALIDATION & ERROR STYLING ---- */
.field-error {
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 1.1rem;
  margin-top: 0.25rem;
}

input.invalid,
select.invalid,
textarea.invalid {
  border-color: #dc2626 !important;
  background-color: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

@media (max-width: 600px) {
  /* 1. Allow the text container to shrink properly */
  .overview-text {
    min-width: 0; 
  }

  /* 2. Force long numbers to wrap, and reduce font size slightly for small screens */
  .overview-value {
    font-size: 1.5rem; /* Shrinks the text down a bit from 1.75rem */
    word-break: break-word; /* Forces long numbers to wrap to the next line instead of spilling out */
    overflow-wrap: anywhere;
  }
  
  /* 3. Give the card contents a little more breathing room by reducing padding */
  .overview-card {
    padding: 1.25rem; 
  }
}