/* ============================================================
   Church Community Portal — Front-End Styles v4.1
   Fonts: Lato from Google Fonts
   Icons: WordPress Dashicons
   Layout: Tailwind CDN utilities + these overrides
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');

/* ── Full-viewport takeover ──────────────────────────────────── */
/* Immediately hides WP chrome before JS runs */
html.ccp-portal-page,
body.ccp-portal-page {
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.ccp-portal-page #wpadminbar,
body.ccp-portal-page .site-header,
body.ccp-portal-page header[class*="site-header"],
body.ccp-portal-page header[class*="header-main"],
body.ccp-portal-page .header-wrap,
body.ccp-portal-page .entry-header,
body.ccp-portal-page .entry-title,
body.ccp-portal-page .page-title,
body.ccp-portal-page .breadcrumbs,
body.ccp-portal-page .breadcrumb,
body.ccp-portal-page nav.main-navigation,
body.ccp-portal-page .site-footer,
body.ccp-portal-page footer[class*="footer"],
body.ccp-portal-page .wp-block-post-title {
  display: none !important;
}

/* ── Portal outer wrapper: fixed to fill viewport ───────────── */
.ccp-fullscreen-wrap {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9990;
  overflow: hidden;
  background: #f0ede8;
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Inner flex shell ────────────────────────────────────────── */
#ccp-portal {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: #333;
  box-sizing: border-box;
}
#ccp-portal *, #ccp-portal *::before, #ccp-portal *::after {
  box-sizing: border-box;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
#ccp-portal aside {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  overflow: hidden;
}

.ccp-nav-item {
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
  white-space: nowrap;
}

/* ── Main column ─────────────────────────────────────────────── */
#ccp-portal > div:last-child {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Content scroll area ─────────────────────────────────────── */
#ccp-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #d0ccc5 transparent;
}
#ccp-content::-webkit-scrollbar { width: 6px; }
#ccp-content::-webkit-scrollbar-track { background: transparent; }
#ccp-content::-webkit-scrollbar-thumb { background: #d0ccc5; border-radius: 3px; }
#ccp-content.loading { opacity: 0.4; pointer-events: none; }

/* ── Form controls ───────────────────────────────────────────── */
.ccp-input, .ccp-select, .ccp-textarea {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #fff;
  border: 1px solid #d0ccc5;
  border-radius: 5px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: none;
  margin: 0;
}
.ccp-input:focus, .ccp-select:focus, .ccp-textarea:focus {
  border-color: #2a9d8f;
  box-shadow: 0 0 0 3px rgba(42,157,143,0.12);
}
.ccp-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.ccp-textarea {
  resize: vertical;
  min-height: 100px;
}

/* ── Rich text editor ────────────────────────────────────────── */
.ccp-rte-toolbar {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  background: #f5f2ec;
  border: 1px solid #d0ccc5;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  flex-wrap: wrap;
  align-items: center;
}
.ccp-rte-btn {
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #555;
  line-height: 1.4;
  font-family: inherit;
  transition: background 0.1s;
}
.ccp-rte-btn:hover { background: #e8e3db; border-color: #ccc; }
.ccp-rte-sep { width: 1px; background: #d0ccc5; margin: 3px 4px; align-self: stretch; }
.ccp-rte-area {
  border: 1px solid #d0ccc5;
  border-radius: 0 0 5px 5px;
  min-height: 200px;
  padding: 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  color: #333;
  outline: none;
  background: #fff;
  -webkit-user-modify: read-write;
}
.ccp-rte-area:focus { border-color: #2a9d8f; }
.ccp-rte-area p { margin: 0 0 8px; }

/* ── Loading spinner ─────────────────────────────────────────── */
.ccp-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e8e3db;
  border-top-color: #2a9d8f;
  border-radius: 50%;
  animation: ccp-spin 0.6s linear infinite;
  margin: 48px auto;
  display: block;
}
@keyframes ccp-spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ─────────────────────────────────────── */
#ccp-toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.ccp-toast {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Lato', sans-serif;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  max-width: 320px;
  animation: ccp-slide-up 0.18s ease;
  color: #fff;
  line-height: 1.4;
}
.ccp-toast-success { background: #276749; }
.ccp-toast-error   { background: #c53030; }
.ccp-toast-info    { background: #1d7a6e; }
@keyframes ccp-slide-up {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Modal ───────────────────────────────────────────────────── */
.ccp-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(40,38,34,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: ccp-fade-in 0.15s ease;
}
@keyframes ccp-fade-in { from { opacity: 0; } to { opacity: 1; } }
.ccp-modal-box {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  animation: ccp-modal-in 0.18s ease;
}
.ccp-modal-box.wide { max-width: 720px; }
@keyframes ccp-modal-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
body.ccp-modal-open { overflow: hidden !important; }

/* ── Calendar grid ───────────────────────────────────────────── */
.ccp-cal-grid {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  border: 1px solid #e8e3db;
  border-radius: 6px;
  overflow: hidden;
  background: #e8e3db;
  gap: 1px;
}
.ccp-cal-head {
  background: #4a4a44;
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 7px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ccp-cal-day {
  background: #fff;
  min-height: 88px;
  padding: 5px 6px;
  position: relative;
}
.ccp-cal-day.other { background: #f7f5f0; }
.ccp-cal-day.today .ccp-day-n {
  background: #c0392b;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ccp-day-n {
  font-size: 12px;
  font-weight: 700;
  color: #555;
  margin-bottom: 3px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
}
.ccp-ev-pill {
  display: block;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  line-height: 1.5;
  transition: opacity 0.1s;
}
.ccp-ev-pill:hover { opacity: 0.85; }

/* ── Group member photo grid (3-col) ─────────────────────────── */
.ccp-group-members-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 12px 8px;
  padding: 20px;
}
@media (max-width: 640px) {
  .ccp-group-members-grid { grid-template-columns: repeat(2,1fr); }
}

/* ── Photo lightbox grid ─────────────────────────────────────── */
.ccp-photo-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 6px;
}
.ccp-photo-item {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
}
.ccp-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.15s;
}
.ccp-photo-item:hover img { opacity: 0.85; }

/* ── Detail page styles ──────────────────────────────────────── */
.ccp-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #888;
  cursor: pointer;
  margin-bottom: 6px;
}
.ccp-detail-back:hover { color: #2a9d8f; }
.ccp-detail-title {
  font-size: 28px;
  font-weight: 700;
  color: #3a3631;
  margin-bottom: 4px;
  line-height: 1.2;
}
.ccp-detail-hr {
  border: none;
  border-top: 1px solid #e8e3db;
  margin: 14px 0 20px;
}
.ccp-meta-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.ccp-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
}

/* ── Contact info ────────────────────────────────────────────── */
.ccp-contact-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  padding: 5px 0;
}
.ccp-contact-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Row utility ─────────────────────────────────────────────── */
.ccp-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f0ede8;
  font-size: 13px;
  gap: 12px;
  transition: background 0.1s;
}
.ccp-row:last-child { border-bottom: none; }
.ccp-row:hover { background: #faf8f5; }

/* ── Empty state ─────────────────────────────────────────────── */
.ccp-empty {
  padding: 40px 20px;
  text-align: center;
  color: #aaa;
  font-size: 14px;
}

/* ── Report table hover ──────────────────────────────────────── */
.rpt-row td { transition: background 0.1s; }

/* ── File upload ─────────────────────────────────────────────── */
.ccp-file-btn {
  padding: 6px 12px;
  background: #f0ede8;
  border: 1px solid #d0ccc5;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  color: #444;
  font-family: inherit;
  transition: background 0.1s;
}
.ccp-file-btn:hover { background: #e8e3db; }

/* ── Responsive sidebar collapse ────────────────────────────── */
@media (max-width: 600px) {
  #ccp-portal aside { width: 52px !important; }
  #ccp-portal aside span:not(.dashicons) { display: none !important; }
  .ccp-nav-item { justify-content: center !important; padding: 10px !important; }
  #ccp-content { padding: 14px 12px !important; }
  .ccp-cal-day { min-height: 60px; }
  .ccp-group-members-grid { grid-template-columns: 1fr 1fr; }
}
