/* static/css/style.css - Updated for Reduced Admin Tile Height */

/* --- Added Google Font --- */
/* Assuming you want to keep the Roboto font based on prior interaction,
   if not, you can remove this @import and the font-family rule on body. */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* --- Added: Set html and body to full height and use flexbox for layout --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent default page scroll */
}

body {
    font-family: 'Roboto', sans-serif; /* Using Roboto or your preferred font */
    background-color: #f4f4f4; /* Your original background color */
    color: #333; /* Your original text color */
    line-height: 1.6; /* Improved readability */
    display: flex; /* Enable flexbox */
    flex-direction: column; /* Stack children (header, main, footer) vertically */
}


/* --- Modified: main uses flex-grow to fill space, display flex for internal layout --- */
main {
    display: flex;
    padding: 1rem; /* Your original padding */
    flex-grow: 1; /* Allow main to take up remaining vertical space in body */
    gap: 1rem; /* Keep your original gap */
    overflow: hidden; /* Prevent main's content from causing body scroll */
}
/* --- End Modified --- */


/* --- End Added --- */


header {
    background-color: #E4DCF8; /* Your original header background */
    color: black;
    padding: 0.2rem 0; /* Your original padding */
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Your original shadow */
    flex-shrink: 0; /* Prevent header from shrinking in flex layout */
}

header h1 {
    margin: 0;
    font-size: 1.5rem; /* Your original font size */
}

.banner {
    background-color: #E4DCF8; /* Your original banner background */
    color: #004d40; /* Your original banner text color */
    padding: 0.4rem 0.7rem; /* Your original padding */
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 0; /* Changed margin to 0 for flex layout */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    flex-shrink: 0; /* Prevent banner from shrinking */
}

.banner p {
    margin: 0;
}

.directory-container {
    width: 250px; /* Or your preferred width */
    background-color: #FAF8FD; /* Your original background */
    flex-shrink: 0; /* Prevent shrinking */
    padding: 0.3rem; /* Your original padding */
    overflow-y: auto; /* Keep scrollbar */
    height: 0;      /* For flex layout */
    min-height: 100%; /* For flex layout */
    box-sizing: border-box;
}

/* --- Modified: content-area for Public View --- */

.content-area {
    flex-grow: 1;  /* Allow content to grow */
    background-color: #FAF8FD; /* Your original background */
    overflow-y: auto; /* Keep scrollbar */
    padding: 0.3rem; /* Your original padding */
    height: 0;      /* For flex layout */
    min-height: 100%; /* For flex layout */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Tree view styling */
.tree, .tree ul {
    list-style: none;
    padding-left: 1rem; /* Reduced padding */
    margin: 0;
}

.tree li {
    margin: 5px 0; /* Reduced vertical margin for less line spacing */
    cursor: pointer;
    user-select: none;
    padding: 3px 0; /* Reduced padding for hover area */
    transition: background-color 0.2s ease;
    border-radius: 4px;
}

.tree li:hover {
    background-color: #F0F0F0;
}

/* --- Added style for active category --- */
.tree li.active {
     background-color: #E0E0E0;
     font-weight: 500;
}

.tree li.active > .category-name,
.tree li.active > .listing-category-name {
    color: #4A90E2;
}
/* --- End Added style for active category --- */


.tree li::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.1s ease-in-out;
    font-size: 0.8em;
    color: #666;
}

.tree li.open::before {
    content: '\25BC';
    transform: rotate(0deg);
}

/* --- Modified: Reduced font size for category names --- */
.tree li .category-name {
    font-weight: 700;
    font-size: 0.95rem; /* Reduced font size */
    color: #333;
    transition: color 0.2s ease;
}
/* --- Modified: Reduced font size for listing category names --- */
.tree li .listing-category-name {
     font-weight: 400;
     font-size: 0.9rem; /* Reduced font size */
     color: #0D47A1;
     transition: color 0.2s ease;
}
/* --- End Modified --- */


.tree li ul {
    display: none;
    padding-left: 1.2rem; /* Reduced padding */
}

.tree li.open > ul {
    display: block;
}


/* Listing List Styles */
#listing-list-container h2 {
    color: #333;
    /* --- Modified: Reduced margin --- */
    margin-top: 0;
    margin-bottom: 1.2rem; /* Reduced from 1.5rem */
    /* --- End Modified --- */
    font-size: 1.8rem;
}

.search-bar {
    /* --- Modified: Reduced margin --- */
    margin-bottom: 1.2rem; /* Reduced from 1.5rem */
    /* --- End Modified --- */
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-bar input[type="text"] {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-bar input[type="text"]:focus {
     border-color: #4A90E2;
     box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
     outline: none;
}


.search-bar button {
    padding: 10px 15px;
    cursor: pointer;
    border: 1px solid #ccc;
    background-color: #E0E0E0;
    border-radius: 4px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    font-size: 1rem;
}

.search-bar button:hover {
    background-color: #D5D5D5;
    border-color: #bbb;
}


#listing-actions {
    /* --- Modified: Reduced margin --- */
    margin-bottom: 1.2rem; /* Reduced from 1.5rem */
    /* --- End Modified --- */
    text-align: right;
}

#listing-actions button {
    padding: 12px 24px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

#listing-actions button:hover {
    background-color: #45a049;
}


.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    /* --- Modified: Reduced gap --- */
    gap: 1rem; /* Reduced from 1.5rem */
    /* --- End Modified --- */
}

.listing-card {
    border: 1px solid #E0E0E0;
    /* --- Modified: Reduced padding --- */
    padding: 1rem; /* Reduced from 1.2rem */
    /* --- End Modified --- */
    border-radius: 8px;
    background-color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.listing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: #D5D5D5;
}

.listing-card h3 {
    margin-top: 0;
    color: #0D47A1;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.listing-card .listing-card-category {
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 0.6rem;
    display: block;
}

.listing-card p {
    margin-bottom: 0.5rem;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

.listing-card .listing-card-description {
     display: -webkit-box;
     -webkit-line-clamp: 3;
     -webkit-box-orient: vertical;
     overflow: hidden;
     text-overflow: ellipsis;
}


/* Pagination Controls */
#pagination-controls {
    /* --- Modified: Reduced margin --- */
    margin-top: 1.5rem; /* Reduced from 2rem */
    /* --- End Modified --- */
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#pagination-controls button {
    margin: 0;
    padding: 10px 15px;
    cursor: pointer;
    border: 1px solid #ccc;
    background-color: #E0E0E0;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    font-size: 1rem;
}

#pagination-controls button:hover:not(:disabled) {
    background-color: #D5D5D5;
}

#pagination-controls button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#pagination-controls span {
    font-size: 1.1rem;
    font-weight: 500;
    color: #555;
}


/* Style for single listing details and preview */
#single-listing-details,
#add-listing-form-container,
#listing-preview-container {
    /* --- Modified: Reduced padding and margin --- */
    padding-top: 0.8rem; /* Reduced from 1rem */
    border-top: 1px solid #eee;
    margin-top: 0.8rem; /* Reduced from 1rem */
    /* --- End Modified --- */
}


#single-listing-details h2,
#add-listing-form-container h3,
#listing-preview-container h3 {
    color: #333;
    margin-top: 0;
    /* --- Modified: Reduced margin --- */
    margin-bottom: 0.8rem; /* Reduced from 1rem */
    /* --- End Modified --- */
     font-size: 1.5rem;
}

.category-display {
    font-size: 1rem;
    font-weight: 500;
    color: #555;
     /* --- Modified: Reduced margin --- */
    margin-bottom: 0.8rem; /* Reduced from 1rem */
    /* --- End Modified --- */
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}


/* --- Adjust text size and line spacing for details and preview content --- */
#listing-details-content p,
#listing-preview-content p {
    /* --- Modified: Reduced margin --- */
    margin-bottom: 0.5rem; /* Reduced from 0.6rem */
    /* --- End Modified --- */
    line-height: 1.5;
    font-size: 1rem;
    color: #555;
}
/* Ensure strong tags within paragraphs don't add extra space */
#listing-details-content p strong,
#listing-preview-content p strong {
    margin-right: 8px;
    color: #333;
}

#single-listing-details a,
#listing-preview-container a {
    color: #004d40;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

#single-listing-details a:hover,
#listing-preview-content a:hover {
    text-decoration: underline;
    color: #00796B;
}


/* Style for the Add Listing Form */
#add-listing-form-container {
     /* Already included in the block above for consistent container styling */
}

.form-group {
    /* --- Modified: Reduced margin --- */
    margin-bottom: 12px; /* Reduced from 15px */
    /* --- End Modified --- */
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
     width: calc(100% - 20px);
     padding: 10px;
     border: 1px solid #ccc;
     border-radius: 4px;
     font-size: 1rem;
     box-sizing: border-box;
     transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="url"]:focus,
.form-group input[type="date"]:focus,
.form-group textarea:focus,
.form-group select:focus {
     border-color: #4A90E2;
     box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
     outline: none;
}


.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.field-error-message {
    color: #d32f2f;
    font-size: 0.85rem;
    margin-top: 4px;
    min-height: 1em;
    display: none;
}


.disabled-input {
    background-color: #E0E0E0;
    color: #777;
    cursor: not-allowed;
}


#add-listing-form button[type="submit"] {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    margin-top: 20px;
}

#add-listing-form button[type="submit"]:hover {
    background-color: #45a049;
}

/* Preview Actions Buttons */
.preview-actions {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.preview-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease, opacity 0.2s ease;
}

#confirm-submission {
    background-color: #28a745;
    color: white;
}

#confirm-submission:hover:not(:disabled) {
    background-color: #218838;
}

#modify-listing {
    background-color: #F5A623;
    color: #333;
}

#modify-listing:hover:not(:disabled) {
     background-color: #E0951C;
}

#cancel-submission {
    background-color: #D32F2F;
    color: white;
}

#cancel-submission:hover:not(:disabled) {
    background-color: #C0392B;
}

.preview-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* Status Message Styles (for form and preview) */
#form-status-message,
#preview-status-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    text-align: center;
    display: none;
    font-size: 0.95rem;
    line-height: 1.4;
}

#form-status-message.error,
#preview-status-message.error {
    background-color: #FFEBEE;
    color: #C0392B;
    border: 1px solid #C0392B;
}

#form-status-message.info,
#preview-status-message.info {
    background-color: #E3F2FD;
    color: #0D47A1;
    border: 1px solid #0D47A1;
}

#form-status-message.success,
#preview-status-message.success {
    background-color: #E8F5E9;
    color: #229954;
    border: 1px solid #229954;
}

/* Back to list buttons styling */
#back-to-list,
#back-to-list-from-form {
    margin-bottom: 1rem;
    padding: 8px 8px;
    cursor: pointer;
    border: 1px solid #ccc;
    background-color: #E0E0E0;
    border-radius: 4px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    font-size: 0.9rem;
}

#back-to-list:hover,
#back-to-list-from-form:hover {
     background-color: #D5D5D5;
     border-color: #bbb;
}

/* --- Modified: Footer flex-shrink 0 and margin top 0 --- */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 0.6rem 0;
    margin-top: 0;
    font-size: 0.9rem;
    flex-shrink: 0;
}
/* --- End Modified --- */


footer p {
    margin: 0;
}

.hidden {
    display: none;
}

.loading-message, .empty-results-message {
    text-align: center;
    color: #888;
    padding: 30px;
    font-style: italic;
    font-size: 1.1rem;
}

/* Added styles for checkbox groups */
.form-group-checkbox {
     display: flex;
     align-items: center;
     gap: 8px;
     margin-bottom: 15px;
}

.form-group-checkbox label {
     margin-bottom: 0;
     font-weight: normal;
}

/* Added styles for multiselect keywords checkboxes */
.keywords-checkbox-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Space between keyword items */
    margin-top: 5px; /* Space above the container */
    padding: 10px;
    border: 1px solid #eee; /* Optional: Add a border */
    border-radius: 4px;
    background-color: #f9f9f9; /* Optional: Add a light background */
}

.keyword-item {
    display: flex;
    align-items: center;
    gap: 5px; /* Space between checkbox and label */
}

.keyword-item input[type="checkbox"] {
    cursor: pointer;
}

.keyword-item label {
    margin-bottom: 0; /* Remove default label margin */
    font-weight: normal; /* Make label text normal weight */
    color: #555; /* Adjust label color */
    cursor: pointer; /* Indicate clickable area */
}
/* End of added styles for checkboxes */


/* --- Admin Login Page Styles (Kept from your original file) --- */
.admin-login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.admin-login-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.admin-login-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.admin-login-container input[type="text"],
.admin-login-container input[type="password"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.admin-login-container button {
    width: 100%;
    padding: 10px;
    background-color: #5a67d8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.admin-login-container button:hover {
    background-color: #4854b2;
}

.admin-login-container .flash-messages {
    list-style: none;
    padding: 0;
    margin-bottom: 15px;
}

.admin-login-container .flash-messages li {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    text-align: center;
}

.admin-login-container .flash-messages li.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.admin-login-container .flash-messages li.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.admin-login-container .flash-messages li.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* --- End Admin Login Page Styles --- */


/* --- Admin Dashboard Page Styles (Targeting .admin-container and #admin-listings-list) --- */
.admin-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    /* --- Added for Scrolling and Layout --- */
    display: flex; /* Enable flexbox for content inside */
    flex-direction: column; /* Stack children vertically */
    /* The `max-height` combined with `overflow-y: auto` is key for scrolling.
       Adjust the value as needed or remove if you set height on its parent. */
    max-height: calc(100vh - 150px); /* Example: Max height relative to viewport height minus header/footer space */
    overflow-y: auto; /* Enable vertical scrolling within this container */
    gap: 20px; /* Space between main sections within admin-container */
    /* --- End Added --- */
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    /* --- Added flex-shrink to prevent it from shrinking when content grows --- */
    flex-shrink: 0;
}

.admin-header h2 {
    margin: 0;
    color: #333;
}

.admin-header .user-info {
    font-size: 0.9rem;
    color: #555;
}

.admin-header .user-info a {
    margin-left: 10px;
    color: #5a67d8;
    text-decoration: none;
}

.admin-header .user-info a:hover {
    text-decoration: underline;
}

.flash-messages {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
    /* --- Added flex-shrink --- */
    flex-shrink: 0;
}

.flash-messages li {
     padding: 12px;
     margin-bottom: 10px;
     border-radius: 5px;
     font-size: 0.95rem;
     border: 1px solid transparent;
}

.flash-messages li.success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.flash-messages li.error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.flash-messages li.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}


.filter-controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    /* --- Added flex-shrink --- */
    flex-shrink: 0;
}

.filter-controls label {
    font-weight: bold;
    color: #555;
}

.filter-controls select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

/* --- Added Grid layout for the admin listings list --- */
#admin-listings-list {
    margin-top: 0; /* Remove margin-top here since gap is on the parent */
    flex-grow: 1; /* Allow the list area to take available space */
    display: grid; /* Enable CSS Grid */
    /* Create responsive columns: repeat automatically, fill with columns
       that have a min-width of 250px and a max-width of 1 fraction of available space */
    /*grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));*/
    grid-template-columns: repeat(4, 1fr);
    /* Space between the grid items (the listing tiles) */
    /*gap: 15px;*/
    row-gap: 15px; /* Explicitly set row gap */
    column-gap: 15px; /* Explicitly set column gap */
    
    padding-bottom: 20px; /* Add some padding at the bottom of the grid */
}
/* --- End Added Grid layout --- */


.admin-listing-item {
    border: 1px solid #edd;
    padding: 15px;
    /* --- Removed margin-bottom, replaced by gap on the grid container --- */
    margin-bottom: 0;
    border-radius: 8px;
    background-color: #fff;
    /* Keep flexbox for internal layout of details and actions */
    display: flex;
    flex-direction: column; /* Stack details and actions vertically in the grid item */
    justify-content: space-between; /* Distribute space vertically */
    gap: 5px; /* Space between details and actions */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    word-break: break-word; /* Helps break long words if they cause overflow */
    /* --- Ensure items have a minimum height and flex to fill grid cell if needed --- */
    /* Adjusted min-height to 70% of previous 150px (approx 105px) */
    min-height: 105px; /* Set a minimum height for tiles */
    height: 75%; /* Allow items to stretch within their grid cell */
}

.admin-listing-details {
    flex-grow: 1; /* Allow details to take up available space */
    min-width: 0; /* Important for flex items in some browsers to prevent overflow */
}

.admin-listing-details h3 {
    margin-top: 0;
    margin-bottom: 5px;
    color: #0D47A1;
    font-size: 1.1rem;
}

.admin-listing-details p {
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #555;
}

.admin-listing-details .listing-card-category {
     font-size: 0.85rem;
     font-weight: 500;
     color: #777;
     margin-bottom: 8px;
     display: block;
}


.admin-listing-actions {
    flex-shrink: 0; /* Prevent action buttons from shrinking */
    display: flex;
    flex-direction: column; /* Stack action buttons vertically */
    gap: 8px;
    align-items: flex-end; /* Align buttons to the right */
    margin-top: auto; /* Push actions to the bottom of the flex container */
}


.admin-listing-actions button {
    padding: 8px 12px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    min-width: 100px;
    text-align: center;
}

.admin-listing-actions .btn-view {
    background-color: #5a67d8;
    color: white;
}

.admin-listing-actions .btn-view:hover {
    background-color: #4854b2;
}

.admin-listing-item .status-pending { color: #ff9800; }
.admin-listing-item .status-under-review { color: #2196f3; }
.admin-listing-item .status-approved { color: #4caf50; }
.admin-listing-item .status-disabled { color: #757575; }
.admin-listing-item .status-rejected { color: #f44336; }


/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    padding-top: 60px;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 8px;
    position: relative;
}

.modal-content h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.modal-body {
    /* Added overflow-y for scrolling within the modal body if details are long */
    max-height: 400px; /* Adjust as needed */
    overflow-y: auto;
    padding-right: 15px; /* Add some space for the scrollbar */
}


.modal-body p {
    margin-bottom: 10px;
    line-height: 1.5;
    color: #555;
}

.modal-body p strong {
    margin-right: 8px;
    color: #333;
}

.modal-body h4 {
     margin-top: 20px;
     margin-bottom: 10px;
     color: #333;
     border-bottom: 1px dashed #eee;
     padding-bottom: 5px;
     font-size: 1.1rem;
}

.modal-actions {
     margin-top: 20px;
     border-top: 1px solid #eee;
     padding-top: 15px;
     display: flex;
     align-items: center;
     gap: 15px;
     flex-wrap: wrap; /* Allow actions to wrap */
}

.modal-actions label {
     font-weight: bold;
     color: #555;
     flex-shrink: 0;
}

.modal-actions textarea {
     flex-grow: 1;
     padding: 10px;
     border: 1px solid #ccc;
     border-radius: 4px;
     font-size: 1rem;
     min-height: 60px;
     resize: vertical;
     /* Adjust width for flex layout */
     width: auto; /* Override default width */
}

.modal-action-buttons {
     display: flex;
     gap: 10px;
     flex-wrap: wrap;
     flex-shrink: 0;
     align-items: center;
     justify-content: flex-end;
}

.modal-action-buttons button {
    padding: 10px 15px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.modal-action-buttons button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


.modal-action-buttons .btn-approve { background-color: #4caf50; color: white; }
.modal-action-buttons .btn-approve:hover:not(:disabled) { background-color: #45a049; }
.modal-action-buttons .btn-reject { background-color: #f44336; color: white; }
.modal-action-buttons .btn-reject:hover:not(:disabled) { background-color: #d32f2f; }
.modal-action-buttons .btn-disable { background-color: #ff9800; color: white; }
.modal-action-buttons .btn-disable:hover:not(:disabled) { background-color: #f57c00; }
.modal-action-buttons .btn-delete { background-color: #e53935; color: white; }
.modal-action-buttons .btn-delete:hover:not(:disabled) { background-color: #c62828; }
.modal-action-buttons .btn-secondary { background-color: #9e9e9e; color: white; }
.modal-action-buttons .btn-secondary:hover:not(:disabled) { background-color: #757575; }


.close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
}


.status-pending { color: #ff9800; font-weight: bold; }
.status-under-review { color: #2196f3; font-weight: bold; }
.status-approved { color: #4caf50; font-weight: bold; }
.status-disabled { color: #757575; font-weight: bold; }
.status-rejected { color: #f44336; font-weight: bold; }


/* Responsive adjustments for Admin Dashboard */
@media (max-width: 768px) {
    .admin-container {
        padding: 10px;
        /* Adjust max-height for smaller screens */
        max-height: calc(100vh - 120px); /* Example adjustment */
        gap: 15px;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-header .user-info {
        margin-top: 10px;
    }

    .filter-controls {
         flex-direction: column;
         align-items: stretch;
         gap: 10px;
    }

     .filter-controls label,
     .filter-controls select {
         width: 100%;
         box-sizing: border-box;
     }


     .admin-listing-item {
         /* In mobile view, let's switch admin listing items back to stacking vertically */
         flex-direction: column;
         align-items: stretch;
         gap: 10px;
         /* Remove min-height for mobile to allow items to shrink */
         min-height: 105px;
         height: 105px;
     }

     .admin-listing-actions {
         flex-direction: row; /* Keep buttons in a row on mobile */
         flex-wrap: wrap;
         justify-content: flex-start;
         gap: 8px;
         margin-top: 0; /* Remove auto margin on mobile */
     }

      .admin-listing-actions button {
          min-width: auto;
          flex-grow: 1; /* Allow buttons to grow */
      }


     .modal-content {
         width: 95%;
         margin: 20px auto;
         padding: 15px;
     }

      .modal-body {
         max-height: 300px; /* Adjust modal body height for smaller screens */
      }

     .modal-actions {
         flex-direction: column;
         gap: 8px;
     }

      .modal-actions textarea {
         width: 100%; /* Ensure textarea takes full width in column layout */
         box-sizing: border-box;
      }

      .modal-action-buttons {
          flex-direction: column; /* Stack action buttons */
           gap: 8px;
           width: 100%; /* Ensure button container takes full width */
      }

      .modal-action-buttons button {
          width: 100%; /* Make buttons full width in column layout */
      }

      /* Adjust the grid for admin listings on small screens to show one column */
     #admin-listings-list {
         grid-template-columns: 1fr; /* One column on small screens */
         gap: 15px; /* Adjust gap for single column */
     }
}


/* Responsive adjustments for Public View */
@media (max-width: 768px) {
    main {
        flex-direction: column;
        padding: 0.5rem;
        gap: 1rem; /* Keep gap for column layout */
    }

    .directory-container, .content-area {
        width: 100%;
        margin: 0 0 0rem 0; /* Adjust margin for column layout */
        height: auto; /* Allow content to determine height */
        min-height: auto;
         max-height: 40vh; /* Optional: limit height to avoid pushing footer too far down */
         overflow-y: auto; /* Ensure they are scrollable on smaller screens */
    }

     /* Specific adjustment for admin-container on small screens */
     .admin-container {
         max-height: calc(100vh - 120px); /* Adjust max-height for admin on mobile */
         /* margin is handled by the media query above for .directory-container, .content-area */
          margin: 20px auto; /* Reapply margin auto for centering if needed */
     }

    .listing-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .listing-card {
        padding: 1.2rem;
        border-radius: 8px;
    }

    .listing-card h3 {
        font-size: 1.3rem;
    }

     .listing-card .listing-card-category {
         font-size: 0.9rem;
     }


    .listing-card p {
        font-size: 0.95rem;
    }

    #single-listing-details p,
    #listing-preview-content p {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 0.6rem;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="number"],
    .form-group input[type="url"],
    .form-group input[type="date"],
    .form-group textarea,
    .form-group select {
         font-size: 1rem;
         padding: 10px;
         width: calc(100% - 20px);
    }

     .preview-actions {
         flex-direction: column;
         gap: 10px;
     }

      .preview-actions button {
          width: 100%;
      }

     #pagination-controls {
         flex-wrap: wrap;
         gap: 10px;
     }

      #pagination-controls button {
          padding: 10px 15px;
      }

       #pagination-controls span {
           font-size: 1.1rem;
       }

}

/* --- End Admin Dashboard Page Styles --- */

/* New styles for the advertisement panel */

.advertisement-content {
    width: 200px; /* Or your preferred width */
    background-color: #FAF8FD; /* Your original background */
    padding: 0.3rem; /* Your original padding */
    flex-shrink: 0;
    overflow-y: auto;
    height: 0;
    min-height: 100%;
    box-sizing: border-box;
}

.advertisement-panel h3 {
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
}

.local-advertisement,
.google-advertisement {
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #eee;
    text-align: center;
}

.local-advertisement p,
.google-advertisement p {
    margin-bottom: 0;
}
/* Ensure the footer is always at the bottom if content is short */
body {
     /* Already set to flex column and height 100% */
}

main {
    /* Already set to flex-grow 1 and overflow hidden */
}

/* Public directory-container and content-area also need to handle their own overflow if main has overflow: hidden */
.directory-container, .content-area {
    overflow-y: auto;
    height: 0; /* Allow flex item to size */
    min-height: 100%; /* Take at least full height */
    box-sizing: border-box; /* Include padding in height */
}


/* Responsive adjustments for the entire layout */
@media (max-width: 768px) {
    main {
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .directory-container, .content-area {
        width: 100%;
        margin: 0 0 0.5rem 0; /* Adjust margin for column layout */
        height: auto; /* Allow content to determine height */
        min-height: auto;
        max-height: 40vh; /* Optional: limit height to avoid pushing footer too far down */
    }

     /* Specific adjustment for admin-container on small screens */
     .admin-container {
         max-height: calc(100vh - 120px); /* Adjust max-height for admin on mobile */
         /* margin is handled by the media query above for .directory-container, .content-area */
          margin: 20px auto; /* Reapply margin auto for centering if needed */
     }
}