/* ─────────────────────────────────────────────────────────────
   Coach Mali – App CSS  (matches reference design)
   Dark navy, clean minimal, Inter-style sans-serif.
───────────────────────────────────────────────────────────── */

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

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --cm-page-bg:    #10121a;
  --cm-card-bg:    #181c2a;
  --cm-border:     rgba(255,255,255,.08);
  --cm-input-bg:   #1e2235;
  --cm-input-border: rgba(255,255,255,.1);
  --cm-input-focus: rgba(255,255,255,.22);
  --cm-text:       #e8eaf0;
  --cm-text-muted: #5b6080;
  --cm-label:      #9ba3bf;
  --cm-btn-bg:     #1e2235;
  --cm-btn-bg-hover: #252b42;
  --cm-btn-text:   #c8ceea;
  --cm-placeholder-icon: #2a2f47;
  --cm-placeholder-title: #e8eaf0;
  --cm-placeholder-sub:   #5b6080;
  --cm-error-bg:   rgba(220,60,50,.1);
  --cm-error-border: rgba(220,60,50,.35);
  --cm-error-text: #f08070;
  --cm-success:    #6fcf97;
  --cm-radius-card: 12px;
  --cm-radius-input: 8px;
  --cm-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Page wrapper ────────────────────────────────────────── */
.cm-wrap {
  font-family: var(--cm-font);
  background: var(--cm-page-bg);
  color: var(--cm-text);
  min-height: 100vh;
  padding: 0 0 48px;
  max-width: 420px;
  margin: 0 auto;
  box-sizing: border-box;
}

.cm-wrap *,
.cm-wrap *::before,
.cm-wrap *::after {
  box-sizing: border-box;
}

/* ── Header ──────────────────────────────────────────────── */
.cm-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px 18px;
}

.cm-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.cm-logo__img {
  height: 44px;
  width: auto;
  display: block;
  object-fit: contain;
}

.cm-header__text {
  flex: 1;
}

.cm-header__title {
  margin: 0 0 2px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cm-text);
  line-height: 1.25;
}

.cm-header__subtitle {
  margin: 0;
  font-size: .72rem;
  color: var(--cm-text-muted);
  line-height: 1.4;
}

/* ── Cards ───────────────────────────────────────────────── */
.cm-card {
  background: var(--cm-card-bg);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-card);
  padding: 20px 18px 22px;
  margin: 0 12px 14px;
}

/* ── Alert ───────────────────────────────────────────────── */
.cm-alert {
  border-radius: 7px;
  padding: 11px 14px;
  font-size: .83rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.cm-alert--error {
  background: var(--cm-error-bg);
  border: 1px solid var(--cm-error-border);
  color: var(--cm-error-text);
}

/* ── Form fields ─────────────────────────────────────────── */
.cm-field {
  margin-bottom: 16px;
}

.cm-field--last {
  margin-bottom: 0;
}

.cm-label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--cm-label);
  margin-bottom: 8px;
  letter-spacing: .01em;
}

.cm-input {
  width: 100%;
  background: var(--cm-input-bg);
  border: 1px solid var(--cm-input-border);
  border-radius: var(--cm-radius-input);
  color: var(--cm-text);
  font-family: var(--cm-font);
  font-size: .88rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
  -webkit-appearance: none;
}

.cm-input:focus {
  border-color: var(--cm-input-focus);
  box-shadow: 0 0 0 3px rgba(255,255,255,.04);
}

.cm-input::placeholder {
  color: rgba(91,96,128,.7);
  font-size: .85rem;
}

.cm-textarea {
  resize: vertical;
  min-height: 130px;
  line-height: 1.6;
}

/* ── Generate button ─────────────────────────────────────── */
.cm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 18px;
  padding: 13px 20px;
  background: var(--cm-btn-bg);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--cm-radius-input);
  color: var(--cm-btn-text);
  font-family: var(--cm-font);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: .01em;
  transition: background .18s ease, border-color .18s ease;
}

.cm-btn:hover:not(:disabled) {
  background: var(--cm-btn-bg-hover);
  border-color: rgba(255,255,255,.15);
}

.cm-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.cm-btn__icon {
  width: 16px;
  height: 16px;
  color: var(--cm-btn-text);
  flex-shrink: 0;
}

.cm-btn__spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(200,206,234,.2);
  border-top-color: var(--cm-btn-text);
  border-radius: 50%;
  animation: cm-spin .65s linear infinite;
  flex-shrink: 0;
}

.cm-btn.cm-btn--loading .cm-btn__spinner { display: block; }
.cm-btn.cm-btn--loading .cm-btn__icon   { display: none; }

@keyframes cm-spin { to { transform: rotate(360deg); } }

/* ── Preview card ────────────────────────────────────────── */
.cm-card--preview {
  padding: 32px 18px 36px;
  text-align: center;
}

.cm-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.cm-placeholder__icon-wrap {
  width: 58px;
  height: 58px;
  background: var(--cm-placeholder-icon);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.3);
  margin-bottom: 4px;
}

.cm-placeholder__icon-wrap svg {
  width: 30px;
  height: 30px;
}

.cm-placeholder__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cm-placeholder-title);
}

.cm-placeholder__sub {
  margin: 0;
  font-size: .78rem;
  color: var(--cm-placeholder-sub);
  line-height: 1.55;
  max-width: 220px;
}

/* ── Result ──────────────────────────────────────────────── */
.cm-result-img {
  width: 100%;
  border-radius: 9px;
  display: block;
  box-shadow: 0 6px 28px rgba(0,0,0,.5);
}

.cm-result-meta {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.cm-success-msg {
  margin: 0;
  font-size: .85rem;
  font-weight: 600;
  color: var(--cm-success);
}

.cm-post-link {
  color: #7b9cff;
  font-size: .87rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(123,156,255,.3);
  transition: color .15s, border-color .15s;
}

.cm-post-link:hover {
  color: #aabfff;
  border-color: rgba(123,156,255,.6);
}

/* ── Noscript ────────────────────────────────────────────── */
.cm-noscript {
  margin-top: 12px;
  font-size: .8rem;
  color: var(--cm-error-text);
  background: var(--cm-error-bg);
  border: 1px solid var(--cm-error-border);
  border-radius: 7px;
  padding: 10px 14px;
}

/* ── Responsive tweak for wider screens ──────────────────── */
@media (min-width: 480px) {
  .cm-wrap {
    padding-top: 8px;
    padding-bottom: 64px;
  }

  .cm-header {
    padding: 24px 22px 20px;
  }

  .cm-card {
    margin: 0 16px 16px;
    padding: 22px 22px 26px;
  }
}
