/* LOGIN & AUTH STYLES */

/* HONEY POT */
.hidden-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.login-container {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.74);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-container.hidden {
  display: none;
}

.login-box {
  background:
    #090f29;
  border-radius: 36px;
  padding: 48px 42px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(18px);
  box-shadow:
    0 20px 60px rgba(15,23,42,0.12),
    0 0 1px rgba(15,23,42,0.08);
}

.close-login-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s ease;
}

.close-login-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(90deg);
}

.login-box {
  position: relative;
}

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-header h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -2px;
  margin-bottom: 8px;
  background:#ac34fd;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-header p {
  color: #fff;
  font-size: 1.05rem;
}

.auth-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  background: #fff;
  padding: 8px;
  border-radius: 18px;
}

.auth-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 14px;
  cursor: pointer;
  transition: 0.25s ease;
  box-shadow: none;
}

.auth-tab:hover {
  background: rgba(255,255,255,0.5);
  transform: none;
}

.auth-tab.active {
  background: #ce36ff;
  color: white;
  box-shadow:
    0 8px 20px rgba(37,99,235,0.2);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-group input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid #dbe4f0;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  border-radius: 16px;
  font-size: 0.95rem;
  transition: 0.25s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow:
    0 0 0 4px rgba(37,99,235,0.1);
}

.auth-submit-btn {
  width: 100%;
  padding: 14px;
  background: #ce36ff;
  color: #fff;
  border: none;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.25s ease;
  box-shadow:
    0 8px 20px rgba(37,99,235,0.2);
  margin-top: 12px;
}

.auth-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 28px rgba(37,99,235,0.28);
  opacity: 0.98;
}

.auth-submit-btn:active {
  transform: translateY(0);
}

.auth-error {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(239,68,68,0.1);
  color: #fff !important;
  border-radius: 12px;
  text-align: center;
  font-size: 1.1rem;
  display: none;
  border: 1px solid rgba(239,68,68,0.2);
}

.auth-error:not(:empty) {
  display: block;
}

#signupError {
  color: var(--danger);
}

#signupError.success-message {
  background: rgba(16,185,129,0.1);
  color: var(--green);
  border-color: rgba(16,185,129,0.2);
}

.dashboard-section {
  display: block;
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  margin: -36px;
  padding: 28px;
}

.dashboard-section::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #000;;
  pointer-events: none;
}

.dashboard-section > * {
  position: relative;
  z-index: 1;
}

.dashboard-section .hero,
.dashboard-section .card {
  color: #ffffff;
  background: #0a183a;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 20px;
  background: #090f29;
  border: 1px solid rgba(0, 0, 0, 0.72);
  border-radius: 30px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.22);
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 18px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  color: #0f172a;
  font-weight: 800;
  font-size: 1rem;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #f8fafc 0 28%, transparent 30%),
    linear-gradient(135deg, #ce36ff, #8b1dff);
  box-shadow: 0 8px 18px rgba(206,54,255,0.24);
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  color: #64748b;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.side-nav a.active,
.side-nav a:hover {
  color: #0f172a;
  background: #ffffff;
}

.side-nav a.active::before {
  content: '';
  position: absolute;
  left: -14px;
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: #ce36ff;
}

.sidebar-card {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px;
  color: #ffffff;
  background: #ac34fd;
  border-radius: 18px;
  box-shadow: 0 18px 34px rgba(6,78,59,0.22);
}

.sidebar-card span {
  color: rgba(255,255,255,0.72);
  font-size: 0.78rem;
  font-weight: 700;
}

.sidebar-card strong {
  font-size: 0.95rem;
}

.mini-action {
  min-height: 34px;
  padding: 0 12px;
  color: #064e3b;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: none;
  font-size: 0.78rem;
}

.dashboard-main {
  min-width: 0;
}

@media (min-width: 761px) {
  .dashboard-shell {
    height: calc(100vh - 72px);
    overflow: hidden;
  }

  .dashboard-sidebar {
    position: sticky;
    top: 20px;
    height: calc(100vh - 112px);
    align-self: start;
  }

  .dashboard-main {
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    padding-right: 6px;
  }
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
  padding: 0;
  border-bottom: 0;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(360px, 100%);
  min-height: 44px;
  padding: 0 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
}

.search-shell span {
  color: #94a3b8;
  font-size: 1rem;
}

.search-shell input {
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  font-size: 0.9rem;
}

.search-shell input:focus {
  box-shadow: none;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  color: #ce36ff;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  box-shadow: none;
  font-size: 0.8rem;
}

.logout-btn {
  min-height: 42px;
  padding: 0 18px;
  background: #ce36ff;
  border-radius: 999px;
  box-shadow: none;
}

.signin-btn {
  min-height: 42px;
  padding: 0 18px;
  background: #ce36ff;
  color: white;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
  box-shadow: none;
}

.signin-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(206, 54, 255, 0.3);
}

.container.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  max-width: none;
  margin: 0;
}

.dashboard-grid > * {
  grid-column: span 12;
  margin-bottom: 0;
}

.dashboard-intro {
  grid-column: span 12;
  min-height: 150px;
  padding: 28px;
  border-radius: 22px;
}

.dashboard-intro h1 {
  max-width: 560px;
  font-size: 2.25rem;
  letter-spacing: 0;
}

.dashboard-intro p {
  font-size: 0.98rem;
}

.phase-badge {
  background: #ce36ff;
  border-radius: 999px;
  box-shadow: none;
}

.checkin-card {
  grid-column: span 7;
}

.targets-card {
  grid-column: span 5;
}

.trend-card {
  grid-column: span 12;
}

.weekly-card {
  grid-column: span 12;
}

.insights-card,
.recap-card {
  grid-column: span 6;
}

.history-card {
  grid-column: span 12;
}

.dashboard-section .card {
  padding: 22px;
  border-radius: 22px;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 12px 34px rgba(0,0,0,0.18);
}

.section-header {
  margin-bottom: 18px;
}

.section-header h2 {
  font-size: 1.2rem;
  letter-spacing: 0;
}

.section-header p {
  color: rgba(255,255,255,0.68);
  font-size: 0.88rem;
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.stat-card,
.week-card,
.insight-card {
  color: #ffffff;
  background: #0a183a;
  border-color: rgba(255,255,255,0.1);
  border-radius: 18px;
  box-shadow: none;
}

.dashboard-section label,
.dashboard-section .metric-top small,
.dashboard-section .metric-unit,
.dashboard-section .hero p,
.dashboard-section .week-card p,
.dashboard-section .insight-card p,
.dashboard-section .stat-card h3 {
  color: rgba(255,255,255,0.68);
}

#dashboardSearch {
    background-color: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
}

#dashboardSearch::placeholder {
    color: #6b7280;
}

.dashboard-section input {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
}

.dashboard-section input::placeholder {
  color: rgba(255,255,255,0.42);
}

.metric-card {
  padding: 18px;
}

.metric-top {
  margin-bottom: 14px;
}

.metric-card input {
  font-size: 1.45rem;
  letter-spacing: 0;
}

.save-btn {
  min-height: 44px;
  margin-top: 16px;
  padding: 0 18px;
  border-radius: 999px;
  background: #ce36ff;
  box-shadow: none;
}

.goals-grid,
.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.targets-box {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.targets-box input,
input {
  border-radius: 14px;
  padding: 13px 14px;
}

.chart-container {
  height: 330px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border-radius: 18px;
}

.stat-card {
  padding: 18px;
}

.stat-value {
  font-size: 2rem;
  letter-spacing: 0;
}

.week-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.insights-container {
  grid-template-columns: 1fr;
  gap: 12px;
}

.entries-table th,
.entries-table td {
  color: #ffffff;
  border-bottom-color: rgba(255,255,255,0.1);
  padding: 14px;
}

.entries-table thead,
.entries-table tbody tr:hover {
  background: rgba(255,255,255,0.05);
}

.dashboard-section .entries-table td.goal-met,
.dashboard-section .entries-table td.goal-not-met {
  color: #ffffff;
}

.dashboard-section .history-month .entries-table th {
  color: #64748b;
}

.dashboard-section .history-month .entries-table td {
  color: #334155;
  border-bottom-color: #e2e8f0;
}

.dashboard-section .history-month .entries-table thead,
.dashboard-section .history-month .entries-table tbody tr:hover {
  background: rgba(248,250,252,0.9);
}

.dashboard-section .history-month .entries-table td.goal-met {
  color: var(--green);
}

.dashboard-section .history-month .entries-table td.goal-not-met {
  color: var(--danger);
}

.dashboard-section.hidden {
  display: none;
}

.logout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(15,23,42,0.16);
  opacity: 0.96;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: brightness(0) invert(1);
    opacity: 1;
}

@media (max-width: 760px) {
  .dashboard-section {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 10px;
    overflow-x: hidden;
  }

  .dashboard-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    min-height: auto;
    padding: 10px;
    border-radius: 20px;
  }

  .dashboard-main,
  .container.dashboard-grid,
  .dashboard-grid > *,
  .dashboard-section .card,
  .metric-card,
  .stat-card,
  .week-card,
  .insight-card,
  .targets-box,
  .chart-container {
    min-width: 0;
    max-width: 100%;
  }

  .dashboard-sidebar {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    min-height: auto;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 18px;
  }

  .brand-lockup {
    margin-bottom: 12px;
  }

  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .side-nav a {
    justify-content: center;
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 12px;
    background: #ffffff;
    white-space: nowrap;
    font-size: 0.82rem;
  }

  .side-nav a.active::before,
  .sidebar-card {
    display: none;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }

  .search-shell {
    width: 100%;
    min-height: 40px;
  }

  .profile-actions {
    justify-content: space-between;
  }

  .container.dashboard-grid,
  .metric-grid,
  .goals-grid,
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .week-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid > *,
  .checkin-card,
  .targets-card,
  .trend-card,
  .weekly-card,
  .insights-card,
  .recap-card {
    grid-column: 1;
  }

  .dashboard-intro h1 {
    font-size: 2rem;
  }

  .dashboard-intro,
  .dashboard-section .card {
    padding: 16px;
    border-radius: 18px;
  }

  .dashboard-intro {
    min-height: auto;
    gap: 14px;
  }

  .dashboard-intro h1 {
    font-size: 1.75rem;
    line-height: 1.05;
  }

  .dashboard-intro p,
  .section-header p {
    font-size: 0.86rem;
    line-height: 1.45;
  }

  .section-header {
    gap: 12px;
    margin-bottom: 14px;
  }

  .section-header h2 {
    font-size: 1.08rem;
  }

  .date-wrap,
  .phase-badge,
  .save-btn,
  .logout-btn,
  .signin-btn,
  .today-btn {
    width: 100%;
    max-width: 100%;
  }

  .date-nav {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 8px;
    width: 100%;
    max-width: 100%;
  }

  .date-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .today-btn {
    grid-column: 1 / -1;
    min-height: 40px;
  }

  .metric-card,
  .stat-card,
  .week-card,
  .insight-card {
    padding: 14px;
    border-radius: 16px;
  }

  .metric-card input {
    font-size: 1.25rem;
  }

  .targets-box input,
  input {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .chart-container {
    height: 250px;
    padding: 8px;
  }

  #trendChart {
    height: 234px !important;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .entries-table {
    min-width: 520px;
  }

  .entries-table th,
  .entries-table td {
    padding: 12px;
    font-size: 0.84rem;
  }

  .entries-table button {
    padding: 8px 10px;
    font-size: 0.78rem;
  }
}

@media (min-width: 761px) and (max-width: 1080px) {
  .dashboard-shell {
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 16px;
  }

  .container.dashboard-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .dashboard-grid > *,
  .checkin-card,
  .targets-card,
  .trend-card,
  .weekly-card,
  .insights-card,
  .recap-card,
  .history-card {
    grid-column: span 6;
  }

  .metric-grid,
  .goals-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* RESPONSIVE LOGIN */

@media (max-width: 480px) {
  .login-box {
    padding: 32px 24px;
    border-radius: 28px;
  }

  .login-header h1 {
    font-size: 2.2rem;
  }

  .login-header p {
    font-size: 0.95rem;
  }

  .auth-tabs {
    margin-bottom: 24px;
  }

  .auth-tab {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .form-group input {
    padding: 12px 14px;
    font-size: 0.9rem;
  }
}

/* CONFIRM MODAL */

.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.confirm-card {
  background: linear-gradient(135deg, #1a1f3a 0%, #0f1628 100%);
  border-radius: 20px;
  padding: 32px;
  width: 90%;
  max-width: 320px;
  box-shadow: 
    0 20px 60px rgba(15, 23, 42, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.confirm-message {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 24px;
  text-align: center;
  font-weight: 500;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.confirm-cancel,
.confirm-delete {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.confirm-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.confirm-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.confirm-delete {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.confirm-delete:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* IN-APP ALERT */

.in-app-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  z-index: 2001;
  display: none;
  max-width: 90%;
  animation: fadeInOut 0.3s ease-in-out;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.in-app-alert-success {
  background: #c53afe;
  color: white;
}

.in-app-alert-warning {
  background: linear-gradient(135deg, #ffd43b 0%, #fab005 100%);
  color: #333;
}

.in-app-alert-danger {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  10% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  90% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
}
