/**
 * 📄 Endpoint Drawer - Painel lateral para documentação
 * v6.3.0 - Slide-over sem quebrar layout existente
 */

/* Drawer Container */
.endpoint-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9999;
    display: none;
    pointer-events: none;
}

.endpoint-drawer.open {
    display: block;
    pointer-events: auto;
}

/* Overlay escuro */
.drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.endpoint-drawer.open .drawer-overlay {
    opacity: 1;
}

/* Painel lateral direito */
.drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 90%;
    max-width: 800px;
    background: var(--bg-primary, white);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.endpoint-drawer.open .drawer-content {
    transform: translateX(0);
}

/* Dark mode */
[data-theme="dark"] .drawer-content {
    background: #1f1f1f;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.6);
}

/* Header do drawer */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    flex-shrink: 0;
}

[data-theme="dark"] .drawer-header {
    border-bottom-color: #3d3d3d;
}

.drawer-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin: 0;
}

[data-theme="dark"] .drawer-header h2 {
    color: #f3f4f6;
}

.drawer-close {
    background: none;
    border: none;
    color: var(--text-secondary, #6b7280);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-close:hover {
    background: var(--bg-secondary, #f3f4f6);
}

[data-theme="dark"] .drawer-close {
    color: #9ca3af;
}

[data-theme="dark"] .drawer-close:hover {
    background: #333;
}

/* Body do drawer (scroll) */
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Estilos de conteúdo */
.drawer-body .method-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-right: 0.75rem;
}

.drawer-body .method-badge.GET {
    background: #10B981;
    color: white;
}

.drawer-body .method-badge.POST {
    background: #3B82F6;
    color: white;
}

.drawer-body .method-badge.PUT {
    background: #F59E0B;
    color: white;
}

.drawer-body .method-badge.PATCH {
    background: #EAB308;
    color: white;
}

.drawer-body .method-badge.DELETE {
    background: #EF4444;
    color: white;
}

.drawer-body .endpoint-path {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0.5rem 0 1rem 0;
    font-family: 'Courier New', monospace;
}

[data-theme="dark"] .drawer-body .endpoint-path {
    color: #f3f4f6;
}

.drawer-body .endpoint-description {
    font-size: 1rem;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 2rem;
}

.drawer-body .section {
    margin-bottom: 2rem;
}

.drawer-body .section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[data-theme="dark"] .drawer-body .section-title {
    color: #f3f4f6;
}

.drawer-body .section-title i {
    color: var(--primary, #0091D5);
}

.drawer-body .info-table {
    width: 100%;
    border-collapse: collapse;
}

.drawer-body .info-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

[data-theme="dark"] .drawer-body .info-table td {
    border-bottom-color: #3d3d3d;
}

.drawer-body .info-table td:first-child {
    font-weight: 600;
    color: var(--text-primary, #111827);
    width: 30%;
}

[data-theme="dark"] .drawer-body .info-table td:first-child {
    color: #f3f4f6;
}

.drawer-body .info-table td:last-child {
    color: var(--text-secondary, #6b7280);
}

[data-theme="dark"] .drawer-body .info-table td:last-child {
    color: #9ca3af;
}

.drawer-body .code-block {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    position: relative;
    margin-top: 0.5rem;
}

.drawer-body .code-block .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.2s;
}

.drawer-body .code-block .copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.drawer-body .test-section {
    background: var(--bg-secondary, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

[data-theme="dark"] .drawer-body .test-section {
    background: #252525;
    border-color: #3d3d3d;
}

.drawer-body .test-field {
    margin-bottom: 1rem;
}

.drawer-body .test-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .drawer-body .test-label {
    color: #f3f4f6;
}

.drawer-body .test-input,
.drawer-body .test-textarea {
    width: 100%;
    background: var(--bg-primary, white);
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 6px;
    padding: 0.75rem;
    color: var(--text-primary, #111827);
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
}

[data-theme="dark"] .drawer-body .test-input,
[data-theme="dark"] .drawer-body .test-textarea {
    background: #1a1a1a;
    border-color: #3d3d3d;
    color: #e5e7eb;
}

.drawer-body .test-textarea {
    min-height: 120px;
    resize: vertical;
}

.drawer-body .test-btn {
    background: #10B981;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.drawer-body .test-btn:hover {
    background: #059669;
}

.drawer-body .response-viewer {
    background: #1f2937;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.drawer-body .response-viewer pre {
    margin: 0;
    font-size: 0.75rem;
    color: #e5e7eb;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Responsivo */
@media (max-width: 768px) {
    .drawer-content {
        width: 100%;
        max-width: none;
    }
    
    .drawer-header {
        padding: 1rem 1.5rem;
    }
    
    .drawer-body {
        padding: 1.5rem;
    }
}

/* Scrollbar customizado */
.drawer-body::-webkit-scrollbar {
    width: 8px;
}

.drawer-body::-webkit-scrollbar-track {
    background: var(--bg-secondary, #f3f4f6);
}

[data-theme="dark"] .drawer-body::-webkit-scrollbar-track {
    background: #252525;
}

.drawer-body::-webkit-scrollbar-thumb {
    background: var(--border-color, #d1d5db);
    border-radius: 4px;
}

.drawer-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
