/* ============================
   Base
   ============================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #020617;
  --bg-elevated: #020617;
  --bg-card: #020617;
  --border: #1f2937;
  --border-soft: #111827;
  --accent: #3b82f6;
  --accent-soft: #1d4ed8;
  --accent-dark: #2563eb;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #f97373;
  --danger-soft: #451a1a;
  --success: #4ade80;
  --success-soft: #14532d;
  --warning-soft: #513c06;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
}

/* Generic page centering for all major page types */
.auth-body,
.planner-body,
.editor-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0.75rem;
  background:
    radial-gradient(circle at top, #1d2a50 0, #020617 45%, #020617 100%);
}

/* Make sure content still scrolls when taller than viewport */
.auth-body > *,
.planner-body > *,
.editor-body > * {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* ============================
   Auth pages (login/register)
   ============================ */

.auth-card {
  background: var(--bg-elevated);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
  padding: 2rem 2.5rem;
  max-width: 420px;
  width: 100%;
  border: 1px solid var(--border);
}

.auth-card h1 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  text-align: center;
}

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

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  font-size: 0.9rem;
  background: #020617;
  color: var(--text-main);
}

.auth-card input::placeholder {
  color: #4b5563;
}

.auth-card button {
  margin-top: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  border: none;
  background: var(--accent-soft);
  color: #e5e7eb;
  font-weight: 500;
  cursor: pointer;
}

.auth-card button:hover {
  background: var(--accent-dark);
}

.auth-errors {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.85rem;
  border: 1px solid #7f1d1d;
}

.auth-errors li + li {
  margin-top: 0.3rem;
}

.auth-link {
  margin-top: 1rem;
  font-size: 0.9rem;
  text-align: center;
  color: var(--text-muted);
}

/* ============================
   Planner main UI
   ============================ */

.planner-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  background: #020617;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
}

.planner-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.planner-header h1 {
  margin: 0;
  font-size: 1.6rem;
}

.user-info {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.user-info a {
  margin-left: 0.25rem;
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
}

.controls-bar select,
.controls-bar button {
  font-size: 0.9rem;
}

.controls-bar select {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: #020617;
  color: var(--text-main);
}

.controls-bar button {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--accent-soft);
  background: rgba(37, 99, 235, 0.15);
  color: #bfdbfe;
  cursor: pointer;
}

.controls-bar button:hover {
  background: rgba(37, 99, 235, 0.3);
}

/* Day sections */

.day {
  display: none;
}

.day.active {
  display: block;
  margin: 0 auto;
  max-width: 800px;
}

.day h2 {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 1.3rem;
}

.day-goal {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Task card */

.task {
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}

.task-main {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.task-main label {
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-main);
}

.task-check {
  margin-top: 0.15rem;
}

.task.completed {
  opacity: 0.6;
  border-style: dashed;
}

.task-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.timer-display {
  min-width: 3.2rem;
  text-align: center;
  padding: 0.2rem 0.3rem;
  border-radius: 6px;
  background: #020617;
  color: #e5e7eb;
  border: 1px solid #4b5563;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
}

.task-controls button {
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: #020617;
  color: var(--text-main);
  cursor: pointer;
}

.task-controls button:hover {
  background: #111827;
}

.reminder-minutes {
  width: 3.4rem;
  padding: 0.1rem 0.25rem;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  font-size: 0.8rem;
  background: #020617;
  color: var(--text-main);
}

.reminder-btn {
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--accent-soft);
  background: rgba(37, 99, 235, 0.15);
  color: #bfdbfe;
  cursor: pointer;
}

.reminder-btn:hover {
  background: rgba(37, 99, 235, 0.3);
}

.task.timer-done {
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--success-soft);
}

/* ============================
   Editor / Admin / Templates
   ============================ */

.editor-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  background: #020617;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
}

.editor-header {
  margin-bottom: 1.25rem;
}

.editor-header h1 {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
}

.editor-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.editor-header a {
  margin-left: 0.25rem;
}

.editor-section {
  margin-bottom: 1.5rem;
  background: #020617;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  padding: 1rem 1.1rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
}

.editor-section h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.2rem;
}

.editor-info {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.editor-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.editor-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  min-width: 180px;
  color: var(--text-muted);
}

.editor-form input[type="text"],
.editor-form input[type="number"],
.editor-form input[type="email"],
.editor-form input[type="password"],
.editor-form input[type="file"],
.editor-form select,
.editor-form textarea {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  font-size: 0.9rem;
  background: #020617;
  color: var(--text-main);
}

.editor-form textarea {
  min-width: 220px;
}

.editor-form button {
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  border: none;
  background: var(--accent-soft);
  color: #e5e7eb;
  font-size: 0.9rem;
  cursor: pointer;
}

.editor-form button:hover {
  background: var(--accent-dark);
}

/* Auth errors reused in editor */
.editor-section .auth-errors {
  margin-bottom: 0.75rem;
}

/* ============================
   Admin / users table
   ============================ */

.editor-table-wrapper {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.editor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.editor-table th,
.editor-table td {
  white-space: nowrap;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

/* Header row */
.editor-table thead th {
  background: #020617;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Status column (e.g. Deleted/Active) */
.editor-table td:nth-child(5) {
  font-size: 0.85rem;
}

/* Actions column layout */
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 240px;
}

/* Buttons/links in actions */
.editor-actions button,
.editor-actions a {
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  border: 1px solid var(--border-soft);
  background: #020617;
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.editor-actions button:hover,
.editor-actions a:hover {
  background: #111827;
}

/* Promotion code input */
.editor-actions input[type="password"],
.editor-actions input[type="text"] {
  width: 120px;
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
}

/* Mini-forms in actions */
.editor-actions form {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
}

/* Optional badge styles */
.badge-admin,
.badge-deleted,
.badge-verified {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-admin {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.badge-verified {
  background: rgba(74, 222, 128, 0.15);
  color: #bbf7d0;
}

.badge-deleted {
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca;
}

/* ============================
   Responsive tweaks
   ============================ */

@media (max-width: 768px) {
  .planner-container,
  .editor-container {
    padding: 1rem 0.75rem 1.5rem;
  }

  .planner-header {
    gap: 0.5rem;
  }

  .task {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-controls {
    align-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .editor-form {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-table th,
  .editor-table td {
    padding: 0.4rem 0.5rem;
  }

  .editor-actions {
    min-width: 200px;
  }

  .editor-actions button,
  .editor-actions a {
    font-size: 0.8rem;
  }
}

/* ===================================
   GLOBAL FULL CENTERING FIX
   =================================== */

/* Center all header, footer, and top-bar content */
header,
footer,
.top-bar,
.planner-header,
.editor-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Center the navigation / links inside headers too */
header a,
footer a,
.planner-header a,
.editor-header a {
  text-align: center;
}

/* Center the controls bar (day selector + buttons) */
.controls-bar {
  justify-content: center;
  text-align: center;
  width: 100%;
}

/* Make the entire planner content centered horizontally */
.planner-container {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* Ensure day content itself is centered but tasks still left-align internally */
.day.active {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* Left-align task text only (so labels look natural) */
.task-main label {
  text-align: left;
}

/* Center admin panels and headings */
.editor-container,
.editor-section,
.editor-header {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* Center admin table wrapper */
.editor-table-wrapper {
  margin-left: auto;
  margin-right: auto;
}

/* Center the admin section descriptions */
.editor-info {
  text-align: center;
}

/* Ensure forms inside admin pages center align */
.editor-form {
  justify-content: center;
  text-align: center;
}

/* Fix top navigation alignment */
.editor-header p,
.user-info {
  text-align: center;
  width: 100%;
}

/* Footer (if any) should be centered too */
footer {
  justify-content: center;
  text-align: center;
  width: 100%;
}

