/* ChainAnchor shared design system — loaded on every page for a consistent
   look (font, color, components). Complements Tailwind CDN utilities. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;        /* indigo-600 */
    --primary-hover: #4338ca;  /* indigo-700 */
    --primary-soft: #eef2ff;   /* indigo-50  */
    --ring: rgba(79, 70, 229, .35);
}

* { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }

/* Make accent utilities resolve to the brand indigo even where older markup
   still says blue, so the whole app shares one primary color. */
.hidden { display: none !important; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem .9rem; font-size: .875rem; font-weight: 600; line-height: 1;
    border-radius: .5rem; border: 1px solid transparent; cursor: pointer;
    transition: background-color .15s, border-color .15s, box-shadow .15s, opacity .15s;
    white-space: nowrap; text-decoration: none;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sm { padding: .35rem .6rem; font-size: .75rem; border-radius: .4rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }

/* ---- Inputs ---- */
.input {
    width: 100%; padding: .5rem .75rem; font-size: .875rem;
    border: 1px solid #d1d5db; border-radius: .5rem; background: #fff; color: #111827;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

/* ---- Surfaces ---- */
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: .75rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }

/* ---- Shared header ---- */
.site-header { background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 40; }
.site-header .wrap { max-width: 72rem; margin: 0 auto; padding: .65rem 1.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; }
.site-nav { flex-wrap: wrap; }
.hdr-login { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.hdr-login .input { width: 9.5rem; padding: .35rem .6rem; }
.site-header .brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: #1f2937; font-size: 1.15rem; text-decoration: none; }
.site-header .brand img { height: 1.9rem; width: auto; }
.site-nav { display: flex; align-items: center; gap: 1.1rem; }
.site-nav a { font-size: .875rem; color: #4b5563; text-decoration: none; }
.site-nav a:hover { color: var(--primary); }
.site-nav a.active { color: var(--primary); font-weight: 600; }
.tier-chip { font-size: .7rem; font-weight: 700; text-transform: uppercase; padding: .15rem .5rem; border-radius: 9999px; }
.tier-chip.free { background: #fef9c3; color: #a16207; }
.tier-chip.pro { background: #dcfce7; color: #15803d; }

/* Account dropdown menu in the header */
.hdr-user { position: relative; }
.hdr-avatar { display: flex; align-items: center; gap: .35rem; border: 0; background: none; cursor: pointer; padding: .1rem .2rem; border-radius: 9999px; }
.hdr-avatar .av { width: 32px; height: 32px; border-radius: 9999px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.hdr-avatar .cv { color: #6b7280; font-size: .95rem; line-height: 1; }
.hdr-menu { position: absolute; right: 0; top: calc(100% + 10px); background: #fff; border: 1px solid #e5e7eb; border-radius: .6rem; box-shadow: 0 12px 32px rgba(0,0,0,.13); min-width: 214px; padding: .4rem; z-index: 50; }
.hdr-menu .mh { padding: .45rem .6rem .55rem; border-bottom: 1px solid #f0f0f0; margin-bottom: .3rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.hdr-menu a, .hdr-menu button { display: block; width: 100%; text-align: left; padding: .45rem .6rem; border-radius: .4rem; color: #374151; font-size: .9rem; font-weight: 400; border: 0; background: none; cursor: pointer; }
.hdr-menu a:hover, .hdr-menu button:hover { background: #f3f4f6; color: #374151; }
.hdr-menu a.active { color: var(--primary); font-weight: 600; }
.hdr-menu .sep { height: 1px; background: #f0f0f0; margin: .3rem 0; }

/* ---- Toasts ---- */
#toast-stack { position: fixed; top: 1rem; right: 1rem; z-index: 2147483000; display: flex; flex-direction: column; gap: .5rem; max-width: min(92vw, 24rem); }
.toast {
    display: flex; align-items: flex-start; gap: .5rem; padding: .7rem .9rem; border-radius: .6rem; color: #fff;
    font-size: .85rem; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: toast-in .18s ease-out;
}
.toast.success { background: #16a34a; } .toast.error { background: #dc2626; }
.toast.info { background: #334155; } .toast.warn { background: #d97706; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---- Modal ---- */
.ui-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 2147483100; animation: toast-in .15s ease-out; }
.ui-modal { background: #fff; border-radius: .9rem; box-shadow: 0 20px 50px rgba(0,0,0,.3); width: 100%; max-width: 26rem; padding: 1.5rem; }
.ui-modal h3 { font-size: 1.1rem; font-weight: 700; color: #111827; }
.ui-modal p { margin-top: .4rem; font-size: .9rem; color: #4b5563; }
.ui-modal .row { margin-top: 1.25rem; display: flex; justify-content: flex-end; gap: .5rem; }
