/* Guardianage — Mobile-first operational app styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
}

/* --- Login --- */

.login-page {
  background: #1a2332;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 360px;
  padding: 24px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
  color: #fff;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.login-header p {
  font-size: 14px;
  color: #8899aa;
}

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

.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #8899aa;
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #334455;
  border-radius: 8px;
  background: #0d1520;
  color: #fff;
  outline: none;
}

.login-form input:focus {
  border-color: #4a9eff;
}

.error-message {
  background: #ff4444;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #4a9eff;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #3a8eef;
}

.btn-full {
  width: 100%;
  padding: 14px;
  font-size: 16px;
}

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
  background: transparent;
  color: #667;
  border: 1px solid #ddd;
  border-radius: 6px;
}

/* --- App Header --- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #1a2332;
  color: #fff;
}

.app-header h1 {
  font-size: 17px;
  font-weight: 600;
}

.app-header .btn-small {
  color: #8899aa;
  border-color: #334;
}

/* --- Dashboard --- */

.dashboard {
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: #888;
  font-size: 15px;
}

/* --- Status Cards --- */

.status-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.status-row {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

.status-row .status-card {
  flex: 1;
}

.status-label {
  font-size: 12px;
  font-weight: 500;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.status-value {
  font-size: 16px;
  font-weight: 600;
}

.status-value.big {
  font-size: 28px;
}

.season-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-card.overdue .status-value {
  color: #e53e3e;
}

/* --- Task Sections --- */

.task-section {
  margin-top: 20px;
}

.task-section h2 {
  font-size: 15px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.task-list {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.task-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  gap: 12px;
  cursor: pointer;
  min-height: 48px;
}

.task-item:last-child {
  border-bottom: none;
}

.task-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-item.open .task-status-dot {
  border: 2px solid #4a9eff;
  background: transparent;
}

.task-item.complete .task-status-dot {
  background: #38a169;
}

.task-item.overdue .task-status-dot {
  border: 2px solid #e53e3e;
  background: transparent;
}

.task-title {
  font-size: 15px;
  line-height: 1.3;
}

.task-item.complete .task-title {
  color: #999;
  text-decoration: line-through;
}

.task-item.overdue .task-title {
  color: #e53e3e;
}

.empty-state {
  padding: 20px;
  text-align: center;
  color: #aaa;
  font-size: 14px;
}

/* --- Links as task items --- */

a.task-item {
  text-decoration: none;
  color: inherit;
}

/* --- Back link --- */

.back-link {
  color: #8899aa;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

/* --- Month View --- */

.month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.month-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.week-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-count {
  font-size: 13px;
  font-weight: 400;
  color: #888;
}

.week-status-icon {
  font-size: 13px;
  font-weight: 600;
}

.week-status-icon.complete { color: #38a169; }
.week-status-icon.attention { color: #e53e3e; }

/* --- Task Detail --- */

.task-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.task-type-badge {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 4px;
  background: #edf2f7;
  color: #555;
}

.task-type-badge.monthly_major { background: #fed7d7; color: #9b2c2c; }
.task-type-badge.monthly_recurring { background: #fefcbf; color: #744210; }
.task-type-badge.weekly_recurring { background: #bee3f8; color: #2a4365; }

.task-status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
}

.task-status-badge.open { background: #bee3f8; color: #2a4365; }
.task-status-badge.complete { background: #c6f6d5; color: #22543d; }
.task-status-badge.overdue { background: #fed7d7; color: #9b2c2c; }

.task-detail-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
}

.task-due-window {
  font-size: 14px;
  color: #888;
  margin-bottom: 20px;
}

.task-instructions {
  background: #f7fafc;
  padding: 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: #444;
  margin-bottom: 20px;
}

.task-description {
  font-size: 15px;
  line-height: 1.5;
  color: #555;
  margin-bottom: 12px;
}

.task-notes-list {
  margin-bottom: 20px;
}

.task-notes-list h3 {
  font-size: 15px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

.task-note-item {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.task-note-text {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}

.task-note-meta {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.task-note-section {
  margin-bottom: 16px;
}

.task-note-section label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  margin-bottom: 6px;
}

.task-note-section textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  resize: vertical;
  font-family: inherit;
}

.task-actions {
  margin-bottom: 24px;
}

.btn-secondary {
  background: #edf2f7;
  color: #555;
  border: 1px solid #ddd;
}

/* --- Event History --- */

.event-list {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.event-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.event-item:last-child { border-bottom: none; }

.event-type {
  font-weight: 600;
  margin-right: 8px;
}

.event-time {
  color: #888;
  font-size: 13px;
}

.event-note {
  margin-top: 4px;
  color: #555;
  font-size: 13px;
}

/* --- Photo Grid --- */

.task-photo-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}

/* --- Notes --- */

.notes-container {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.notes-meta {
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

.notes-container textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  resize: vertical;
  font-family: inherit;
}

/* --- Supply Form --- */

.supply-form {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-top: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.supply-form h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.supply-form .form-group {
  margin-bottom: 12px;
}

.supply-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  margin-bottom: 4px;
}

.supply-form input,
.supply-form select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row .form-group {
  flex: 1;
}

.form-row .btn {
  flex: 1;
}

/* --- Nav Arrows (dashboard month/week) --- */

.nav-card {
  position: relative;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.nav-arrow {
  background: none;
  border: none;
  font-size: 22px;
  font-weight: 600;
  color: #4a9eff;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  min-width: 24px;
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.nav-arrow:active {
  background: #f0f7ff;
}

/* --- Header Actions --- */

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Admin Navigation --- */

.admin-nav {
  display: flex;
  background: #0d1520;
  padding: 0 16px;
  gap: 0;
}

.admin-nav-link {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #8899aa;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.admin-nav-link.active {
  color: #4a9eff;
  border-bottom-color: #4a9eff;
}

.admin-page-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* --- Admin Table --- */

.admin-table-wrap {
  background: #fff;
  border-radius: 10px;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #eee;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f5f5f5;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.role-badge.admin { background: #fed7d7; color: #9b2c2c; }
.role-badge.team_user { background: #bee3f8; color: #2a4365; }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.active { background: #38a169; }
.status-dot.inactive { background: #e53e3e; }

.deactivated-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f5f5f5;
  color: #999;
  margin-left: auto;
}

/* --- Admin Form Card --- */

.admin-form-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.admin-form-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.admin-form-card .form-group {
  margin-bottom: 12px;
}

.admin-form-card label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  margin-bottom: 4px;
}

.admin-form-card input,
.admin-form-card select,
.admin-form-card textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
}

.form-hint {
  font-size: 12px;
  color: #999;
  margin-top: 6px;
}

/* --- Modal --- */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-card .form-group {
  margin-bottom: 12px;
}

.modal-card label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  margin-bottom: 4px;
}

.modal-card input,
.modal-card select,
.modal-card textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions .btn { flex: 1; }

.btn-danger {
  background: #e53e3e;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #c53030;
}

/* --- Tabs --- */

.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.tab-btn {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  background: #fff;
  color: #888;
  cursor: pointer;
}

.tab-btn.active {
  color: #4a9eff;
  background: #f0f7ff;
}

/* --- Filter Bar --- */

.filter-bar {
  margin-bottom: 12px;
}

.filter-bar select {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
}

/* --- Pagination --- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 0;
}

.page-info {
  font-size: 13px;
  color: #888;
}

/* --- Season Context Editor --- */

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  background: #f7fafc;
  border-radius: 8px 8px 0 0;
  border: 1px solid #ddd;
  border-bottom: none;
}

.editor-toolbar button {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
}

.editor-toolbar button:active {
  background: #edf2f7;
}

.context-editor {
  border: 1px solid #ddd;
  border-radius: 0 0 8px 8px;
  padding: 12px;
  min-height: 200px;
  font-size: 15px;
  line-height: 1.6;
  font-family: inherit;
  outline: none;
  background: #fff;
  overflow-y: auto;
}

.context-editor:focus {
  border-color: #4a9eff;
}

.context-content {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  min-height: 120px;
}

.context-readonly {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
}

.context-readonly:empty::after {
  content: 'No season context has been added yet.';
  color: #aaa;
  font-style: italic;
}

.context-content h2,
.context-content h3 {
  margin: 12px 0 8px;
}

.context-content h2:first-child,
.context-content h3:first-child {
  margin-top: 0;
}

.context-content ul,
.context-content ol {
  padding-left: 24px;
  margin: 8px 0;
}

.context-content p {
  margin: 8px 0;
  line-height: 1.5;
}
