/* NSEMM API Documentation Unified Styles */

.nsemm-api-doc {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* API Type Badges */
.api-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
    text-transform: uppercase;
}

.api-type-badge.hesa {
    background: #e3f2fd;
    color: #1565c0;
}

.api-type-badge.education-deprivation {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* API Endpoint Styling */
.api-endpoint {
    background: #f8f9fa;
    border-left: 4px solid #007cba;
    padding: 20px;
    margin: 15px 0;
    border-radius: 0 4px 4px 0;
}

.api-endpoint.hesa {
    border-left-color: #007cba;
}

.api-endpoint.education-deprivation {
    border-left-color: #6f42c1;
}

.api-endpoint h3 {
    margin: 0 0 15px 0;
    color: #007cba;
    font-size: 1.2em;
}

.api-endpoint.education-deprivation h3 {
    color: #6f42c1;
}

/* HTTP Method Badges */
.api-method {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    color: white;
    margin-right: 10px;
    font-size: 0.85em;
    text-transform: uppercase;
    font-family: Monaco, Consolas, monospace;
}

.api-method.get { background: #28a745; }
.api-method.post { background: #007bff; }
.api-method.put { background: #ffc107; color: #000; }
.api-method.delete { background: #dc3545; }

.api-endpoint code {
    background: #2d3748;
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: Monaco, Consolas, monospace;
    font-size: 0.9em;
    word-break: break-all;
}

/* Parameters Section */
.api-parameters {
    margin: 25px 0;
}

.api-parameters h3 {
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.api-parameter {
    background: #e9ecef;
    padding: 15px;
    margin: 8px 0;
    border-radius: 4px;
    border-left: 3px solid #6c757d;
}

.api-parameter-name {
    font-weight: 600;
    color: #495057;
    font-family: Monaco, Consolas, monospace;
    font-size: 0.95em;
}

.api-parameter-type {
    color: #6c757d;
    font-size: 0.9em;
    font-style: italic;
}

.api-parameter-required {
    color: #dc3545;
    font-weight: 600;
    font-size: 0.85em;
}

.api-parameter p {
    margin: 8px 0 0 0;
    color: #666;
}

/* Response and Example Styling */
.api-example {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: Monaco, Consolas, monospace;
    font-size: 0.9em;
    line-height: 1.4;
    position: relative;
    cursor: pointer;
}

.api-example:hover::after {
    content: "Click to copy";
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
}

.api-example code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.api-try-it {
    margin: 25px 0;
    padding: 20px;
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 8px;
}

.api-try-it h3 {
    color: #495057;
    margin: 0 0 15px 0;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
}

.api-response {
    margin: 20px 0;
}

.api-response h3 {
    color: #495057;
    margin-bottom: 15px;
}

/* Education Deprivation Score specific styling */
.deprivation-score {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.deprivation-score-high {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.deprivation-score-medium {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.deprivation-score-low {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* API Category Filter */
.api-category-filter {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.api-category-filter label {
    font-weight: 600;
    color: #495057;
}

.api-category-filter select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
}

/* API Documentation Grid */
.api-docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.api-doc-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
}

.api-doc-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.api-doc-card h3 {
    margin: 0 0 10px 0;
    color: #007cba;
}

.api-doc-card h3 a {
    color: inherit;
    text-decoration: none;
}

.api-doc-card h3 a:hover {
    text-decoration: underline;
}

.api-doc-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #6c757d;
    flex-wrap: wrap;
}

.api-doc-excerpt {
    color: #666;
    line-height: 1.6;
}

/* API Tester Interface */
.api-tester, .nsemm-api-explorer {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    margin: 20px 0;
}

.api-tester-form, .api-explorer-form {
    margin-bottom: 20px;
}

.api-tester-param, .api-explorer-param {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.api-tester-param label, .api-explorer-param label {
    min-width: 120px;
    font-weight: 500;
    color: #495057;
}

.api-tester-param input,
.api-tester-param select,
.api-explorer-param input,
.api-explorer-param select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
}

.api-tester-submit, .api-explorer-submit {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.api-tester-submit:hover, .api-explorer-submit:hover {
    background: #005a87;
}

.api-tester-submit:disabled, .api-explorer-submit:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.api-tester-response {
    margin-top: 20px;
    padding: 15px;
    background: #2d3748;
    color: #e2e8f0;
    border-radius: 4px;
    font-family: Monaco, Consolas, monospace;
    font-size: 0.85em;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 400px;
}

.api-tester-loading {
    color: #ffc107;
    font-weight: 600;
}

.api-tester-error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

/* Data sources section */
.data-sources {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin: 20px 0;
}

.data-sources h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1em;
}

.data-sources ul {
    margin: 0;
    padding-left: 20px;
    color: #666;
}

/* Copy feedback */
.copy-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 10000;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-10px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Single API Doc Template Styles */
.nsemm-api-doc-single {
    max-width: 1200px;
    margin: 0 auto;
}

.nsemm-api-doc-single .entry-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.nsemm-api-doc-single .entry-title {
    color: #007cba;
    margin-bottom: 15px;
}

.nsemm-api-doc-single .api-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.nsemm-api-doc-single .api-endpoint-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nsemm-api-doc-single .api-url {
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: Monaco, Consolas, monospace;
    border: 1px solid #dee2e6;
}

.nsemm-api-doc-single .data-sources,
.nsemm-api-doc-single .api-parameters,
.nsemm-api-doc-single .api-example-response,
.nsemm-api-doc-single .api-try-it,
.nsemm-api-doc-single .api-additional-info {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.nsemm-api-doc-single .parameters-list {
    margin: 15px 0;
}

.nsemm-api-doc-single .api-parameter {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.nsemm-api-doc-single .parameter-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.nsemm-api-doc-single .parameter-name {
    font-weight: 600;
    color: #495057;
    font-family: Monaco, Consolas, monospace;
}

.nsemm-api-doc-single .parameter-type {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    color: #495057;
}

.nsemm-api-doc-single .parameter-required {
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
}

.nsemm-api-doc-single .parameter-description {
    margin: 10px 0 5px 0;
    color: #666;
}

.nsemm-api-doc-single .parameter-default {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 0.9em;
}

.nsemm-api-doc-single .api-example {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
}

.nsemm-api-doc-single .back-to-docs {
    display: inline-block;
    padding: 10px 20px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 20px;
}

.nsemm-api-doc-single .back-to-docs:hover {
    background: #005a87;
    color: white;
}

/* Archive and listing styles */
.nsemm-api-docs-archive {
    margin: 20px 0;
}

.archive-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.archive-header h1 {
    color: #007cba;
    margin-bottom: 10px;
}

.archive-description {
    color: #666;
    font-size: 1.1em;
}

/* API Explorer Styles */
.nsemm-api-explorer {
    max-width: 1000px;
    margin: 20px 0;
}

.explorer-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

/* Responsive design */
@media (max-width: 768px) {
    .api-tester-param,
    .api-explorer-param {
        flex-direction: column;
        align-items: stretch;
    }
    
    .api-tester-param label,
    .api-explorer-param label {
        min-width: auto;
        margin-bottom: 5px;
    }
    
    .api-doc-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .api-example {
        font-size: 0.8em;
    }
    
    .api-docs-grid {
        grid-template-columns: 1fr;
    }
    
    .api-category-filter {
        flex-direction: column;
        align-items: flex-start;
    }
}