/* --- General Styles --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 0; /* Remove default margin */
    padding: 20px;
    background-color: #f8f9fa; /* Lighter background */
    color: #212529; /* Bootstrap default text color */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Typography --- */
h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #343a40; /* Darker heading */
    font-weight: 300; /* Lighter heading */
}

/* --- App Intro Text --- */
.app-intro-text {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.05rem;
    color: #5a5a5a;
    font-style: italic;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* --- BDA CTA Header --- */
.bda-cta-header {
    text-align: center;
    padding: 10px 0;
    margin-bottom: 15px;
}

.bda-cta-button {
    background-color: #007bff; /* Blue */
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.bda-cta-button:hover {
    background-color: #0056b3; /* Darker Blue */
}

h2, h3 {
    margin-top: 0;
    color: #495057; /* Slightly lighter subheadings */
    border-bottom: 1px solid #dee2e6; /* Lighter border */
    padding-bottom: 8px;
    margin-bottom: 16px;
    font-weight: 400;
}

/* Enhance readability for explanation text */
#parable-explanation p {
    line-height: 1.7; /* Slightly more spacing for longer text */
    font-size: 1.05rem; /* Slightly larger font */
    margin-bottom: 0;
}
/* Ensure good readability for main parable text too */
#parable-text p {
     line-height: 1.7;
     font-size: 1.05rem;
     margin-bottom: 0;
}


/* --- Layout --- */
.container {
    display: flex;
    flex-wrap: wrap;
    gap: 25px; /* Slightly larger gap */
    flex-grow: 1; /* Allow container to fill space */
}

/* Left column: Search and List */
#parable-list-section {
    flex: 1 1 250px; /* Flex-grow, flex-shrink, flex-basis */
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Gap between search and list */
}

/* Right column: Main display area */
#parable-display {
    flex: 3 1 400px; /* Flex-grow, flex-shrink, flex-basis */
    min-width: 300px; /* Keep a reasonable minimum */
    background-color: #ffffff;
    padding: 25px;
    border: 1px solid #dee2e6; /* Standard border color */
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* --- Components --- */

/* Search input styling */
#search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
#search-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Parable selection list container */
#parable-list {
    flex-grow: 1;
    background-color: #ffffff;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow-y: auto;
    max-height: 65vh; /* Adjust max height as needed */
}
#parable-list p { /* Styling for 'loading' or 'no matches' text */
    padding: 10px;
    color: #6c757d; /* Muted text color */
    text-align: center;
}


/* Styling for buttons inside the parable list */
#parable-list button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    text-align: left;
    background-color: #f8f9fa; /* Match body background */
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #495057;
    transition: background-color 0.2s, border-color 0.2s;
}

#parable-list button:hover {
    background-color: #e9ecef; /* Slightly darker hover */
    border-color: #adb5bd;
}

/* Styling for the selected button */
#parable-list button.selected {
    background-color: #007bff; /* Primary color */
    color: #ffffff;
    border-color: #007bff;
    font-weight: 500;
}

/* Styling for the parable text area */
#parable-text {
    margin-bottom: 25px;
}

/* Styling for the explanation area */
#parable-explanation {
    margin-bottom: 25px;
    background-color: #eef7ff; /* Lighter blue */
    border: 1px solid #b8d6e6; /* Matching border */
    border-radius: 4px;
    padding: 15px 20px;
    font-style: italic;
    color: #31506a; /* Darker blue text */
}


/* Styling for reference area */
#parable-reference {
    margin-top: 20px;
    font-size: 0.9em;
    color: #6c757d; /* Muted color */
    border-top: 1px solid #e9ecef; /* Lighter top border */
    padding-top: 15px;
}
#parable-reference p.ref-label { /* Styling for the 'References:' label */
    margin: 0 0 5px 0;
    font-weight: 500;
    color: #495057;
}
/* Styling for clickable reference elements (using buttons styled as links) */
#parable-reference button.ref-link {
    background: none;
    border: none;
    color: #007bff; /* Link color */
    text-decoration: underline;
    cursor: pointer;
    padding: 2px 0;
    margin-right: 8px; /* Space between references */
    margin-bottom: 3px; /* Allow wrapping */
    font-size: 0.9em; /* Inherit size or adjust */
    display: inline; /* Display references inline */
    line-height: 1.5; /* Adjust line height for wrapped links */
}
#parable-reference button.ref-link:hover {
    color: #0056b3; /* Darker link color on hover */
}
/* Style for the reference link corresponding to the currently displayed text */
#parable-reference button.ref-link.active {
    font-weight: bold;
    text-decoration: none;
    color: #212529; /* Black/dark text */
    cursor: default;
}

/* Optional section for themes/cross-refs */
#additional-content {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    font-size: 0.9em;
}


/* Styling for message/error display area */
#message-display {
    margin-top: 20px;
    font-weight: 500;
    padding: 12px 15px;
    border-radius: 4px;
    border: 1px solid transparent; /* Base border */
    display: none; /* Hidden by default */
}
#message-display.error { /* Style for errors */
    color: #721c24;  /* Dark red text */
    background-color: #f8d7da; /* Light red background */
    border-color: #f5c6cb; /* Red border */
}
#message-display.loading { /* Style for loading */
     color: #0c5460; /* Dark cyan text */
     background-color: #d1ecf1; /* Light cyan background */
     border-color: #bee5eb; /* Cyan border */
}
#message-display.info { /* Style for info/success (if needed) */
     color: #0f5132; /* Dark green text */
     background-color: #d1e7dd; /* Light green background */
     border-color: #badbcc; /* Green border */
}

/* --- Additional Content CTA --- */
#additional-content {
    padding: 20px;
    margin-top: 25px;
    background-color: #e9ecef; /* Slightly different from body */
    border: 1px solid #dee2e6;
    border-radius: 5px;
    text-align: center;
}

#additional-content h3 {
    margin-bottom: 10px;
    /* Assuming h3 styles are globally defined and sufficient, otherwise add more */
}

#additional-content p {
    margin-bottom: 15px;
    font-size: 1rem; /* Explicitly set or adjust as needed */
    line-height: 1.6;
}

.bda-contextual-cta-button {
    display: inline-block;
    background-color: #28a745; /* Green */
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-size: 0.9rem; /* Slightly smaller than main CTA */
}

.bda-contextual-cta-button:hover {
    background-color: #218838; /* Darker Green */
}

/* --- CTA Offline State --- */
.cta-offline {
  opacity: 0.6;
  cursor: not-allowed !important; /* Ensure cursor changes */
  pointer-events: none; /* Disables click, hover, etc. */
}

.cta-offline:hover {
  /* Optional: Explicitly override hover styles if any exist for the original buttons */
  background-color: initial; /* Or specific offline background if different */
}

/* --- Responsive rules --- */
@media (max-width: 768px) {
    /* Adjust gaps and padding for smaller tablets */
    .container {
        gap: 20px;
    }
    #parable-display {
        padding: 20px;
    }
     #parable-explanation p, #parable-text p {
        font-size: 1rem; /* Slightly smaller on smaller screens */
     }
}

@media (max-width: 600px) {
    body {
        padding: 15px;
    }
    .container {
        flex-direction: column; /* Stack columns on small screens */
        gap: 15px;
    }
    #parable-list-section {
         flex-basis: auto; /* Reset basis */
         min-width: auto;
    }
    #parable-list {
        max-height: 45vh; /* Adjust height for stacked layout */
    }
    #parable-display {
        flex-basis: auto; /* Reset basis */
         min-width: auto;
         padding: 20px;
    }
    h1 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
     #parable-explanation p, #parable-text p {
        font-size: 0.95rem; /* Slightly smaller on mobile */
     }
     #parable-reference button.ref-link {
        margin-right: 5px; /* Reduce spacing on mobile */
     }
}

/* Visually hidden class */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}