/*
 * Frontend CSS for the My Name Directory plugin.
 * Provides basic styling for the directory list and single name views.
 */

/* --- General Styles --- */
.namedirectory-wrapper,
.namedirectory-random-wrapper,
.namedirectory-single-wrapper {
    margin: 20px 0; /* Add some space above and below the directory */
    padding: 20px;
    background-color: #ffffff; /* White background */
    border: 1px solid #e0e0e0; /* Light grey border */
    border-radius: 8px; /* Rounded corners */
    font-family: 'Inter', sans-serif; /* Use Inter font */
    color: #333; /* Dark grey text */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* Subtle shadow */
}

.namedirectory-error,
.namedirectory-warning,
.namedirectory-no-results {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    font-weight: bold;
}

.namedirectory-error {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red */
    border: 1px solid #f5c6cb;
}

.namedirectory-warning {
    background-color: #fff3cd; /* Light yellow */
    color: #856404; /* Dark yellow */
    border: 1px solid #ffeeba;
}

.namedirectory-no-results {
    background-color: #e9ecef; /* Light grey */
    color: #495057; /* Dark grey */
    border: 1px solid #dee2e6;
}


/* --- Directory List Styles --- */
.namedirectory-directory-title {
    color: #0073aa; /* WordPress blue */
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee; /* Separator line */
    padding-bottom: 10px;
}

.namedirectory-count {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 15px;
}

/* Search Form */
.namedirectory-search-form {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    display: flex; /* Arrange elements in a row */
    gap: 10px; /* Space between input and button */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    align-items: center; /* Vertically align items */
}

.namedirectory-search-input {
    flex-grow: 1; /* Allow input to take available space */
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
}

.namedirectory-search-button {
    padding: 8px 15px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.namedirectory-search-button:hover {
    background-color: #005177;
}

.namedirectory-clear-search {
    text-decoration: none;
    color: #dc3232; /* WordPress red */
    font-size: 0.9em;
    margin-left: 5px;
}

.namedirectory-clear-search:hover {
    text-decoration: underline;
}


/* Alphabetical Index */
.namedirectory-alphabet-index {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    display: flex; /* Arrange links in a row */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 5px; /* Space between links */
}

.namedirectory-index-link {
    text-decoration: none; /* Remove underline */
    color: #0073aa; /* WordPress blue */
    font-weight: bold;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease; /* Smooth transition */
    flex-grow: 1; /* Allow links to grow */
    text-align: center; /* Center text */
    min-width: 30px; /* Minimum width for small letters */
}

.namedirectory-index-link:hover {
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.namedirectory-index-link.active {
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
    cursor: default; /* No pointer cursor for active link */
}

/* Names List */
.namedirectory-names-list {
    list-style: none; /* Remove default list bullets */
    margin: 0;
    padding: 0;
}

.namedirectory-name-item {
    border-bottom: 1px dashed #eee; /* Dashed separator between names */
    padding: 15px 0;
}

.namedirectory-name-item:last-child {
    border-bottom: none; /* No border for the last item */
}

.namedirectory-letter-header {
    margin-top: 20px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #0073aa; /* Blue underline for letter headers */
    color: #0073aa;
    font-size: 1.5em;
    font-weight: bold;
    list-style: none; /* Ensure no list bullet */
    padding-left: 0; /* Remove default padding */
}

/* Container for Name and Action Links */
.namedirectory-item-row {
    display: flex; /* Arrange name and action links in a row */
    align-items: center; /* Vertically align items */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    /* Removed gap here, will manage spacing within flex items */
    justify-content: space-between; /* Push name to start, links to end */
}

.namedirectory-name {
    margin: 0; /* Remove default margin */
    font-size: 1.2em;
    flex-shrink: 0; /* Prevent name from shrinking */
    /* Add some right margin to create space between name and links */
    margin-right: 15px; /* Adjust as needed */
    /* Allow name to take some space, but prioritize links staying together */
    flex-grow: 1;
}

.namedirectory-name a {
    text-decoration: none;
    color: #333; /* Dark grey for name links */
    transition: color 0.2s ease;
}

.namedirectory-name a:hover {
    color: #0073aa; /* WordPress blue on hover */
}

/* Container for Meaning and Origin links */
.namedirectory-action-links {
    display: flex; /* Arrange meaning and origin links in a row */
    gap: 8px; /* Space between meaning and origin links */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    align-items: center;
    /* Ensure this container doesn't take up more space than needed */
    flex-shrink: 0;
}

/* Styles for Meaning and Origin Links (the "nice boxes") */
.namedirectory-meaning-link,
.namedirectory-origin-link {
    display: inline-block; /* Allows padding and margin */
    text-decoration: none;
    font-size: 0.85em;
    font-weight: bold;
    padding: 5px 10px;
    border: 1px solid #0073aa; /* WordPress blue border */
    border-radius: 4px;
    color: #0073aa; /* WordPress blue text */
    background-color: #e5f5ff; /* Light blue background */
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.namedirectory-meaning-link:hover,
.namedirectory-origin-link:hover {
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
}


/* Pagination */
.namedirectory-pagination {
    margin-top: 20px;
    text-align: center;
}

.namedirectory-pagination ul.page-numbers {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-block; /* Center the pagination block */
}

.namedirectory-pagination ul.page-numbers li {
    display: inline-block; /* Display page numbers in a row */
    margin: 0 3px;
}

.namedirectory-pagination ul.page-numbers li a,
.namedirectory-pagination ul.page-numbers li span {
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #0073aa;
    background-color: #fff;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.namedirectory-pagination ul.page-numbers li a:hover {
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.namedirectory-pagination ul.page-numbers li span.current {
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
    font-weight: bold;
}


/* --- Single Name Page Styles --- */
.namedirectory-single-wrapper {
    /* Inherits general wrapper styles */
}

.namedirectory-breadcrumb {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 15px;
}

.namedirectory-breadcrumb a {
    color: #0073aa;
    text-decoration: none;
}

.namedirectory-breadcrumb a:hover {
    text-decoration: underline;
}


.namedirectory-single-name {
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.namedirectory-single-description,
.namedirectory-single-origin {
    margin-bottom: 10px;
    line-height: 1.6; /* Improve readability */
}

.namedirectory-single-description strong,
.namedirectory-single-origin strong {
    color: #0073aa; /* Highlight labels */
}

.namedirectory-back-link {
    display: inline-block; /* Allows margin/padding */
    margin-top: 20px;
    text-decoration: none;
    color: #0073aa;
    font-weight: bold;
    transition: color 0.2s ease;
}

.namedirectory-back-link:hover {
    color: #005177; /* Darker blue on hover */
}


/* --- Random Name Styles --- */
.namedirectory-random-wrapper {
    /* Inherits general wrapper styles */
}

.namedirectory-random-wrapper h3 {
     color: #0073aa;
     margin-top: 0;
     margin-bottom: 10px;
     border-bottom: 1px solid #eee;
     padding-bottom: 5px;
}

.namedirectory-random-name {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.namedirectory-random-description,
.namedirectory-random-origin {
     margin-bottom: 8px;
     line-height: 1.5;
}

.namedirectory-random-description strong,
.namedirectory-random-origin strong {
     color: #0073aa;
}


/* --- Responsive Adjustments --- */
@media (max-width: 768px) { /* Adjusted breakpoint for better layout on tablets */
    .namedirectory-search-form {
        flex-direction: column; /* Stack search elements vertically */
        align-items: stretch; /* Stretch items to full width */
    }

    .namedirectory-search-input {
        flex-grow: 0; /* Don't grow on small screens */
        width: 100%; /* Take full width */
    }

    .namedirectory-search-button {
        width: 100%; /* Take full width */
    }

    .namedirectory-clear-search {
        display: block; /* Display clear link on its own line */
        margin-left: 0;
        text-align: center;
        margin-top: 5px;
    }


    .namedirectory-alphabet-index {
        justify-content: space-around; /* Distribute links evenly */
        gap: 3px;
    }

    .namedirectory-index-link {
        padding: 4px 6px;
        min-width: 25px;
        font-size: 0.9em;
    }

    .namedirectory-wrapper,
    .namedirectory-random-wrapper,
    .namedirectory-single-wrapper {
        padding: 15px;
    }

    .namedirectory-directory-title,
    .namedirectory-single-name {
        font-size: 1.3em;
    }

    .namedirectory-letter-header h2 {
         font-size: 1.3em;
    }

    .namedirectory-name {
        font-size: 1.1em;
    }

    .namedirectory-item-row {
        flex-direction: column; /* Stack name and links vertically on small screens */
        align-items: flex-start; /* Align items to the start */
        gap: 8px; /* Space between stacked items */
    }

    /* On larger screens, allow row layout */
    @media (min-width: 769px) {
        .namedirectory-item-row {
            flex-direction: row;
            justify-content: space-between; /* Push name and links apart */
            align-items: center;
            gap: 15px; /* Space between name and links */
        }
         .namedirectory-name {
             margin-right: 0; /* Remove right margin when in row layout */
             flex-grow: 1; /* Allow name to grow */
         }
         .namedirectory-action-links {
             flex-shrink: 0; /* Prevent links from shrinking */
             gap: 8px; /* Space between meaning/origin links */
         }
    }


    .namedirectory-action-links {
        gap: 6px; /* Reduce space between meaning/origin links */
    }


    .namedirectory-pagination ul.page-numbers li {
        margin: 0 2px;
    }

    .namedirectory-pagination ul.page-numbers li a,
    .namedirectory-pagination ul.page-numbers li span {
         padding: 6px 10px;
    }
}

