
/* Force single-line display for list items (the main row) */
.force-single-line {
    white-space: nowrap !important;
    overflow-x: auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important; /* Vertically center its direct children */
    height: 41px !important;        /* ABSOLUTELY FORCE THE ROW HEIGHT */
    min-height: 41px !important;
    max-height: 41px !important;    /* Add max-height for extra rigidity */
    box-sizing: border-box !important; /* Ensure padding/border don't add to height */
    padding: 0 !important;          /* Remove padding from the row itself, if p-2 is overriding */
}

/* Override Bootstrap's p-2 for .list-group-item specifically if it's adding unwanted padding */
.list-group-item.p-2 {
    padding: 0 !important;
}


/* --- CRITICAL ADJUSTMENT FOR BUTTONS CONTAINER (d-inline-flex flex-shrink-0) --- */
/* Using display: contents makes the container itself invisible to the layout,
   making its children direct flex items of the `.force-single-line` parent.
   This bypasses the user-agent's `display: block` on the container. */
.force-single-line .d-inline-flex.flex-shrink-0 {
    display: contents !important; /* THIS IS THE KEY CHANGE FOR THE CONTAINER */
    /* Note: When display: contents is used, properties like height, width, padding, margin
       on this element itself generally won't apply to its visual layout.
       Its children will inherit from its parent (.force-single-line). */
}

/* --- AGGRESSIVE STYLING FOR FORMS INSIDE BUTTON WRAPPER --- */
/* Since the button wrapper is now `display: contents`, the forms become direct children
   of `.force-single-line`. We need to make them behave as flex items. */
.force-single-line form {
    display: flex !important;        /* Make forms themselves flex containers */
    align-items: center !important;  /* Vertically center content inside the form */
    height: 41px !important;         /* Force form height to match row height */
    margin: 0 !important;            /* Remove any default form margins */
    padding: 0 !important;           /* Remove any default form paddings */
    box-sizing: border-box !important;
    /* Ensure the forms also don't shrink or grow too much */
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

/* --- AGGRESSIVE STYLING FOR BUTTONS INSIDE FORMS --- */
.force-single-line form button.btn {
    display: flex !important;         /* Make the button itself a flex container */
    align-items: center !important;   /* Vertically center text inside the button */
    justify-content: center !important; /* Horizontally center text inside the button */
    margin: 0 !important;             /* Remove any button margins */
    padding: 4px 8px !important;      /* Re-apply Bootstrap btn-sm padding */
    height: 100% !important;          /* Make button take 100% height of its parent (form) */
    line-height: normal !important;   /* Reset line-height to normal */
    vertical-align: middle !important; /* Fallback for older browsers */
    box-sizing: border-box !important;
}


/* --- CRITICAL ADJUSTMENT FOR TEXT DETAILS CONTAINER --- */
/* Target the celebrity details text div (overflow-hidden text-truncate) */
.force-single-line .overflow-hidden.text-truncate {
    display: flex !important;       /* Force it to be a flex container */
    align-items: center !important; /* Force its content to be centered vertically */
    height: 41px !important;        /* Force its height to match the parent row's height */
    flex-grow: 1 !important;        /* Allow it to grow to fill space */
    flex-shrink: 0 !important;      /* Prevent it from shrinking */
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 0 !important;          /* Reset padding */
    margin: 0 !important;           /* Reset margin */
    box-sizing: border-box !important; /* Ensure padding doesn't add to height */
}

/* Target the actual text and badge inside the text container for vertical-align */
.force-single-line .overflow-hidden.text-truncate strong,
.force-single-line .overflow-hidden.text-truncate .badge {
    vertical-align: middle !important; /* Force inline elements to align middle */
    margin: 0 !important;
    padding: 0 !important;
}

/* Your existing general styling (copy from your current base.html) */
nav a { margin-right: 15px; text-decoration: none; color: blue; }
.alert { padding: 10px; margin-bottom: 10px; border-radius: 5px; }
.alert-info { background-color: #d1ecf1; border-color: #bee5eb; color: #0c5460; }
.alert-success { background-color: #d4edda; border-color: #c3e6cb; color: #155724; }
.alert-danger { background-color: #f8d7da; border-color: #f5c6cb; color: #721c24; }
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}
header {
    background-color: #333;
    color: white;
    padding: 1em 0;
    text-align: center;
}
nav a {
    color: white; /* Override for nav links in header */
    margin: 0 15px;
    text-decoration: none;
}
main {
    padding: 20px;
    max-width: 800px;
    margin: 20px auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
h1, h2 {
    color: #333;
}
/* This general form rule might be a culprit if it applies to inner forms */
/* The more specific rules above for `form` inside `.force-single-line` should override it */
/* If this global form rule is causing problems for other forms on the site, you might need to adjust it or apply a more specific selector. */
/* For now, leaving it as is, trusting our !important specificity. */

input[type="text"],
input[type="password"],
input[type="submit"],
input[type="date"] {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    width: calc(100% - 22px);
}
input[type="submit"] {
    background-color: #007bff;
    color: white;
    cursor: pointer;
    width: auto;
    padding: 10px 20px;
}
input[type="submit"]:hover {
    background-color: #0056b3;
}
.flashes {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}
.flashes li {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}
.flashes .success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.flashes .danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.flashes .info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}
footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    background-color: #333;
    color: white;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background-color: #333;
    color: white;
    padding: 1em 0;
    text-align: center;
}

nav a {
    color: white;
    margin: 0 15px;
    text-decoration: none;
}

main {
    padding: 20px;
    max-width: 800px;
    margin: 20px auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1, h2 {
    color: #333;
}

form {
    margin-top: 20px;
}

input[type="text"],
input[type="password"],
input[type="submit"] {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    width: calc(100% - 22px); /* Account for padding/border */
}

input[type="submit"] {
    background-color: #007bff;
    color: white;
    cursor: pointer;
    width: auto;
    padding: 10px 20px;
}

input[type="submit"]:hover {
    background-color: #0056b3;
}

.flashes {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.flashes li {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.flashes .success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flashes .danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flashes .info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    background-color: #333;
    color: white;
}

.celebrity-died-row {
    background-color: #ffe0e0; /* A very light red, adjust as desired */
}