*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #212529;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

h2 {
    font-size: 1.4rem;
    margin: 40px 0 16px;
    color: #343a40;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 8px;
}

h3 { font-size: 1.1rem; color: #495057; }
h4 { font-size: 0.95rem; color: #6c757d; margin: 16px 0 8px; }

.tag {
    background: #3498db;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    vertical-align: middle;
}

/* Base URL */
.base-url-box {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 14px 20px;
    border-radius: 6px;
    margin: 20px 0;
    font-size: 0.95rem;
}

.base-url-box code {
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    color: #2c3e50;
}

/* Search */
.search-box { margin: 20px 0; }

.search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
}

.search-input:focus { border-color: #3498db; }

/* Stats */
.stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.stat-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.9rem;
    color: #495057;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0 24px;
}

.btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    color: #495057;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover { background: #f8f9fa; border-color: #adb5bd; }

.btn-primary {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.btn-primary:hover { background: #2980b9; border-color: #2980b9; }

/* Auth grid */
.auth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.auth-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px 20px;
    border-left-width: 4px;
}

.auth-card.auth-credentials { border-left-color: #e67e22; }
.auth-card.auth-key         { border-left-color: #27ae60; }
.auth-card.auth-none        { border-left-color: #95a5a6; }
.auth-card p { margin: 6px 0 0; font-size: 0.9rem; color: #6c757d; }

/* Collapsible */
.collapsible {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.collapsible-header:hover { background: #f8f9fa; }

.collapsible-content {
    padding: 24px;
    border-top: 1px solid #dee2e6;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s, padding 0.2s;
}

.collapsible-content.collapsed {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0;
    visibility: hidden;
    border-top: none;
}

.toggle-icon {
    font-size: 0.8rem;
    color: #adb5bd;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.collapsible-header.collapsed .toggle-icon { transform: rotate(-90deg); }

/* Endpoint summary row */
.endpoint-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.path {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 600;
}

.endpoint-short-description {
    font-size: 0.875rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}

.endpoint-description {
    color: #495057;
    margin: 0 0 16px;
}

/* Method badges */
.method-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    color: #fff;
    text-transform: uppercase;
    flex-shrink: 0;
}

.method-GET    { background: #27ae60; }
.method-POST   { background: #3498db; }
.method-PUT    { background: #e67e22; }
.method-PATCH  { background: #8e44ad; }
.method-DELETE { background: #e74c3c; }

/* Auth badges */
.auth-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid;
    flex-shrink: 0;
    margin-left: auto;
}

.auth-badge.auth-none        { color: #6c757d; border-color: #ced4da; background: #f8f9fa; }
.auth-badge.auth-credentials { color: #e67e22; border-color: #f0a060; background: #fff8f0; }
.auth-badge.auth-key         { color: #27ae60; border-color: #82c89a; background: #f0faf4; }
.auth-badge.auth-token       { color: #3498db; border-color: #90c8ec; background: #f0f8ff; }

/* URL example */
.url-example {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.url-example code {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: #2c3e50;
    white-space: pre;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin-bottom: 16px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead { background: #f1f3f5; }

th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    border-bottom: 1px solid #dee2e6;
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f9fa; }

code.field-name {
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #c0392b;
}

.data-type {
    display: inline-block;
    background: #e8f4fd;
    color: #2980b9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.data-type.nullable { background: #fff3e0; color: #e67e22; }

.field-required {
    display: inline-block;
    background: #ffeaea;
    color: #c0392b;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.field-optional {
    display: inline-block;
    background: #e9ecef;
    color: #6c757d;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.field-description { color: #495057; }
.field-description small { color: #6c757d; }

.nested-table {
    margin-top: 10px;
    padding-left: 12px;
    border-left: 3px solid #3498db;
}

/* Example block */
.example-block {
    background: #1e2a38;
    border-radius: 6px;
    overflow: hidden;
}

.example-title {
    background: #2c3e50;
    color: #adb5bd;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.example-block pre {
    margin: 0;
    padding: 20px;
    color: #a8d8a8;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.5;
}

/* Formats footer */
.formats-footer {
    margin-top: 48px;
    padding: 24px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
}

.format-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.format-link {
    display: inline-block;
    padding: 8px 20px;
    background: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.format-link:hover { background: #2980b9; }

@media (max-width: 640px) {
    .container { padding: 16px 12px 48px; }
    h1 { font-size: 1.5rem; }
    .endpoint-short-description { display: none; }
    .stats { gap: 8px; }
}
