/*
 * FocusFrog application styles
 * Green palette: bright, fresh, fun
 */

:root {
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;
  --white:     #ffffff;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-300:  #d1d5db;
  --gray-500:  #6b7280;
  --gray-700:  #374151;
  --gray-900:  #111827;
  --danger:    #ef4444;
  --danger-light: #fef2f2;
}

/* ── Reset & Base ── */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--green-50);
  color: var(--gray-700);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--green-900);
  color: var(--green-100);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--green-800);
}

.sidebar-logo .logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--white);
  text-decoration: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  padding: 0.75rem 0;
}

.sidebar-nav-top,
.sidebar-nav-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav-bottom {
  border-top: 1px solid var(--green-800);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  color: var(--green-200);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: var(--green-800);
  color: var(--white);
}

.sidebar-link.active {
  background: var(--green-700);
  color: var(--white);
  font-weight: 600;
}

/* Applied directly to the SVG element by the icon helper */
.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ── Content Area ── */

.content-area {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

/* ── Main Content ── */

.main-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Typography ── */

h1 {
  color: var(--gray-900);
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

h2 {
  color: var(--green-900);
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

a {
  color: var(--green-700);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  color: var(--green-600);
}

/* ── Flash Messages ── */

.flash-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.flash {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  opacity: 1;
  transition: opacity 0.6s ease-out;
}

.flash-fade-out {
  opacity: 0;
}

.flash-notice {
  background: rgba(220, 252, 231, 0.85);
  color: var(--green-800);
  border: 1px solid var(--green-200);
}

.flash-alert {
  background: rgba(254, 242, 242, 0.85);
  color: var(--danger);
  border: 1px solid #fecaca;
}

/* ── Quick Add ── */

.quick-add {
  margin-bottom: 1.5rem;
}

.quick-add input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--green-200);
  border-radius: 0.5rem;
  font-size: 1rem;
  background: var(--white);
  color: var(--gray-700);
  outline: none;
  transition: border-color 0.15s;
}

.quick-add input[type="text"]:focus {
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

.quick-add input[type="text"]::placeholder {
  color: var(--gray-300);
}

/* ── Inbox Item Cards ── */

.inbox-item-card {
  background: var(--white);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border-left: 4px solid var(--green-400);
  transition: box-shadow 0.15s;
  display: block;
  color: inherit;
  text-decoration: none;
  font-weight: normal;
}

.inbox-item-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  color: inherit;
}

.inbox-item-card .card-title {
  color: var(--gray-900);
  font-weight: 600;
  font-size: 0.95rem;
}

.inbox-item-card .card-body {
  color: var(--gray-500);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.inbox-item-card .card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn-small {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}

/* ── Buttons ── */

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}

.btn-primary {
  background: var(--green-500);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--green-600);
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  color: var(--green-700);
  border: 2px solid var(--green-200);
}

.btn-secondary:hover {
  border-color: var(--green-400);
  background: var(--green-50);
}

.btn-danger {
  background: var(--white);
  color: var(--danger);
  border: 2px solid #fecaca;
}

.btn-danger:hover {
  background: var(--danger-light);
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* ── Forms ── */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  color: var(--gray-700);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group textarea:focus {
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* ── Error Messages ── */

.form-errors {
  background: var(--danger-light);
  color: var(--danger);
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid #fecaca;
}

.form-errors h2 {
  color: var(--danger);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.form-errors ul {
  padding-left: 1.25rem;
  margin: 0;
}

/* ── Show Page ── */

.inbox-item-detail {
  background: var(--white);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border-left: 4px solid var(--green-400);
}

.inbox-item-detail .detail-title {
  color: var(--gray-900);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.inbox-item-detail .detail-body {
  color: var(--gray-700);
  font-size: 0.95rem;
  line-height: 1.7;
}

.inbox-item-detail .detail-body.empty {
  color: var(--gray-300);
  font-style: italic;
}

/* ── Due Date ── */

.due-date {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--gray-500);
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

.due-date-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Calendar Accounts ── */

.calendar-account-card {
  background: var(--white);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.account-info {
  flex: 1;
  min-width: 0;
}

.account-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 0.95rem;
}

.account-detail {
  color: var(--gray-500);
  font-size: 0.8rem;
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-small {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}

/* ── Calendar List (under accounts) ── */

.calendar-list {
  margin: -0.25rem 0 0.75rem 0;
  padding: 0.5rem 1.25rem;
  background: var(--green-50);
  border-radius: 0 0 0.75rem 0.75rem;
  border-top: 1px solid var(--green-100);
}

.calendar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
}

.calendar-color-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-name {
  flex: 1;
  color: var(--gray-700);
}

.calendar-toggle-form {
  display: inline;
}

.calendar-toggle {
  accent-color: var(--green-600);
  cursor: pointer;
}

/* ── Poll / Waiting Page ── */

.poll-container {
  max-width: 500px;
  margin: 2rem auto;
}

.poll-card {
  background: var(--white);
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.poll-card h2 {
  color: var(--gray-900);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.poll-card p {
  color: var(--gray-600);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.poll-actions {
  margin-bottom: 1.5rem;
}

.poll-status {
  color: var(--gray-500);
  font-size: 0.85rem;
  font-style: italic;
}

/* ── Empty States ── */

.empty-state {
  text-align: center;
  color: var(--gray-500);
  font-size: 1rem;
  padding: 3rem 1rem;
}

/* ── Auth Layout ── */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--green-50);
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 2rem 1.5rem;
}

.auth-logo {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--green-800);
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.form-card {
  background: var(--white);
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.form-card h2 {
  color: var(--gray-900);
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.form-card .form-group input[type="email"],
.form-card .form-group input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  color: var(--gray-700);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.form-card .form-group input[type="email"]:focus,
.form-card .form-group input[type="password"]:focus {
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check label {
  display: inline;
  font-weight: normal;
  font-size: 0.85rem;
}

.form-check input[type="checkbox"] {
  accent-color: var(--green-600);
}

.form-hint {
  color: var(--gray-500);
  font-size: 0.8rem;
  margin: 0.15rem 0 0.25rem;
}

.form-actions {
  margin-top: 1.25rem;
}

.btn-full {
  width: 100%;
  text-align: center;
}

.auth-links {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
}

.auth-links p {
  margin-bottom: 0.35rem;
}

/* ── Avatars ── */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-sm, .avatar-sm svg {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.avatar-lg, .avatar-lg svg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

/* ── Profile Page ── */

.profile-card {
  background: var(--white);
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.profile-details {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
}

.profile-email {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
}

.profile-avatar-edit {
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: center;
}

/* ── Sidebar User ── */

.sidebar-user {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--green-800);
  font-size: 0.8rem;
}

.sidebar-user-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--green-200);
  text-decoration: none;
  padding: 0.25rem 0;
  margin-bottom: 0.35rem;
  transition: color 0.15s;
}

.sidebar-user-link:hover {
  color: var(--white);
}

.sidebar-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.sidebar-user .sidebar-link {
  padding: 0.4rem 0;
  font-size: 0.8rem;
}
