/* =========================================================================
   Bains Group — shared UI design system
   One stylesheet for every app (dashboard, timesheet, weather, org chart).
   Build-free: plain CSS, no preprocessor. Edit a .php file and it's live.

   Per-app accent theming: add data-app="timesheet|weather|org" to <body>.
   The base (dashboard / Bains Group master brand) needs no attribute.
   App-specific components still live in each app's own <style> block.
   ========================================================================= */

/* ----- Design tokens ---------------------------------------------------- */
:root {
    /* Neutral surfaces & text (shared by every app) */
    --bg-top: #f6f9fd;
    --bg-bottom: #eef3f9;
    --surface: #ffffff;
    --surface-soft: #f4f8fc;
    --surface-alt: #eef4fa;
    --text: #0f1f33;
    --muted: #5f7186;
    --border: #d9e4ef;
    --border-strong: #c4d2e1;

    /* Brand accent (master = Bains Group navy; apps override below) */
    --primary: #1f4e79;
    --primary-strong: #163a5a;
    --primary-soft: rgba(31, 78, 121, 0.10);
    --primary-softer: rgba(31, 78, 121, 0.06);
    --accent: #0f766e;

    /* Background glow tints (match the accent) */
    --glow-a: rgba(31, 78, 121, 0.14);
    --glow-b: rgba(15, 118, 110, 0.10);

    /* Layered, softer shadows */
    --shadow-sm: 0 2px 8px rgba(15, 31, 51, 0.05);
    --shadow: 0 12px 30px rgba(15, 31, 51, 0.08);
    --shadow-lg: 0 22px 48px rgba(15, 31, 51, 0.12);
    --shadow-primary: 0 10px 24px rgba(31, 78, 121, 0.28);

    /* Radius + spacing scale */
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    --header-h: 72px;
}

/* Weather app accent (blue / amber) */
body[data-app="weather"] {
    --bg-top: #eef4fb;
    --bg-bottom: #e2eaf4;
    --surface-soft: #f4f8fd;
    --surface-alt: #eaf1fa;
    --text: #1c2a3a;
    --muted: #5c6b7d;
    --border: #d3deec;
    --border-strong: #bfceE0;
    --primary: #1f6feb;
    --primary-strong: #1550b3;
    --primary-soft: rgba(31, 111, 235, 0.12);
    --primary-softer: rgba(31, 111, 235, 0.06);
    --accent: #e08a1e;
    --glow-a: rgba(31, 111, 235, 0.12);
    --glow-b: rgba(224, 138, 30, 0.10);
    --shadow-primary: 0 10px 24px rgba(31, 111, 235, 0.26);
}

/* Organisation chart accent (green / bronze) */
body[data-app="org"] {
    --bg-top: #f4f9f4;
    --bg-bottom: #e8efe8;
    --surface-soft: #f5faf6;
    --surface-alt: #edf4ee;
    --text: #1f3027;
    --muted: #617266;
    --border: #d4e0d6;
    --border-strong: #bfd0c2;
    --primary: #2d6a4f;
    --primary-strong: #1f4b38;
    --primary-soft: rgba(45, 106, 79, 0.12);
    --primary-softer: rgba(45, 106, 79, 0.06);
    --accent: #9b6b3e;
    --glow-a: rgba(45, 106, 79, 0.14);
    --glow-b: rgba(155, 107, 62, 0.12);
    --shadow-primary: 0 10px 24px rgba(45, 106, 79, 0.26);
}

/* ----- Base ------------------------------------------------------------- */
* {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    padding-top: var(--header-h);
    color: var(--text);
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    background:
        radial-gradient(circle at 8% 0%, var(--glow-a), transparent 32%),
        radial-gradient(circle at 94% 1%, var(--glow-b), transparent 28%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
    background-attachment: fixed;
}

a {
    color: var(--primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--primary-strong);
}

input,
select,
textarea,
.form-control,
.form-select {
    font-weight: 600;
}

::selection {
    background: var(--primary-soft);
}

/* Consistent, accessible keyboard focus */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ----- Header / brand --------------------------------------------------- */
.app-header {
    height: var(--header-h);
    background: rgba(14, 30, 46, 0.94);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(9, 20, 33, 0.18);
    backdrop-filter: blur(10px) saturate(1.1);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.brand-mark {
    width: 2.15rem;
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: linear-gradient(145deg, #2f6ba0, #1a3f63);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 12px rgba(0, 0, 0, 0.25);
}

.brand-title {
    display: block;
    font-size: 0.97rem;
    line-height: 1.1;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.brand-subtitle {
    display: block;
    margin-top: 0.08rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.74);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.header-chip {
    padding: 0.3rem 0.72rem;
    border-radius: var(--radius-pill);
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

/* Header buttons (used by weather / org headers) */
.app-header .btn-light {
    font-weight: 600;
}

.app-header .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.35);
    font-weight: 600;
}

.app-header .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ----- Content shell ---------------------------------------------------- */
.content {
    padding: 1.4rem 0.8rem 2rem;
}

@media (min-width: 992px) {
    .content {
        padding: 1.85rem 1.2rem 2.5rem;
    }
}

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

.hero-panel {
    position: relative;
    overflow: hidden;
}

.hero-panel::after {
    content: "";
    position: absolute;
    top: -120px;
    right: -90px;
    width: 270px;
    height: 270px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-soft), transparent 72%);
    pointer-events: none;
}

/* ----- Typography helpers ---------------------------------------------- */
.page-title {
    margin: 0;
    font-size: clamp(1.55rem, 2.7vw, 2.05rem);
    font-weight: 700;
    letter-spacing: -0.015em;
}

.section-subtitle {
    color: var(--muted);
    font-size: 0.95rem;
}

.label-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: var(--radius-pill);
    padding: 0.32rem 0.72rem;
}

.meta-text {
    font-size: 0.85rem;
    color: var(--muted);
}

/* ----- Buttons ---------------------------------------------------------- */
.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
}

.btn-outline-secondary {
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: #fff;
    border-color: #465f77;
    background: #465f77;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

/* ----- Forms ------------------------------------------------------------ */
.form-control,
.form-select,
textarea {
    border-radius: var(--radius-sm);
    border-color: var(--border-strong);
    padding: 0.6rem 0.78rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem var(--primary-soft);
}

.form-label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
}

/* ----- Tables ----------------------------------------------------------- */
.table {
    color: var(--text);
}

.table thead {
    background: var(--surface-alt);
}

.table thead th {
    font-weight: 700;
    color: var(--text);
}

/* ----- Generic soft badge / chip --------------------------------------- */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--primary-soft);
    color: var(--primary-strong);
}

/* ----- Stat + module cards (dashboards) -------------------------------- */
.stat-card,
.module-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover,
.module-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--border-strong);
}

.stat-value {
    margin: 0.2rem 0;
    font-size: 1.62rem;
    font-weight: 700;
    color: var(--text);
}

.module-icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    background: var(--primary-soft);
}

/* ----- Footer ----------------------------------------------------------- */
.app-footer {
    margin-top: 1rem;
    padding: 1rem 0 1.5rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.footer-note {
    color: var(--muted);
    font-size: 0.8rem;
}

.footer-note a {
    color: var(--primary);
    text-decoration: none;
}

.footer-note a:hover {
    text-decoration: underline;
}

/* ----- Motion ----------------------------------------------------------- */
.fade-up {
    animation: fadeUp 0.5s ease both;
}

.delay-1 {
    animation-delay: 0.07s;
}

.delay-2 {
    animation-delay: 0.14s;
}

.delay-3 {
    animation-delay: 0.21s;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fade-up,
    .stat-card,
    .module-card,
    .btn {
        animation: none;
        transition: none;
    }
}
