/* ================================================================
   Address Book App — Styles  (assets/css/app.css)
   ================================================================ */

/* ── Reset & Variables ─────────────────────────────────────────── */
:root {
  --ab-primary:       #4f46e5;
  --ab-primary-dark:  #4338ca;
  --ab-danger:        #dc2626;
  --ab-success:       #16a34a;
  --ab-warning:       #d97706;
  --ab-bg:            #f8fafc;
  --ab-surface:       #ffffff;
  --ab-border:        #e2e8f0;
  --ab-text:          #1e293b;
  --ab-text-muted:    #64748b;
  --ab-radius:        10px;
  --ab-shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --ab-shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --ab-transition:    .18s ease;
}

.ab-wrap * { box-sizing: border-box; }
.ab-wrap { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--ab-text); }

/* ── Buttons ────────────────────────────────────────────────────── */
.ab-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px; border: none;
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background var(--ab-transition), transform var(--ab-transition), opacity var(--ab-transition);
  text-decoration: none; white-space: nowrap;
}
.ab-btn:active { transform: translateY(1px); }
.ab-btn:disabled { opacity: .55; cursor: not-allowed; }

.ab-btn-primary  { background: var(--ab-primary); color: #fff; }
.ab-btn-primary:hover { background: var(--ab-primary-dark); color: #fff; }
.ab-btn-outline  { background: transparent; color: var(--ab-primary); border: 1.5px solid var(--ab-primary); }
.ab-btn-outline:hover { background: var(--ab-primary); color: #fff; }
.ab-btn-ghost    { background: transparent; color: var(--ab-text-muted); }
.ab-btn-ghost:hover { background: var(--ab-border); color: var(--ab-text); }
.ab-btn-danger   { background: var(--ab-danger); color: #fff; }
.ab-btn-danger:hover { background: #b91c1c; }
.ab-btn-full     { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.ab-btn-small    { padding: 4px 12px; font-size: 12px; }

/* ── Inputs ─────────────────────────────────────────────────────── */
.ab-input {
  width: 100%; padding: 9px 13px; border: 1.5px solid var(--ab-border);
  border-radius: 8px; font-size: 14px; color: var(--ab-text); background: #fff;
  transition: border-color var(--ab-transition), box-shadow var(--ab-transition);
  font-family: inherit;
}
.ab-input:focus { outline: none; border-color: var(--ab-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.ab-input::placeholder { color: var(--ab-text-muted); }
textarea.ab-input { resize: vertical; }

/* ── Alerts ─────────────────────────────────────────────────────── */
.ab-alert {
  padding: 10px 14px; border-radius: 8px; font-size: 14px;
  margin-bottom: 14px; border-left: 4px solid;
}
.ab-alert-error   { background: #fef2f2; border-color: var(--ab-danger);  color: #991b1b; }
.ab-alert-success { background: #f0fdf4; border-color: var(--ab-success); color: #14532d; }
.ab-alert-info    { background: #eff6ff; border-color: var(--ab-primary); color: #1e3a8a; }

/* ── Badge ──────────────────────────────────────────────────────── */
.ab-badge {
  background: var(--ab-border); color: var(--ab-text-muted);
  padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 500;
}
.ab-user-badge {
  background: #eef2ff; color: var(--ab-primary);
  padding: 4px 12px; border-radius: 99px; font-size: 13px; font-weight: 600;
}

/* ── App Header ─────────────────────────────────────────────────── */
.ab-app-header { background: var(--ab-surface); border-bottom: 1px solid var(--ab-border); position: sticky; top: 0; z-index: 100; }
.ab-app-header-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ab-app-title { font-size: 20px; font-weight: 700; margin: 0; }
.ab-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── App Main ───────────────────────────────────────────────────── */
.ab-app-main { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }

/* ── Toolbar ────────────────────────────────────────────────────── */
.ab-toolbar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 20px;
}
.ab-search-wrap { flex: 1; min-width: 200px; }
.ab-filter-wrap { width: 180px; }

/* ── Contact List ───────────────────────────────────────────────── */
.ab-contact-list { display: grid; gap: 12px; }

.ab-contact-card {
  background: var(--ab-surface); border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius); padding: 16px 18px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: box-shadow var(--ab-transition), transform var(--ab-transition);
}
.ab-contact-card:hover { box-shadow: var(--ab-shadow-md); transform: translateY(-1px); }

.ab-contact-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ab-primary) 0%, #7c3aed 100%);
  color: #fff; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase;
}
.ab-contact-info { flex: 1; min-width: 0; }
.ab-contact-name { font-size: 15px; font-weight: 600; margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-contact-meta { font-size: 13px; color: var(--ab-text-muted); display: flex; flex-wrap: wrap; gap: 12px; }
.ab-contact-meta a { color: var(--ab-text-muted); text-decoration: none; }
.ab-contact-meta a:hover { color: var(--ab-primary); }

.ab-contact-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ab-tag {
  background: #eef2ff; color: var(--ab-primary);
  padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 500;
}

.ab-contact-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Empty / Loading states ─────────────────────────────────────── */
.ab-loading, .ab-empty {
  text-align: center; color: var(--ab-text-muted);
  padding: 48px 20px; font-size: 15px;
}
.ab-empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ── Pagination ─────────────────────────────────────────────────── */
.ab-pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.ab-page-btn {
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1.5px solid var(--ab-border); border-radius: 8px;
  background: var(--ab-surface); color: var(--ab-text);
  font-size: 14px; cursor: pointer; transition: all var(--ab-transition);
  display: flex; align-items: center; justify-content: center;
}
.ab-page-btn:hover { border-color: var(--ab-primary); color: var(--ab-primary); }
.ab-page-btn.active { background: var(--ab-primary); border-color: var(--ab-primary); color: #fff; }
.ab-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Modal ──────────────────────────────────────────────────────── */
.ab-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.ab-modal[hidden] { display: none; }
.ab-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.45); backdrop-filter: blur(2px);
}
.ab-modal-box {
  position: relative; background: var(--ab-surface);
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  animation: abSlideUp .2s ease;
}
.ab-modal-sm { max-width: 380px; }
@keyframes abSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ab-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0; margin-bottom: 16px;
}
.ab-modal-header h2 { font-size: 18px; margin: 0; }
.ab-modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--ab-text-muted); padding: 4px; }
.ab-modal-body   { padding: 0 22px; }
.ab-modal-footer { padding: 18px 22px; display: flex; justify-content: flex-end; gap: 10px; }

/* ── Form groups ────────────────────────────────────────────────── */
.ab-form-group { margin-bottom: 14px; }
.ab-form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--ab-text); }
.ab-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Auth pages ─────────────────────────────────────────────────── */
.ab-auth-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; background: var(--ab-bg); }
.ab-auth-card { background: var(--ab-surface); border: 1px solid var(--ab-border); border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 420px; box-shadow: var(--ab-shadow-md); }
.ab-auth-logo  { font-size: 40px; text-align: center; margin-bottom: 12px; }
.ab-auth-title { font-size: 22px; font-weight: 700; text-align: center; margin: 0 0 6px; }
.ab-auth-sub   { text-align: center; color: var(--ab-text-muted); font-size: 14px; margin: 0 0 22px; }
.ab-auth-links { text-align: center; font-size: 13px; color: var(--ab-text-muted); margin-top: 18px; }
.ab-auth-links a { color: var(--ab-primary); text-decoration: none; font-weight: 500; }
.ab-form { display: flex; flex-direction: column; gap: 0; }

/* ── Docs page ──────────────────────────────────────────────────── */
.ab-docs-wrap { max-width: 800px; margin: 0 auto; padding: 32px 20px; }
.ab-docs-wrap h1 { font-size: 28px; margin-bottom: 8px; }
.ab-docs-intro { font-size: 16px; color: var(--ab-text-muted); margin-bottom: 28px; }
.ab-docs-toc { background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); padding: 16px 20px; margin-bottom: 32px; }
.ab-docs-toc h2 { font-size: 15px; margin: 0 0 10px; }
.ab-docs-toc ul { margin: 0; padding-left: 20px; }
.ab-docs-toc li { margin-bottom: 4px; font-size: 14px; }
.ab-docs-toc a  { color: var(--ab-primary); text-decoration: none; }
.ab-docs-wrap section { margin-bottom: 36px; }
.ab-docs-wrap h2 { font-size: 20px; border-bottom: 2px solid var(--ab-border); padding-bottom: 8px; margin-bottom: 16px; }
.ab-docs-wrap h3 { font-size: 16px; margin: 20px 0 10px; }
.ab-docs-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.ab-docs-table th { background: var(--ab-bg); padding: 8px 12px; text-align: left; border: 1px solid var(--ab-border); }
.ab-docs-table td { padding: 8px 12px; border: 1px solid var(--ab-border); }
.ab-method { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.ab-method.get    { background: #dcfce7; color: #15803d; }
.ab-method.post   { background: #dbeafe; color: #1d4ed8; }
.ab-method.put    { background: #fef9c3; color: #854d0e; }
.ab-method.delete { background: #fee2e2; color: #991b1b; }
.ab-code { background: #0f172a; color: #e2e8f0; padding: 16px 18px; border-radius: 8px; font-size: 13px; overflow-x: auto; line-height: 1.6; font-family: 'Fira Code', Consolas, monospace; white-space: pre; }
.ab-docs-cta { background: linear-gradient(135deg,#4f46e5,#7c3aed); color: #fff; border-radius: 14px; padding: 32px; text-align: center; margin-top: 36px; }
.ab-docs-cta h2 { color: #fff; border: none; font-size: 22px; margin-bottom: 8px; }
.ab-docs-cta p  { color: rgba(255,255,255,.85); margin-bottom: 18px; }

/* ── Pricing page ───────────────────────────────────────────────── */
.ab-pricing-wrap { max-width: 900px; margin: 0 auto; padding: 40px 20px; }
.ab-pricing-header { text-align: center; margin-bottom: 40px; }
.ab-pricing-header h1 { font-size: 30px; margin-bottom: 8px; }
.ab-pricing-header p  { font-size: 16px; color: var(--ab-text-muted); }
.ab-pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ab-pricing-card { border: 1.5px solid var(--ab-border); border-radius: 16px; padding: 28px; position: relative; background: var(--ab-surface); }
.ab-pricing-featured { border-color: var(--ab-primary); box-shadow: 0 0 0 4px rgba(79,70,229,.08); }
.ab-pricing-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--ab-primary); color: #fff; padding: 3px 14px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.ab-pricing-tier  { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.ab-pricing-price { margin-bottom: 20px; }
.ab-price-amount  { font-size: 36px; font-weight: 800; }
.ab-price-period  { font-size: 14px; color: var(--ab-text-muted); }
.ab-pricing-features { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.ab-pricing-faq { margin-top: 48px; }
.ab-pricing-faq h2 { font-size: 22px; margin-bottom: 16px; }
.ab-faq-item { border: 1px solid var(--ab-border); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.ab-faq-item summary { padding: 14px 16px; cursor: pointer; font-weight: 500; font-size: 14px; }
.ab-faq-item p { padding: 0 16px 14px; font-size: 14px; color: var(--ab-text-muted); margin: 0; }

/* ── Developer page ─────────────────────────────────────────────── */
.ab-developer-wrap { max-width: 900px; margin: 0 auto; padding: 40px 20px; }
.ab-hero { text-align: center; margin-bottom: 48px; }
.ab-hero h1 { font-size: 32px; margin-bottom: 12px; }
.ab-hero-sub { font-size: 16px; color: var(--ab-text-muted); margin-bottom: 24px; }
.ab-hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ab-features-grid h2 { font-size: 22px; text-align: center; margin-bottom: 24px; }
.ab-feature-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 48px; }
.ab-feature-card { background: var(--ab-surface); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); padding: 20px; }
.ab-feature-icon { font-size: 28px; margin-bottom: 10px; }
.ab-feature-card h3 { font-size: 15px; margin: 0 0 6px; }
.ab-feature-card p  { font-size: 13px; color: var(--ab-text-muted); margin: 0; line-height: 1.5; }
.ab-code-preview { margin-bottom: 36px; }
.ab-code-preview h2 { font-size: 22px; margin-bottom: 14px; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ab-app-header-inner { flex-direction: column; align-items: flex-start; }
  .ab-toolbar { flex-direction: column; }
  .ab-filter-wrap, .ab-search-wrap { width: 100%; }
  .ab-form-row { grid-template-columns: 1fr; }
  .ab-pricing-grid { grid-template-columns: 1fr; }
  .ab-contact-card { flex-direction: column; }
  .ab-contact-actions { align-self: flex-end; }
}

/* ── Register extras ────────────────────────────────────────────── */
.ab-required   { color: var(--ab-danger); margin-left: 2px; }
.ab-field-hint { font-size: 12px; color: var(--ab-text-muted); margin: 4px 0 0; }
