/* API Documentation Specific Styles */

.api-content {
    max-width: 1000px;
    margin: 0 auto;
}

/* API Section */
.api-section {
    background: var(--surface-color);
    border-radius: 16px;
    box-shadow: var(--shadow-1);
    padding: 24px;
    margin-bottom: 24px;
    animation: fadeInUp var(--animation-duration) var(--animation-easing);
}

/* API Key Configuration */
.api-key-config {
    margin-top: 16px;
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-group .form-input {
    flex: 1;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

/* API Overview */
.api-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.info-card {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.info-card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.code-inline {
    background: rgba(66, 165, 245, 0.1);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
}

/* Endpoint Groups */
.endpoint-group {
    margin-bottom: 32px;
}

.endpoint-group-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Endpoint Cards */
.endpoint-card {
    background: var(--bg-color);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.endpoint-card:hover {
    box-shadow: var(--shadow-1);
}

.endpoint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    user-select: none;
}

.endpoint-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.method-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.method-get {
    background: #4caf50;
    color: white;
}

.method-post {
    background: #2196f3;
    color: white;
}

.endpoint-toggle {
    transition: transform 0.3s ease;
}

.endpoint-card.expanded .endpoint-toggle {
    transform: rotate(180deg);
}

.endpoint-body {
    display: none;
    padding: 0 16px 16px;
    animation: slideDown 0.3s ease;
}

.endpoint-card.expanded .endpoint-body {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.endpoint-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Endpoint Testing */
.endpoint-test {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.endpoint-test h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.code-editor {
    font-family: monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    background: #1e1e1e;
    color: #d4d4d4;
    border: none;
    border-radius: 8px;
    padding: 12px;
    resize: vertical;
}

/* Response Container */
.response-container {
    margin-top: 16px;
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.response-status {
    font-size: 0.875rem;
    font-weight: 600;
}

.response-status.success {
    color: #4caf50;
}

.response-status.error {
    color: #f44336;
}

.response-body {
    padding: 16px;
    margin: 0;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.response-body code {
    background: transparent !important;
    padding: 0 !important;
}

/* Streaming Progress */
.streaming-progress {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: #d4d4d4;
    font-size: 0.875rem;
}

/* Code Examples */
.code-example {
    margin-top: 16px;
}

.code-example h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.code-example pre {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
}

/* Code Tabs */
.code-tabs {
    background: var(--bg-color);
    border-radius: 12px;
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.tab-button {
    flex: 1;
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    background: rgba(0, 0, 0, 0.05);
}

.tab-button.active {
    color: var(--primary-color);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

.tab-content {
    padding: 24px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Alerts */
.alert {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert-warning {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.alert .material-icons {
    font-size: 20px;
}

/* Form Elements */
.form-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* Buttons */
.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1557b0;
    transform: translateY(-1px);
    box-shadow: var(--shadow-1);
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
    transform: translateY(-1px);
    box-shadow: var(--shadow-1);
}

/* Copy Button */
.copy-response {
    color: #d4d4d4;
}

.copy-response:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.copy-response.copied {
    color: #4caf50;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .api-section {
        padding: 16px;
    }
    
    .tab-buttons {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1 1 50%;
    }
    
    .endpoint-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .endpoint-title code {
        font-size: 0.75rem;
        word-break: break-all;
    }
}

/* Lightbox Modal */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.show {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-3);
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease;
}

.lightbox-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lightbox-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
}

.lightbox-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

.lightbox-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.lightbox-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Confirm lightbox specific */
.lightbox-confirm .lightbox-content {
    max-width: 400px;
}

.lightbox-icon {
    margin-right: 8px;
    font-size: 1.25rem;
}

.confirm-message {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0;
}

.lightbox-confirm .lightbox-header {
    background: rgba(255, 193, 7, 0.1);
    border-bottom: 2px solid #ff9800;
}

.lightbox-confirm .lightbox-icon {
    color: #ff9800;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   API Tester Styles (moved from inline)
   ======================================== */

/* Postman-like API Tester Styles */
.api-tester {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
    border: 1px solid var(--border-color);
}

.request-config h3, .response-display h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.request-line {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.method-selector {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 80px;
}

.url-input {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.request-tabs, .response-tabs {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.request-tabs .tab-buttons, .response-tabs .tab-buttons {
    display: flex;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.request-tabs .tab-button, .response-tabs .tab-button {
    background: none;
    border: none;
    padding: 12px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    border-right: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.request-tabs .tab-button:last-child, .response-tabs .tab-button:last-child {
    border-right: none;
}

.request-tabs .tab-button.active, .response-tabs .tab-button.active {
    background: var(--primary-color);
    color: white;
}

.request-tabs .tab-button:hover, .response-tabs .tab-button:hover {
    background: var(--hover-color);
}

.request-tabs .tab-content, .response-tabs .tab-content {
    display: none;
    padding: 16px;
    background: white;
}

.request-tabs .tab-content.active, .response-tabs .tab-content.active {
    display: block;
}

.body-type-selector {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.body-type-selector label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    cursor: pointer;
}

.request-textarea {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    resize: vertical;
}

.header-row, .param-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.header-key, .header-value, .param-key, .param-value {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.remove-header, .remove-param {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.remove-header:hover, .remove-param:hover {
    background: var(--error-color);
    color: white;
}

.add-header, .add-param {
    margin-top: 8px;
}

.response-display {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.response-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
}

.response-status-line {
    display: flex;
    gap: 16px;
    align-items: center;
}

.status-code {
    background: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 12px;
}

.status-code.error {
    background: var(--error-color);
}

.status-text, .response-time, .response-size {
    color: var(--text-secondary);
    font-size: 13px;
}

.response-actions {
    display: flex;
    gap: 8px;
}

.response-body-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.response-body-controls select {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    color: var(--text-primary);
    font-size: 12px;
}

.api-tester .btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.response-content {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.response-headers-list {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.response-header-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.response-header-item:last-child {
    border-bottom: none;
}

.response-header-name {
    font-weight: 500;
    color: var(--text-primary);
}

.response-header-value {
    color: var(--text-secondary);
}

.response-raw {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
}

.streaming-updates {
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.streaming-updates h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 1rem;
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.api-tester .progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-color);
    border-radius: 3px;
    overflow: hidden;
}

.api-tester .progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.api-tester .progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 40px;
}

.streaming-log {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
}

.streaming-log-entry {
    padding: 2px 0;
    border-bottom: 1px solid var(--border-color);
}

.streaming-log-entry:last-child {
    border-bottom: none;
}

.streaming-log-timestamp {
    color: var(--text-secondary);
    margin-right: 8px;
}

.streaming-log-message {
    color: var(--text-primary);
}

.streaming-log-status {
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 500;
    margin-right: 6px;
}

.streaming-log-status.info {
    background: var(--primary-color);
    color: white;
}

.streaming-log-status.success {
    background: var(--success-color);
    color: white;
}

.streaming-log-status.error {
    background: var(--error-color);
    color: white;
}

.streaming-log-status.warning {
    background: #ff9800;
    color: white;
}

/* Scenario Cards */
.scenario-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.scenario-card {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.scenario-card h3 {
    font-size: 1.125rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.scenario-card p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.api-section .btn-secondary {
    background: var(--hover-color);
    color: var(--text-primary);
}

.api-section .btn-secondary:hover {
    background: var(--border-color);
}

/* Field Descriptions */
.field-descriptions {
    margin-top: 20px;
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
}

.field-descriptions h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.field-descriptions ul {
    margin-left: 20px;
    color: var(--text-secondary);
}

.field-descriptions li {
    margin-bottom: 8px;
}

.field-descriptions strong {
    color: var(--text-primary);
}

/* Documentation Links */
.doc-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.doc-link {
    display: flex;
    gap: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.doc-link:hover {
    box-shadow: var(--shadow-1);
    transform: translateY(-2px);
}

.doc-link .material-icons {
    font-size: 36px;
    color: var(--primary-color);
}

.doc-link h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.doc-link p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}