/* 
  Modern, Warm Childcare Branding
  Palette:
  - Primary (Soft Coral): #ff8a65
  - Secondary (Soft Mint/Teal): #4db6ac
  - Background (Warm Off-White): #faf8f5
  - Surface (White): #ffffff
  - Text Dark: #2c3e50
  - Text Light/Muted: #7f8c8d
  - Border: #e0e6ed
*/

:root {
  --primary-color: #ff6a97;
  --primary-hover: #fa036b;
  --secondary-color: #4db6ac;
  --bg-color: #faf8f5;
  --surface-color: #ffffff;
  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --border-color: #e0e6ed;
  --danger-color: #e74c3c;
  --success-color: #2ecc71;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: "Outfit", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--primary-hover);
}

/* App Header - Hiding for Admin if they have the sidebar */
.app-header {
  background: var(--surface-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 10;
}

body.admin-mode .app-header {
  display: none;
}

/* Admin Layout Base */
.admin-sidebar-layout {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  background-color: var(--bg-color);
}

/* Dark Sidebar */
.admin-sidebar {
  width: 260px;
  background-color: #1a202c;
  /* Deep slate */
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand-text h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.75rem;
  color: #a0aec0;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: #a0aec0;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.nav-item svg {
  color: #718096;
}

.nav-item:hover,
.nav-item.active {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
}

.nav-item:hover svg,
.nav-item.active svg {
  color: var(--primary-color);
}

.nav-item.active {
  background-color: rgba(255, 138, 101, 0.1);
}

.sidebar-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.user-profile {
  width: inherit;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #2d3748;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
}

.user-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.user-name {
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.user-role {
  color: #718096;
  font-size: 0.7rem;
}

.logout-btn {
  color: #718096;
  border-radius: var(--radius-md);
}

.logout-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
}

/* Main Content Wrapper */
.admin-main-content {
  flex: 1;
  padding: 2.5rem 1.5rem;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h2 {
  font-size: 1.75rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--text-muted);
}

.babysitter_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.babysitter_header h2 {
  font-size: 1.75rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.babysitter_header p {
  color: var(--text-muted);
}

.add-button {
  background: #ff6a97;
  color: #ffffff;
  border-radius: 20px;
  font-size: 1rem;
  outline: 0;
  border: 0;
  cursor: pointer;
  padding: 10px 12px 10px 12px;
}

.add-button:hover {
  color: #ffffff;
}

/* HEADER */
.archived-header h2 {
  font-size: 24px;
  font-weight: 600;
}
.archived-header p {
  color: #777;
}

/* CARD */
.archive-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid #eee;
  margin-bottom: 12px;
  background: #fff;
}

/* LEFT */
.archive-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-icon {
  background: #f1f5f9;
  padding: 12px;
  border-radius: 10px;
}

/* TEXT */
.chat-title {
  font-weight: 600;
}

.chat-meta {
  font-size: 0.85rem;
  color: #777;
}

/* ACTIONS */
.archive-actions {
  display: flex;
  gap: 10px;
}

.restore-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #10b981;
  color: #fff;
  background: #10b981;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.delete-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: red;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 1.2rem 0 2.5rem 0;
}

.stat-card {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

/* User Profile Cards */
.user-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.user-card {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  position: relative;
  transition: transform 0.2s;
}

.user-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.user-card-avatar {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.user-card-avatar.family {
  background-color: #2ecc71;
}

.user-card-avatar.babysitter {
  background-color: #9b59b6;
}

.user-card-info {
  flex: 1;
}

.user-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.user-card-title h4 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--text-main);
}

.user-card-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.user-card-actions {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  gap: 0.5rem;
}

.action-icon {
  color: #a0aec0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

.action-icon:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.action-icon.danger:hover {
  color: var(--danger-color);
  background: #fdeaea;
}

.user-card-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.user-info-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.user-info-row svg {
  color: #cbd5e1;
}

.user-notes {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.85rem;
  font-style: italic;
}

/* Clean Search Bar */
.search-wrapper {
  margin-bottom: 2rem;
  position: relative;
  max-width: 400px;
}

.search-wrapper input {
  padding-left: 2.5rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.search-wrapper svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 1rem;
  font-family: "Outfit", sans-serif;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-align: center;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 138, 101, 0.3);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 138, 101, 0.4);
  color: white;
}

.btn-secondary {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  text-align: start;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
  background-color: var(--surface-color);
  color: var(--text-main);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 138, 101, 0.15);
}

.error-message {
  color: var(--danger-color);
  background-color: #fdeaea;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Login Page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 4rem);
}

.login-card {
  background: var(--surface-color);
  padding: 3rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 450px;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.login-header p {
  color: var(--text-muted);
}

/* Dashboard Cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--surface-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.card-header h3 {
  font-size: 1.25rem;
  margin: 0;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  background: var(--surface-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: #fdfdfd;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

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

tr:hover td {
  background-color: #f8fafc;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-active {
  background-color: #e6f8ec;
  color: var(--success-color);
}

.badge-inactive {
  background-color: #fceaea;
  color: var(--danger-color);
}

.badge-role {
  background-color: #eef2f7;
  color: var(--text-muted);
}

/* Chat Layout */
.chat-layout {
  display: flex;
  height: 100vh;
  background: var(--surface-color);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  /* border: 1px solid var(--border-color); */
}

.chat-sidebar {
  width: 300px;
  /* border-right: 1px solid var(--border-color); */
  display: flex;
  flex-direction: column;
  background: #1a202c;
}

.chat-sidebar-header {
  padding: 1rem;
  /* border-bottom: 1px solid var(--border-color); */
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-view-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  color: #fff;
}

.chat-view-header img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  padding: 1rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: var(--transition);
}

.chat-item:hover,
.chat-item.active {
  background-color: #edf2f7;
}

.chat-item-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.chat-item-preview {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-color);
}

.chat-header h3 {
  margin: 0 0 0.25rem 0;
}

.chat-participants {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chat-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background-color: #f7f9fc;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.chat-users li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-transform: capitalize;
  transition: background 0.2s ease;
}

/* .chat-users li:hover {
  background: #f9fafb;
} */

/* user initial circle */

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #6366f1;
  color: white;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
}

.message {
  max-width: 70%;
  display: flex;
  flex-direction: column;
}

.message-sender {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  margin-left: 0.5rem;
}

.message-bubble {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  line-height: 1.4;
}

.message-time {
  font-size: 0.7rem;
  color: #a0aec0;
  text-align: right;
  margin-top: 0.25rem;
}

.message.mine {
  align-self: flex-end;
}

.message.mine .message-bubble {
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.mine .message-time {
  color: rgba(255, 255, 255, 0.8);
}

.message.mine .message-sender {
  display: none;
}

.message.others {
  align-self: flex-start;
}

.message.others .message-bubble {
  border-bottom-left-radius: 4px;
}

.message.system {
  align-self: center;
  max-width: 90%;
}

.message.system .message-bubble {
  background: transparent;
  box-shadow: none;
  border: none;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  padding: 0.5rem;
}

.chat-input-area {
  padding: 1rem 1.5rem;
  background: var(--surface-color);
  border-top: 1px solid var(--border-color);
}

.chat-input-form {
  display: flex;
  gap: 1rem;
}

.chat-input-form input {
  flex: 1;
  border-radius: var(--radius-full);
  padding: 0.75rem 1.5rem;
  background-color: #f1f5f9;
  border: 1px solid transparent;
}

.chat-input-form input:focus {
  background-color: var(--surface-color);
  border-color: var(--primary-color);
}

.chat-input-form button {
  border-radius: var(--radius-full);
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.admin-table tbody td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.admin-table tbody tr:hover {
  background: #f9fafb;
}

.table-user {
  font-weight: 500;
  color: var(--text-main);
}

.table-sep {
  margin: 0 4px;
  color: var(--text-muted);
}

.text-muted {
  color: var(--text-muted);
}

.table-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* Modals */
.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;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .chat-layout {
    flex-direction: column;
    height: calc(100vh - 80px);
    border-radius: 0;
  }

  .chat-sidebar {
    width: 100%;
    height: 30%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .chat-main {
    height: 70%;
  }
}
