* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    /* Prevent page-level horizontal scroll so inner widgets can own it */
    overflow-x: hidden;
}

/* Body as flex container that fills viewport width */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image: url(../Image/family.png);
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed; /* Keep background fixed while content scrolls */
    color: var(--text);
    font-family: Poppins, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    width: 100%; /* was max-content - breakage for horizontal scroll */
}

/* Ensure body/content width can overflow horizontally when needed for tree */
html, body { width: 100%; overflow-x: hidden; }

.tree-scroll { overflow-x: auto !important; overflow-y: hidden; width: 100%; max-width: 100%; text-align: center; -webkit-overflow-scrolling: touch; padding-bottom: 16px; margin-bottom: 28px; }

/* On small screens, ensure the horizontal scrollbar remains usable */
@media (max-width: 575.98px) {
  .tree-scroll { padding-bottom: 20px; }
  main[role="main"] { overflow-x: visible; }
}

/* Global headings */
h1 { color: orange; }

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--brand-grad, #343a40);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
}

/* Main content container */
.dash-main, main[role="main"], .container {
    flex: 1 0 auto;
    width: 100%;
    min-width: 0; /* allow children to manage their own overflow */
    overflow-x: visible;
}

.dash-brand { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.dash-logo { height: 76px; width: 76px; object-fit: contain; border-radius: 50%; display: block; }
.dash-navRight { display: flex; align-items: center; gap: 12px; }
.dash-user { font-size: 14px; opacity: .95; background: rgba(255,255,255,.15); padding: 6px 10px; border-radius: 999px; max-width: 260px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.dash-logout { border: 2px solid rgba(255,255,255,.85); background: transparent; color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; transition: background .15s ease, transform .04s ease; }
.dash-logout:hover { background: rgba(255,255,255,.10); }
.dash-logout:active { transform: translateY(1px); }

/* Main */
.dash-main { padding: 20px; max-width: 1100px; margin: 0 auto; width: 100%; }

/* Cards */
.dash-card { text-align: center; border-radius: 12px; padding: 24px; color: antiquewhite; }
.dash-h1 { margin: 6px 0 8px; font-size: 24px; }
.dash-p { margin: 0; color: wheat; }

/* Footer */
.footer {
    background: var(--brand-grad, #343a40);
    color: white;
    text-align: center;
    padding: 12px 16px;
    box-shadow: var(--shadow-nav, 0 -2px 5px rgba(0,0,0,0.3));
    flex-shrink: 0; /* prevent footer from shrinking */
}

/* Remove extra vertical padding added by bootstrap utility classes inside footer */
.footer .container { padding-top: 4px !important; padding-bottom: 4px !important; }

/* Visible custom horizontal scrollbar for dedicated scroll areas */
.tree-scroll { overflow-x: auto !important; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #888 rgba(0,0,0,.15); padding-bottom: 16px; margin-bottom: 28px; }
.tree-scroll::-webkit-scrollbar { height: 12px; }
.tree-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,.15); }
.tree-scroll::-webkit-scrollbar-thumb { background: #888; border-radius: 6px; }

/* Responsive */
@media (max-width: 640px) {
    .dash-user { max-width: 160px; }
}
