/* Science of ECD — shared app styles.
   Brand palette + type pulled from scienceofecd.com. Edit tokens in :root
   to re-skin; everything below references them. */

:root {
    --brand-teal: #047079;        /* primary brand / accents */
    --brand-teal-link: #005b72;   /* links */
    --brand-coral: #f45b4f;       /* primary buttons / CTAs */
    --brand-coral-hover: #ee4d41;
    --brand-crimson: #c81f45;     /* link hover / accent */

    --bg: #ffffff;
    --text: #555555;
    --heading: #333333;
    --border: #dddddd;

    --font-body: 'Open Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-heading: 'Lucida Grande', Helvetica, Arial, sans-serif;
}

/* -- Base ---------------------------------------------------------------- */
body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--brand-teal-link); }
a:hover { color: var(--brand-crimson); }

/* -- Header -------------------------------------------------------------- */
/* White header with a teal accent underline; logo sits at left. */
header {
    background: #fff;
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--brand-teal);
}
header .brand { display: flex; align-items: center; line-height: 0; }
header .brand img { height: 52px; width: auto; display: block; }
header .actions { display: flex; gap: 0.5rem; }
header .actions form { margin: 0; }
header .actions button {
    background: transparent;
    color: var(--brand-teal-link);
    border: 1px solid var(--brand-teal-link);
    padding: 0.35rem 0.9rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
header .actions button:hover {
    background: var(--brand-teal-link);
    color: #fff;
}
header .actions .header-link {
    color: var(--brand-teal-link);
    font-size: 0.9rem;
    text-decoration: none;
    padding: 0.35rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s;
}
header .actions .header-link:hover { color: var(--brand-crimson); }

/* -- Main / headings ----------------------------------------------------- */
main { max-width: 720px; margin: 3rem auto; padding: 0 1.25rem; }
main h2 {
    margin-top: 0;
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--brand-teal);
}

/* -- Messages ------------------------------------------------------------ */
.messages { max-width: 720px; margin: 1.25rem auto 0; padding: 0 1.25rem; }
.message { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 0.5rem; font-size: 0.95rem; }
.message-success { background: #e6f4ea; color: #1d5a32; border: 1px solid #b6dcc1; }
.message-error { background: #fbe7e9; color: #7a1f25; border: 1px solid #f0c0c4; }
.message-warning { background: #fdf3d8; color: #6e4f0a; border: 1px solid #f1d98a; }
.message-info { background: #e3eef5; color: #1f4762; border: 1px solid #b7d2e2; }

/* -- Forms (login + password reset share these) -------------------------- */
form p { margin: 0.85rem 0; }
form label { display: block; font-size: 0.9rem; margin-bottom: 0.3rem; color: var(--text); }
form input {
    width: 100%;
    padding: 0.55rem 0.7rem;
    box-sizing: border-box;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    font-family: inherit;
}
form input:focus {
    outline: none;
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 3px rgba(4, 112, 121, 0.15);
}

.btn-primary {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    background: var(--brand-coral);
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.15s;
    margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--brand-coral-hover); }

.muted { color: var(--text); font-size: 0.95rem; }
.errors { color: var(--brand-crimson); font-weight: 600; margin: 1rem 0; }
.helptext { font-size: 0.8rem; color: #888; }
ul.errorlist { color: var(--brand-crimson); padding-left: 1.2rem; margin: 0.25rem 0; }

/* -- My Sites list ------------------------------------------------------- */
.empty { color: #777; font-style: italic; }
.site-list { list-style: none; padding: 0; }
.site-list li {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.site-list li:hover {
    border-color: var(--brand-teal);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.07);
}
.site-link {
    flex: 1 1 auto;
    display: block;
    padding: 1.15rem 1.4rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
.site-name {
    display: block;
    color: var(--brand-teal-link);
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
    transition: color 0.15s;
}
.site-link:hover .site-name { color: var(--brand-crimson); }

/* Reorder controls (up/down arrows) to the right of each site. */
.site-controls {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
    padding: 0 0.9rem;
    border-left: 1px solid var(--border);
}
.site-controls form { margin: 0; line-height: 0; }
.site-controls button {
    width: 30px;
    height: 26px;
    background: transparent;
    color: var(--brand-teal-link);
    border: 1px solid var(--brand-teal-link);
    border-radius: 4px;
    font-size: 0.8rem;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.site-controls button:hover:not(:disabled) {
    background: var(--brand-teal-link);
    color: #fff;
}
.site-controls button:disabled { opacity: 0.35; cursor: default; }
.site-desc {
    display: block;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.55rem;
    line-height: 1.5;
}
.site-open {
    display: block;
    font-size: 0.8rem;
    color: #999;
}

/* -- Launch / loading spinner -------------------------------------------- */
.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--border);
    border-top-color: var(--brand-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin: 0; color: var(--brand-teal); font-size: 1.05rem; }
.fallback { margin-top: 1.5rem; font-size: 0.9rem; color: #666; text-align: center; }

/* -- Footer -------------------------------------------------------------- */
footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.82rem;
    color: #999;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}
footer a { color: #999; text-decoration: underline; }
footer a:hover { color: var(--brand-teal); }
