/* Molle Business Platform 1.4.5 — Consolidated mobile-first frontend CSS.
   All selectors are scoped under .molle-business-app so the plugin never
   affects the rest of the WordPress site, EventON, WooCommerce, or the theme.
   The site's global CSS controls outer side spacing; this file adds none. */

.molle-business-app { width: 100%; max-width: 100%; margin: 0; padding: 0; box-sizing: border-box; }
.molle-business-app *, .molle-business-app *::before, .molle-business-app *::after { box-sizing: border-box; }
.molle-business-app .molle-hidden { display: none !important; }

/* Theme variable defaults (only used if the site does not define them) */
.molle-business-app {
  --molle-primary: #3a6b5e;
  --molle-primary-text: #ffffff;
  --molle-surface: #ffffff;
  --molle-surface-alt: #f0ece2;
  --molle-page-bg: #f4f1ea;
  --molle-text: #2c2c2c;
  --molle-text-muted: #6b6b6b;
  --molle-border: #d9d4c8;
  --molle-input-border: #c9c3b5;
  --molle-input-bg: #ffffff;
  --molle-radius: 12px;
  --molle-shadow: 0 2px 8px rgba(0,0,0,0.08);
  --molle-success: #3a7d4f;
  --molle-warning: #c89b3c;
  --molle-danger: #b04a3a;
}

/* ---------- Forms ---------- */
.molle-business-app .molle-form { display: flex; flex-direction: column; gap: 16px; }
.molle-business-app .molle-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.molle-business-app .molle-field label { font-weight: 600; font-size: 14px; color: var(--molle-text); }
.molle-business-app input,
.molle-business-app textarea,
.molle-business-app select {
  font-size: 16px;
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  box-sizing: border-box;
  padding: 12px 16px;
  border: 2px solid var(--molle-input-border);
  border-radius: var(--molle-radius);
  background: var(--molle-input-bg);
  color: var(--molle-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.molle-business-app textarea { min-height: 96px; resize: vertical; }
.molle-business-app input:focus,
.molle-business-app textarea:focus,
.molle-business-app select:focus {
  outline: none;
  border-color: var(--molle-primary);
  box-shadow: 0 0 0 3px rgba(58,107,94,0.12);
}
.molle-business-app input:focus-visible,
.molle-business-app textarea:focus-visible,
.molle-business-app select:focus-visible,
.molle-business-app button:focus-visible,
.molle-business-app a:focus-visible {
  outline: 2px solid var(--molle-primary);
  outline-offset: 2px;
}
.molle-business-app .molle-field-error { color: var(--molle-danger); font-size: 13px; margin-top: 4px; }

/* ---------- Buttons ---------- */
.molle-business-app .molle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--molle-radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s, opacity 0.2s;
  min-height: 46px;
  min-width: 44px;
}
.molle-business-app .molle-btn:active { transform: scale(0.98); }
.molle-business-app .molle-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.molle-business-app .molle-btn-primary { background: var(--molle-primary); color: var(--molle-primary-text); }
.molle-business-app .molle-btn-primary:hover { opacity: 0.9; box-shadow: var(--molle-shadow); }
.molle-business-app .molle-btn-secondary { background: var(--molle-surface); color: var(--molle-primary); border: 2px solid var(--molle-primary); }
.molle-business-app .molle-btn-secondary:hover { background: var(--molle-surface-alt); }
.molle-business-app .molle-btn-link { background: transparent; color: var(--molle-primary); padding: 8px 4px; text-decoration: underline; min-height: 44px; }
.molle-business-app .molle-btn-danger { color: var(--molle-danger); }
.molle-business-app .molle-btn-danger:hover { background: rgba(176,74,58,0.08); }

/* Action groups: stack on mobile, row on desktop */
.molle-business-app .molle-actions,
.molle-business-app .molle-dash-actions,
.molle-business-app .molle-feed-actions,
.molle-business-app .molle-feed-manage-actions,
.molle-business-app .molle-onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.molle-business-app .molle-actions .molle-btn,
.molle-business-app .molle-dash-actions .molle-btn,
.molle-business-app .molle-feed-actions .molle-btn {
  width: 100%;
}
@media (min-width: 768px) {
  .molle-business-app .molle-actions,
  .molle-business-app .molle-dash-actions,
  .molle-business-app .molle-feed-actions,
  .molle-business-app .molle-feed-manage-actions,
  .molle-business-app .molle-onboarding-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .molle-business-app .molle-actions .molle-btn,
  .molle-business-app .molle-dash-actions .molle-btn,
  .molle-business-app .molle-feed-actions .molle-btn { width: auto; }
}

/* ---------- Cards ---------- */
.molle-business-app .molle-card {
  background: var(--molle-surface);
  border-radius: var(--molle-radius);
  padding: 20px;
  box-shadow: var(--molle-shadow);
  margin-bottom: 16px;
  min-width: 0;
}
@media (min-width: 768px) {
  .molle-business-app .molle-card { padding: 24px; margin-bottom: 24px; }
}
.molle-business-app .molle-card h2,
.molle-business-app .molle-card h3 { margin-top: 0; }

/* ---------- Dashboard ---------- */
.molle-business-app .molle-dashboard { width: 100%; max-width: 100%; margin: 0; padding: 0; }
.molle-business-app .molle-dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.molle-business-app .molle-dash-user { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.molle-business-app .molle-dash-name { font-weight: 600; font-size: 16px; color: var(--molle-text); overflow-wrap: anywhere; }
.molle-business-app .molle-business-selector { margin-bottom: 16px; }
.molle-business-app .molle-business-selector label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.molle-business-app .molle-business-selector select { width: 100%; }

.molle-business-app .molle-dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 768px) {
  .molle-business-app .molle-dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}
.molle-business-app .molle-dash-grid .molle-card-main { grid-column: 1 / -1; }
.molle-business-app .molle-dash-grid > * { min-width: 0; }

/* ---------- Status badges ---------- */
.molle-business-app .molle-status-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.molle-business-app .molle-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.molle-business-app .molle-badge-draft { background: var(--molle-surface-alt); color: var(--molle-text-muted); }
.molle-business-app .molle-badge-active { background: rgba(58,125,79,0.15); color: var(--molle-success); }
.molle-business-app .molle-badge-paused { background: rgba(200,155,60,0.15); color: var(--molle-warning); }
.molle-business-app .molle-badge-archived { background: rgba(176,74,58,0.15); color: var(--molle-danger); }
.molle-business-app .molle-badge-not_started { background: var(--molle-surface-alt); color: var(--molle-text-muted); }
.molle-business-app .molle-badge-in_progress { background: rgba(58,107,94,0.15); color: var(--molle-primary); }
.molle-business-app .molle-badge-completed { background: rgba(58,125,79,0.15); color: var(--molle-success); }

/* ---------- Progress ---------- */
.molle-business-app .molle-progress { margin: 12px 0; }
.molle-business-app .molle-progress-label { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--molle-text); }
.molle-business-app .molle-progress-bar { height: 12px; background: var(--molle-border); border-radius: 6px; overflow: hidden; }
.molle-business-app .molle-progress-fill { height: 100%; background: var(--molle-primary); border-radius: 6px; transition: width 0.4s ease; }

/* ---------- Modals ---------- */
.molle-business-app .molle-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 100000;
  padding: 0;
  overflow-y: auto;
}
.molle-business-app .molle-modal-content {
  background: var(--molle-surface);
  border-radius: 0;
  max-width: 100%;
  width: 100%;
  min-height: 100dvh;
  min-height: 100vh;
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  position: relative;
  box-shadow: var(--molle-shadow);
  margin: 0;
  overflow-y: auto;
}
@media (min-width: 768px) {
  .molle-business-app .molle-modal { padding: 24px 16px; }
  .molle-business-app .molle-modal-content {
    border-radius: var(--molle-radius);
    max-width: 640px;
    min-height: auto;
    max-height: 90vh;
    padding: 32px;
    margin-top: 20px;
  }
}
.molle-business-app .molle-modal-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  background: var(--molle-surface);
  border: 2px solid var(--molle-border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 24px;
  cursor: pointer;
  color: var(--molle-text-muted);
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.molle-business-app .molle-modal-close:hover { color: var(--molle-text); border-color: var(--molle-primary); }

/* ---------- Onboarding ---------- */
.molle-business-app .molle-onboarding-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.molle-business-app .molle-step {
  padding: 8px 10px;
  border-radius: var(--molle-radius);
  font-size: 12px;
  font-weight: 600;
  background: var(--molle-surface-alt);
  color: var(--molle-text-muted);
  flex: 1 1 0;
  text-align: center;
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (min-width: 768px) {
  .molle-business-app .molle-step { font-size: 13px; padding: 8px 12px; }
}
.molle-business-app .molle-step.active { background: var(--molle-primary); color: var(--molle-primary-text); }
.molle-business-app .molle-step.completed { background: var(--molle-success); color: #fff; }

.molle-business-app .molle-missing-fields {
  background: rgba(200,155,60,0.12);
  border-radius: var(--molle-radius);
  padding: 16px;
  margin: 16px 0;
}
.molle-business-app .molle-missing-fields h4 { margin: 0 0 8px; color: var(--molle-warning); }
.molle-business-app .molle-missing-fields ul { margin: 0; padding-left: 20px; }

.molle-business-app .molle-preview {
  border: 1px solid var(--molle-border);
  border-radius: var(--molle-radius);
  padding: 16px;
  margin: 16px 0;
  overflow-wrap: anywhere;
}
.molle-business-app .molle-preview img { max-width: 100%; border-radius: var(--molle-radius); }

/* ---------- Upload ---------- */
.molle-business-app .molle-upload-area {
  border: 2px dashed var(--molle-border);
  border-radius: var(--molle-radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  min-height: 44px;
}
.molle-business-app .molle-upload-area:hover { border-color: var(--molle-primary); }

/* ---------- Calendar feeds ---------- */
.molle-business-app .molle-card-calendar-feeds { margin-top: 0; }
.molle-business-app .molle-feed-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 768px) {
  .molle-business-app .molle-feed-row { flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 16px; }
}
.molle-business-app .molle-feed-row-info { flex: 1; min-width: 0; }
.molle-business-app .molle-feed-row-info strong { display: block; font-size: 15px; color: var(--molle-text); margin-bottom: 4px; overflow-wrap: anywhere; }
.molle-business-app .molle-feed-row-info p { margin: 0 0 8px; font-size: 14px; color: var(--molle-text-muted); }
.molle-business-app .molle-feed-meta {
  font-size: 13px;
  color: var(--molle-text-muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.molle-business-app .molle-feed-row-actions { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.molle-business-app .molle-feed-row-actions .molle-btn { width: 100%; }
@media (min-width: 768px) {
  .molle-business-app .molle-feed-row-actions { flex-direction: row; }
  .molle-business-app .molle-feed-row-actions .molle-btn { width: auto; }
}
.molle-business-app .molle-feed-import-result,
.molle-business-app .molle-feed-import-meta {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--molle-radius);
  font-size: 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.molle-business-app .molle-feed-import-meta { background: var(--molle-surface-alt); color: var(--molle-text-muted); }

.molle-business-app .molle-feed-label { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 8px; color: var(--molle-text); }
.molle-business-app .molle-feed-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--molle-input-border);
  border-radius: var(--molle-radius);
  font-size: 16px;
  box-sizing: border-box;
  background: var(--molle-input-bg);
  color: var(--molle-text);
  overflow-wrap: anywhere;
}

.molle-business-app .molle-feed-test-result {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--molle-radius);
  font-size: 14px;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.molle-business-app .molle-feed-test-ok { background: rgba(58,125,79,0.12); color: var(--molle-success); }
.molle-business-app .molle-feed-test-error { background: rgba(176,74,58,0.12); color: var(--molle-danger); }
.molle-business-app .molle-feed-test-pending { background: var(--molle-surface-alt); color: var(--molle-text-muted); }
.molle-business-app .molle-feed-preview { margin: 8px 0 0; padding-left: 20px; }
.molle-business-app .molle-feed-preview li { margin-bottom: 4px; overflow-wrap: anywhere; }

.molle-business-app .molle-feed-help { margin-top: 20px; border-top: 1px solid var(--molle-border); padding-top: 16px; }
.molle-business-app .molle-feed-help-content { margin-top: 12px; }
.molle-business-app .molle-feed-help-content ol { padding-left: 20px; }
.molle-business-app .molle-feed-help-content li { margin-bottom: 6px; font-size: 14px; color: var(--molle-text-muted); }
.molle-business-app .molle-feed-help-note { font-size: 13px; font-style: italic; color: var(--molle-text-muted); margin-top: 12px; }

/* ---------- Messages & feedback ---------- */
.molle-business-app .molle-message {
  font-size: 14px;
  min-height: 20px;
  margin: 0;
  overflow-wrap: anywhere;
}
.molle-business-app .molle-message.molle-success { color: var(--molle-success); }
.molle-business-app .molle-message.molle-error { color: var(--molle-danger); }
.molle-business-app .molle-placeholder { color: var(--molle-text-muted); font-style: italic; }

/* ---------- Login ---------- */
.molle-business-app .molle-login-container { max-width: 480px; margin: 0 auto; padding: 0; }
.molle-business-app .molle-logged-in,
.molle-business-app .molle-login-required { text-align: center; padding: 32px 16px; }

/* ---------- Guide profile ---------- */
.molle-business-app .molle-guide-profile { max-width: 800px; margin: 0 auto; }
.molle-business-app .molle-guide-cover {
  height: 180px;
  background-size: cover;
  background-position: center;
  border-radius: var(--molle-radius);
  margin-bottom: -40px;
}
.molle-business-app .molle-guide-main { padding: 0; }
.molle-business-app .molle-guide-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 768px) {
  .molle-business-app .molle-guide-cover { height: 240px; margin-bottom: -48px; }
  .molle-business-app .molle-guide-header { flex-direction: row; text-align: left; }
}
.molle-business-app .molle-guide-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--molle-radius);
  object-fit: cover;
  border: 3px solid var(--molle-surface);
  box-shadow: var(--molle-shadow);
}
@media (min-width: 768px) { .molle-business-app .molle-guide-logo { width: 80px; height: 80px; } }
.molle-business-app .molle-guide-header h1 { font-size: 20px; margin: 0; color: var(--molle-text); overflow-wrap: anywhere; }
@media (min-width: 768px) { .molle-business-app .molle-guide-header h1 { font-size: 24px; } }
.molle-business-app .molle-guide-category { color: var(--molle-text-muted); font-size: 14px; }
.molle-business-app .molle-guide-short { font-size: 16px; color: var(--molle-text-muted); margin-bottom: 20px; overflow-wrap: anywhere; }
.molle-business-app .molle-guide-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
@media (min-width: 768px) {
  .molle-business-app .molle-guide-gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
.molle-business-app .molle-guide-gallery img { width: 100%; height: 120px; object-fit: cover; border-radius: var(--molle-radius); }
@media (min-width: 768px) { .molle-business-app .molle-guide-gallery img { height: 150px; } }
.molle-business-app .molle-guide-section { margin-bottom: 24px; min-width: 0; }
.molle-business-app .molle-guide-section h2 { font-size: 18px; color: var(--molle-primary); border-bottom: 2px solid var(--molle-border); padding-bottom: 8px; }
.molle-business-app .molle-guide-contact, .molle-business-app .molle-guide-hours, .molle-business-app .molle-guide-facilities { list-style: none; padding: 0; }
.molle-business-app .molle-guide-contact li, .molle-business-app .molle-guide-hours li { padding: 8px 0; border-bottom: 1px solid var(--molle-border); overflow-wrap: anywhere; }
.molle-business-app .molle-guide-contact a, .molle-business-app .molle-guide-facilities a { color: var(--molle-primary); overflow-wrap: anywhere; }
.molle-business-app .molle-guide-facilities li { display: inline-block; background: var(--molle-surface-alt); padding: 6px 12px; border-radius: 20px; margin: 4px; font-size: 14px; }

/* ---------- Titles ---------- */
.molle-business-app .molle-title { font-size: 22px; font-weight: 700; color: var(--molle-primary); margin: 0 0 8px; overflow-wrap: anywhere; }
.molle-business-app .molle-subtitle { color: var(--molle-text-muted); margin: 0 0 20px; font-size: 16px; }
@media (min-width: 768px) { .molle-business-app .molle-title { font-size: 28px; } }

/* ---------- Sticky action bar ---------- */
.molle-business-app .molle-sticky-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--molle-surface);
  border-top: 1px solid var(--molle-border);
  padding: 12px 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  gap: 10px;
  flex-direction: column;
}
.molle-business-app .molle-sticky-bar .molle-btn { width: 100%; }
@media (min-width: 768px) {
  .molle-business-app .molle-sticky-bar { flex-direction: row; justify-content: flex-end; }
  .molle-business-app .molle-sticky-bar .molle-btn { width: auto; }
}
.molle-business-app .molle-sticky-spacer { height: calc(80px + env(safe-area-inset-bottom)); }

/* ---------- Long text safety ---------- */
.molle-business-app .molle-break-all,
.molle-business-app .molle-feed-row-info strong,
.molle-business-app .molle-feed-meta,
.molle-business-app .molle-feed-test-result,
.molle-business-app .molle-feed-import-result,
.molle-business-app .molle-dash-name,
.molle-business-app .molle-guide-header h1,
.molle-business-app .molle-guide-short {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ---------- Admin (scoped) ---------- */
.molle-business-app .molle-admin { max-width: 1200px; }
.molle-business-app .molle-admin-create {
  background: #fff;
  border: 1px solid #ccd0d4;
  border-radius: 4px;
  padding: 20px;
  margin: 20px 0;
}
.molle-business-app .molle-admin-create h2 { margin-top: 0; }
.molle-business-app .molle-admin .button-small { margin: 2px; }
