/* General Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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;
    background-color: #f8f9fa; /* Lighter background */
    color: #343a40; /* Darker text for contrast */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 60px; /* Account for fixed header */
}

/* Header */
header {
    background-color: #343a40; /* Dark header */
    color: #ffffff;
    padding: 0.8rem 1.5rem;
    text-align: center;
    position: fixed; /* Keep header fixed */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex; /* Use flexbox for alignment */
    justify-content: space-between; /* Space out title and nav */
    align-items: center;
}

header h1 {
    color: #ffffff;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 500;
}

header nav a {
    color: #adb5bd; /* Lighter link color */
    text-decoration: none;
    margin-left: 15px;
    font-size: 0.9rem;
    transition: color 0.2s ease-in-out;
}

header nav a:hover {
    color: #ffffff;
}

/* Main Content Area */
main {
    max-width: 1000px; /* Limit content width */
    margin: 2rem auto; /* Center content with top/bottom margin */
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    flex-grow: 1; /* Allow main to grow and push footer down */
    width: 95%; /* Responsive width */
}

h2 {
    color: #495057;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
    font-weight: 500;
}

/* Search Section */
#search-section {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: none; /* Remove border if not needed */
    display: flex;
    align-items: center;
    gap: 10px; /* Space between label and input */
}

#search-section label {
    font-weight: 500;
    color: #495057;
}

#search-input {
    flex-grow: 1; /* Allow input to take available space */
    padding: 0.6rem 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

#search-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Agent List */
#agent-list-container {
    margin-top: 1rem;
}

.agent-card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    padding: 1.2rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    transition: box-shadow 0.2s ease-in-out;
}

.agent-card:hover {
     box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.agent-card h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #007bff; /* Primary color for name */
    font-weight: 600;
    font-size: 1.15rem;
}

.agent-card p {
    margin-bottom: 0.8rem;
    color: #6c757d; /* Softer color for description */
    font-size: 0.95rem;
}

.agent-card small {
    display: block; /* Make ID block for spacing */
    margin-bottom: 0.8rem;
    color: #adb5bd;
    font-size: 0.8rem;
}

.verified-badge {
    font-weight: 500;
    color: #1e7e34; /* Darker green */
    background-color: #d4edda; /* Lighter green */
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 8px; /* Space from name */
    display: inline-block;
    border: 1px solid #c3e6cb;
}


/* Buttons */
button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.agent-card button, #back-to-list {
    background-color: #6c757d; /* Secondary button color */
    color: white;
    border-color: #6c757d;
}

.agent-card button:hover, #back-to-list:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

/* Pagination */
#pagination-controls {
    margin-top: 2rem;
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

#pagination-controls button {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    margin: 0 5px;
}

#pagination-controls button:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    border-color: #dee2e6;
    cursor: not-allowed;
}

#pagination-controls button:not(:disabled):hover {
    background-color: #0056b3;
    border-color: #004085;
}

#pagination-controls span {
    margin: 0 10px;
    color: #6c757d;
    font-size: 0.9rem;
}

/* --- ADDED: Agent Detail View Styles --- */
#agent-detail-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

#agent-detail-section h2 { /* Agent Name */
    margin-bottom: 1rem;
    color: #343a40;
}

#back-to-list {
    margin-bottom: 1.5rem;
    float: right; /* Position back button */
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive grid */
    gap: 1.5rem 2rem; /* Row and column gap */
    margin-top: 1rem;
    clear: both; /* Clear float from back button */
}

.detail-item {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.detail-item-full {
    grid-column: 1 / -1; /* Make item span full width */
}

.detail-label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.detail-value {
    color: #343a40;
    font-size: 0.95rem;
    word-wrap: break-word; /* Wrap long values */
}
.detail-value.monospace {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9rem;
    background-color: #e9ecef; /* Slight background for code-like things */
    padding: 0.1em 0.4em;
    border-radius: 3px;
}
.detail-value a { /* Style links within values */
    color: #007bff;
    text-decoration: none;
}
.detail-value a:hover {
    text-decoration: underline;
}
.detail-value p { /* Paragraphs within values (like description) */
    margin: 0;
}

.detail-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin-top: 0; /* Reset margin */
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #eee;
}

.detail-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.detail-list li {
    padding: 0.4rem 0;
    border-bottom: 1px dashed #eee;
    font-size: 0.9rem;
}
.detail-list li:last-child {
    border-bottom: none;
}
.detail-list strong { /* For Auth scheme name, capability key */
    color: #343a40;
    margin-right: 8px;
}

.detail-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.detail-tags-container .tag {
    background-color: #e2e3e5;
    color: #495057;
    padding: 0.25em 0.6em;
    border-radius: 10px;
    font-size: 0.8rem;
}

#agent-policies {
    margin-top: 0; /* Reset margin as it's inside a detail-item */
    padding-top: 0;
    border-top: none;
}

#agent-policies a {
    display: inline-block;
    margin-right: 15px;
    margin-top: 5px; /* Add top margin */
    color: #007bff;
    text-decoration: none;
    font-size: 0.9rem;
}

#agent-policies a:hover {
    text-decoration: underline;
}

/* --- END ADDED --- */


/* Footer */
footer {
    background-color: #e9ecef; /* Lighter footer */
    color: #6c757d;
    padding: 1rem 0;
    text-align: center;
    margin-top: 2rem; /* Ensure space above footer */
    font-size: 0.85rem;
    border-top: 1px solid #dee2e6;
}

/* Basic Responsiveness */
@media (max-width: 768px) {
    body {
        padding-top: 80px; /* Adjust for potentially taller stacked header */
    }
    main {
        margin: 1rem auto;
        padding: 1rem;
        width: 98%;
    }
    header {
        flex-direction: column; /* Stack title and nav on small screens */
        text-align: center;
        padding: 0.6rem 1rem;
    }
    header h1 {
        margin-bottom: 0.5rem;
    }
    header nav a {
        margin: 0 8px;
    }
    #search-section {
        flex-direction: column;
        align-items: stretch;
    }
    #search-section label {
        margin-bottom: 5px;
    }
    /* --- ADDED: Adjust detail grid for smaller screens --- */
    .detail-grid {
        grid-template-columns: 1fr; /* Stack items */
        gap: 1rem;
    }
    #back-to-list {
        float: none; /* Remove float on small screens */
        display: block; /* Make it full width */
        margin-bottom: 1rem;
        text-align: center;
    }
    /* --- END ADDED --- */
}
