/* ---------------------------------------------------------------------
   Storer Home Pages - shared styles
   Clean, card-based, mobile-first. Each user's chosen accent colour is
   applied via a CSS variable set inline on <body> from their settings.
--------------------------------------------------------------------- */

:root {
    --accent: #3a6ea5;
    --accent-contrast: #ffffff;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1f2430;
    --muted: #6b7280;
    --border: #e3e6eb;
    --danger: #c0392b;
    --success: #2f855a;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 20, 40, 0.08), 0 1px 2px rgba(20, 20, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

a { color: var(--accent); }
a:hover { text-decoration: none; }

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px 48px;
}

/* ---- Top bar ---- */
.topbar {
    background: transparent;
    margin-bottom: 8px;
}
.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 18px 16px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    text-decoration: none;
}
.brand span { color: var(--accent); }
.nav-links {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}
.nav-links a {
    color: var(--text);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 1.15rem;
}
.nav-links a:hover, .nav-links a.active {
    background: var(--bg);
    color: var(--accent);
}
.nav-links .signout {
    color: var(--muted);
}

/* ---- Cards / boxes ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.page-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.page-title h1 { margin: 0; font-size: 1.5rem; }
.page-title .subtitle { color: var(--muted); font-size: 0.95rem; }

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 1.15rem;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover { filter: brightness(0.93); }
.btn.secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 0.82rem; }

/* ---- Forms ---- */
form.stack { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
label { display: block; font-size: 0.88rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=url],
input[type=number], input[type=color], input[type=file], textarea, select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 160px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.help { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

/* ---- Flash messages ---- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.92rem; }
.flash.success { background: #eaf7ef; color: var(--success); border: 1px solid #cdebd9; }
.flash.error   { background: #fdeceb; color: var(--danger);  border: 1px solid #f6cfc9; }
.flash.info    { background: #eaf1fb; color: #2b4f7c; border: 1px solid #d3e2f6; }

/* ---- Link grid (dashboard) ---- */
.section-heading {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin: 28px 0 12px;
}
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.link-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
    color: var(--text);
    box-shadow: var(--shadow);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.link-tile:hover { border-color: var(--accent); }
.link-tile img { width: 48px; height: 48px; object-fit: contain; }
.link-tile .name { font-size: 0.88rem; font-weight: 600; }
.link-tile .desc { font-size: 0.76rem; color: var(--muted); }
.link-tile .tile-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--radius);
}
.link-tile .edit-cog {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    font-size: 0.75rem;
    color: var(--muted);
    text-decoration: none;
    background: var(--bg);
    border-radius: 50%;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
}

.shortlist { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; justify-content: center; }
.shortlist a {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 1.15rem;
    text-decoration: none;
    color: var(--text);
}

/* ---- Speed-dial style dashboard (Firefox new-tab inspired) ---- */
.speed-dial-wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding-top: 18px;
}
.speed-dial-greeting {
    text-align: center;
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 18px;
}
.speed-dial-greeting strong { color: var(--text); }
.speed-dial-search {
    max-width: 560px;
    margin: 0 auto 40px;
    position: relative;
}
.speed-dial-search input {
    width: 100%;
    padding: 13px 20px 13px 42px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 1rem;
}
.speed-dial-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.speed-dial-search .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    font-size: 1rem;
}
.tile-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 38px 30px;
    margin: 0 auto 8px;
}
.tile {
    width: 188px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    position: relative;
    text-align: center;
}
.tile .icon-square {
    width: 125px;
    height: 125px;
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.1s ease;
}
.tile:hover .icon-square { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(20,20,40,0.15); }
.tile .icon-square img { width: 75px; height: 75px; object-fit: contain; }
.tile .label {
    font-size: 1.15rem;
    max-width: 188px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tile .tile-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.tile .edit-cog {
    position: absolute;
    top: -4px;
    right: 10px;
    z-index: 2;
    font-size: 0.7rem;
    color: var(--muted);
    text-decoration: none;
    background: var(--surface);
    box-shadow: var(--shadow);
    border-radius: 50%;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.tile:hover .edit-cog { opacity: 1; }
.tile.no-match { display: none; }

.weather-card {
    position: fixed;
    top: 18px;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 16px;
    min-width: 150px;
    z-index: 5;
}
.weather-card .wc-location { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.weather-card .wc-row { display: flex; align-items: center; gap: 8px; }
.weather-card .wc-icon { font-size: 1.6rem; line-height: 1; }
.weather-card .wc-temp { font-size: 1.3rem; font-weight: 700; }
.weather-card .wc-minmax { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 720px) {
    .weather-card { position: static; margin: 0 auto 20px; width: fit-content; }
}

/* ---- Gratitude journal ---- */
.journal-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}
.journal-item summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.journal-item summary::-webkit-details-marker { display: none; }
.journal-item summary .meta { font-weight: 400; font-size: 0.78rem; color: var(--muted); }
.journal-item .body { padding: 0 16px 16px; }
.journal-item .body :first-child { margin-top: 0; }
.journal-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.journal-chip-row a {
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 999px;
}

/* ---- Image library ---- */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.image-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    text-align: center;
}
.image-tile img { width: 100%; height: 80px; object-fit: contain; margin-bottom: 6px; }

/* ---- Tables (admin) ---- */
table.data { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
table.data th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 1.3rem; text-align: center; margin-top: 0; }
.auth-card .brand-mark { text-align: center; margin-bottom: 18px; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 560px) {
    .topbar-inner { flex-direction: column; align-items: flex-start; }
}
