/* ============================================================================
 *  Comunata — Pagina Mea v2 — Stiluri aditive
 *
 *  Acest fișier adaugă DOAR clase noi cu prefixul .pm- (Pagina Mea).
 *  NU MODIFICĂ clasele existente din style.css.
 *  Se încarcă DUPĂ style.css în <head>.
 *
 *  Paleta de culori (din style.css :root, NU hard-coded):
 *    --bg:       #f0f4fa (fundal pagină)
 *    --card:     #ffffff (carduri)
 *    --text:     #080f1e (text principal)
 *    --muted:    #5a6680 (text secundar)
 *    --border:   #e0e7f2 (borduri)
 *    --blue:     #00D2FF (brand color ComunaTa)
 *    --accent:   #00D2FF (accent)
 *    --radius:   16px
 *    --shadow:   0 8px 32px rgba(8,15,30,.10)
 *    --soft:     0 2px 12px rgba(8,15,30,.07)
 * ========================================================================== */

/* ─── Layout Pagina Mea ─────────────────────────────────────────────────── */
.pm-wrap { max-width: 760px; margin: 0 auto; padding: 0 20px 56px; }

.pm-head { padding: 28px 0 6px; }
.pm-head h1 { font-size: 28px; font-weight: 800; color: var(--text); margin: 6px 0 4px; }
.pm-subtitle { font-size: 14px; color: var(--muted); margin: 4px 0 0; line-height: 1.5; }
.pm-muted { color: var(--muted); }
.pm-back { margin: 12px 0 20px; }

/* ─── Carduri ───────────────────────────────────────────────────────────── */
.pm-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--soft);
}

.pm-guide-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
}

.pm-guide-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.pm-guide-list li {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.5;
}
.pm-guide-bullet {
  color: var(--blue);
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Info card (datele firmei pre-completate) ──────────────────────────── */
.pm-info-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.pm-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  margin: 0;
}
.pm-info-grid > div {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.pm-info-grid dt {
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.pm-info-grid dd {
  margin: 0;
  font-weight: 500;
}

/* ─── Status (activare în curs) ─────────────────────────────────────────── */
.pm-status {
  background: linear-gradient(135deg, #fef9e7 0%, #fef3c7 100%);
  border-color: #fde68a;
}
.pm-status-title {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 6px;
}
.pm-status-text {
  margin: 0;
  font-size: 13px;
  color: #78350f;
  line-height: 1.6;
}
.pm-status-text strong { color: #92400e; }

/* ─── Butoane acțiuni ──────────────────────────────────────────────────── */
.pm-actions {
  margin-bottom: 24px;
  display: grid;
  gap: 12px;
}
.pm-actions-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pm-btn-primary,
.pm-btn-secondary {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform .15s, box-shadow .15s, opacity .15s;
  font-family: inherit;
}
.pm-btn-primary {
  background: var(--blue);
  color: #0b132b;
  border: none;
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.28);
  font-size: 16px;
  padding: 16px;
}
.pm-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 210, 255, 0.38);
}
.pm-btn-secondary {
  background: var(--card);
  color: var(--text);
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
}
.pm-btn-secondary:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ─── Modal Pagina Mea (override mp-modal pentru formularul nostru) ────── */
.pm-modal-page .pm-modal-dialog {
  max-width: 560px;
  width: calc(100% - 24px);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}
.pm-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.pm-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.pm-modal-body {
  padding: 16px 20px 8px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.pm-modal-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.5;
}
.pm-modal-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--card);
  border-radius: 0 0 12px 12px;
}

/* ─── Form ─────────────────────────────────────────────────────────────── */
.pm-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pm-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.pm-input,
.pm-select {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
  /* Mobile: minim 44px înălțime pentru touch */
  min-height: 44px;
}
.pm-input::placeholder {
  color: #94a3b8; /* slate-400 — vizibil pe fundal alb */
  opacity: 1;
}
.pm-input:focus,
.pm-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.15);
}
.pm-input-textarea {
  min-height: 90px;
  resize: vertical;
  font-family: inherit;
}

.pm-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pm-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0;
}
.pm-fieldset legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 0 6px;
}
.pm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin: 6px 0;
  cursor: pointer;
  min-height: 32px;
}
.pm-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  cursor: pointer;
}

.pm-form-optional {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

/* ─── Upload imagini ───────────────────────────────────────────────────── */
.pm-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
  text-align: center;
  transition: border-color .15s, background .15s;
}
.pm-upload-area:hover {
  border-color: var(--blue);
  background: #f0fdff;
}
.pm-upload-btn {
  padding: 10px 18px;
  background: var(--card);
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  min-height: 44px;
}
.pm-upload-btn:hover {
  background: var(--blue);
  color: #0b132b;
}
.pm-upload-hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.pm-image-preview {
  margin-top: 12px;
}
.pm-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}
.pm-image-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}
.pm-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pm-image-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--blue);
  color: #0b132b;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pm-image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(8, 15, 30, 0.7);
  color: #fff;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background .15s;
}
.pm-image-remove:hover {
  background: #ef4444;
}
.pm-image-count {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ─── AI Assistant ─────────────────────────────────────────────────────── */
.pm-btn-ai {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--blue) 0%, #6366f1 100%);
  color: #0b132b;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  box-shadow: 0 4px 14px rgba(0, 210, 255, 0.2);
  min-height: 44px;
}
.pm-btn-ai:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.3);
}
.pm-btn-ai:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.pm-ai-result {
  margin-top: 4px;
  padding: 14px;
  background: linear-gradient(135deg, #f0fdff 0%, #eef2ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 10px;
}
.pm-ai-loading {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
}
.pm-ai-section {
  margin-bottom: 12px;
}
.pm-ai-section:last-child {
  margin-bottom: 0;
}
.pm-ai-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.pm-ai-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}
.pm-ai-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pm-ai-tag {
  display: inline-block;
  padding: 3px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}
.pm-ai-meta {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* ─── Status messages (form) ───────────────────────────────────────────── */
.pm-form-status {
  margin: 8px 0 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
  min-height: 0;
  transition: padding .15s;
}
.pm-form-status[data-tone="err"] {
  color: #991b1b;
  padding: 8px 12px;
  background: #fee2e2;
  border-radius: 8px;
}
.pm-form-status[data-tone="ok"] {
  color: #15803d;
  padding: 8px 12px;
  background: #dcfce7;
  border-radius: 8px;
}
.pm-form-status[data-tone="info"] {
  color: #1e40af;
  padding: 8px 12px;
  background: #dbeafe;
  border-radius: 8px;
}

/* ─── Mobile UX ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .pm-wrap { padding: 0 16px 40px; }
  .pm-head h1 { font-size: 22px; }
  .pm-head { padding: 20px 0 4px; }
  .pm-card { padding: 16px; border-radius: 12px; }
  .pm-info-grid { grid-template-columns: 1fr; }
  .pm-actions-secondary { grid-template-columns: 1fr; }
  .pm-row-2 { grid-template-columns: 1fr; gap: 10px; }
  .pm-modal-page .pm-modal-dialog {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }
  .pm-modal-page .mp-modal-backdrop { background: rgba(8,15,30,.6); }
  .pm-modal-footer {
    flex-direction: column-reverse;
    padding: 12px 16px 16px;
  }
  .pm-modal-footer button {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
  }
  .pm-image-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
  }
}

/* ─── Dark theme support (dacă body are .dark) ────────────────────────── */
body.dark .pm-card,
body.dark .pm-input,
body.dark .pm-select,
body.dark .pm-upload-area {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
body.dark .pm-status {
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.08) 0%, rgba(254, 243, 199, 0.04) 100%);
  border-color: rgba(253, 230, 138, 0.3);
}
body.dark .pm-status-title { color: #fde68a; }
body.dark .pm-status-text { color: #fef3c7; }
body.dark .pm-ai-result {
  background: rgba(0, 210, 255, 0.05);
  border-color: rgba(199, 210, 254, 0.2);
}
body.dark .pm-upload-area:hover { background: rgba(0, 210, 255, 0.08); }

/* ═══ LEAD ENGINE — P1: Tab Leaduri în Pagina Mea ═══ */

.pm-leads { margin-top: 18px; }
.pm-leads-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.pm-leads-title { font-size: 18px; font-weight: 700; color: var(--text, #1a202c); margin: 0; }
.pm-leads-new-count {
  display: inline-block;
  background: #14b8a6;
  color: white;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.pm-leads-loading { font-size: 13px; color: var(--muted, #6b7280); }
.pm-leads-subtitle { font-size: 13px; color: var(--muted, #6b7280); margin: 4px 0 14px; }
.pm-leads-error {
  padding: 12px;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid #fecaca;
}
.pm-leads-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.pm-leads-filter {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #6b7280);
  cursor: pointer;
  transition: all 0.15s;
}
.pm-leads-filter:hover { border-color: #14b8a6; color: #0f766e; }
.pm-leads-filter-active {
  background: #14b8a6;
  color: white;
  border-color: #14b8a6;
}
.pm-leads-filter-active:hover { color: white; opacity: 0.9; }
.pm-leads-badge {
  display: inline-block;
  background: #ef4444;
  color: white;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
  font-weight: 700;
}
.pm-leads-filter-active .pm-leads-badge { background: white; color: #14b8a6; }

.pm-leads-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--muted, #6b7280);
}
.pm-leads-empty-icon { font-size: 36px; margin-bottom: 8px; }
.pm-leads-empty-title { font-size: 15px; font-weight: 600; color: var(--text, #1a202c); margin: 0 0 4px; }
.pm-leads-empty-text { font-size: 13px; max-width: 360px; margin: 0 auto; line-height: 1.5; }

.pm-leads-list { display: flex; flex-direction: column; gap: 10px; }

.pm-lead-card {
  background: var(--bg, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 12px 14px;
  transition: box-shadow 0.15s;
}
.pm-lead-card:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.pm-lead-card.pm-lead-status-new { border-left: 3px solid #14b8a6; }
.pm-lead-card.pm-lead-status-contacted { border-left: 3px solid #f59e0b; }
.pm-lead-card.pm-lead-status-resolved { border-left: 3px solid #10b981; opacity: 0.85; }
.pm-lead-card.pm-lead-status-archived { border-left: 3px solid #9ca3af; opacity: 0.6; }
.pm-lead-card.pm-lead-status-spam { border-left: 3px solid #ef4444; opacity: 0.5; }

.pm-lead-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.pm-lead-client { font-size: 14px; color: var(--text, #1a202c); }
.pm-lead-anonymous { color: var(--muted, #9ca3af); font-style: italic; font-size: 13px; }
.pm-lead-status-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pm-status-new { background: #f0fdfa; color: #0f766e; border: 1px solid #14b8a6; }
.pm-status-contacted { background: #fffbeb; color: #92400e; border: 1px solid #f59e0b; }
.pm-status-resolved { background: #f0fdf4; color: #065f46; border: 1px solid #10b981; }
.pm-status-archived { background: #f3f4f6; color: #4b5563; border: 1px solid #9ca3af; }
.pm-status-spam { background: #fef2f2; color: #991b1b; border: 1px solid #ef4444; }

.pm-lead-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted, #6b7280);
  margin-bottom: 8px;
}
.pm-lead-source { font-weight: 500; color: var(--text, #4b5563); }
.pm-lead-date { color: var(--muted, #9ca3af); }

.pm-lead-message {
  font-size: 13px;
  color: var(--text, #4b5563);
  background: var(--bg-soft, #f9fafb);
  padding: 8px 10px;
  border-radius: 6px;
  margin: 8px 0;
  line-height: 1.5;
  border-left: 2px solid var(--border, #e5e7eb);
}

.pm-lead-contacts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.pm-lead-contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--bg-soft, #f3f4f6);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text, #1a202c);
  text-decoration: none;
  transition: all 0.15s;
}
.pm-lead-contact-btn:hover {
  background: #f0fdfa;
  border-color: #14b8a6;
  color: #0f766e;
}

.pm-lead-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pm-lead-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.pm-lead-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pm-lead-btn-contact { background: #f59e0b; color: white; }
.pm-lead-btn-contact:hover:not(:disabled) { background: #d97706; }
.pm-lead-btn-resolve { background: #10b981; color: white; }
.pm-lead-btn-resolve:hover:not(:disabled) { background: #059669; }

/* Dark mode overrides */
body.dark .pm-lead-card { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
body.dark .pm-lead-card:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
body.dark .pm-lead-message { background: rgba(0,0,0,0.2); border-left-color: rgba(255,255,255,0.1); }
body.dark .pm-lead-contact-btn { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); color: #e5e7eb; }
body.dark .pm-leads-filter { background: transparent; border-color: rgba(255,255,255,0.1); color: #9ca3af; }
